Skip to content

lint:json is a no-op masked by || true #9

Open

Description

@eleshar

Scope

package.json defines:

"lint:json": "wp-scripts lint-md-docs . --ext=.json || true"

Two defects in one line:

  1. lint-md-docs wraps markdownlint. It does not lint JSON, and --ext is not a valid flag for it — the command errors with an unknown-option failure.
  2. || true swallows that failure, so npm run lint reports success while the JSON linting step has never validated a single file.

lint:json runs as part of the lint chain in CI, so this has been silently passing since the script was added.

Replace it with a linter that actually validates JSON. npm-package-json-lint is already available via the @wordpress/scripts dependency tree; alternatively validate the repo's JSON files — package.json, composer.json, block.json, theme.json where present — against their schemas.

Remove the || true. A lint script that cannot fail is not a lint script.

Compare against ls-starter-theme, which implements a working JSON check inline; decide whether both repos should share one approach and record the decision.

Acceptance criteria

  • npm run lint:json validates the repo's JSON files and exits non-zero on invalid JSON — verified by temporarily breaking a file.
  • No || true or equivalent failure suppression remains in the lint script chain; audit the other lint:* scripts for the same pattern.
  • npm run lint passes on the unmodified template.
  • CI fails if a JSON file is malformed.
  • The JSON-lint approach is consistent across both starter repos, or the difference is documented.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions