Skip to content

fix(lint): fail lint:fix when unfixable errors remain#29690

Open
danyalahmed1995 wants to merge 1 commit into
mdn:mainfrom
danyalahmed1995:fix/29615-lint-fix-unfixable-errors
Open

fix(lint): fail lint:fix when unfixable errors remain#29690
danyalahmed1995 wants to merge 1 commit into
mdn:mainfrom
danyalahmed1995:fix/29615-lint-fix-unfixable-errors

Conversation

@danyalahmed1995
Copy link
Copy Markdown

Summary

Fixes npm run lint:fix so it exits with a failure when unfixable lint errors remain after the fixer runs.

Previously, lint:fix could successfully apply available fixes and exit 0, even when a follow-up npm run lint would still fail on the same target files. This made the command report success for cases it could not fully fix.

The fix reuses the normal lint pass after running the existing fixers and exits non-zero when lint errors remain.

Fixes #29615.

Validation

  • npm run lint:fix -- http/headers/X-Frame-Options.json
  • npm run lint -- http/headers/X-Frame-Options.json
  • Temporarily reproduced the missing spec_url case from Fixer does not report "Marked as standard_track, but missing required spec_url" #29615 and confirmed lint:fix now exits with failure when the remaining lint error is unfixable.
  • npm run format
  • npm run lint
  • Unit tests passed with the PowerShell-compatible equivalent after the npm script hit Windows NODE_ENV shell syntax.

@danyalahmed1995 danyalahmed1995 requested review from a team as code owners May 18, 2026 03:00
@danyalahmed1995 danyalahmed1995 requested a review from caugner May 18, 2026 03:00
@github-actions github-actions Bot added infra Infrastructure issues (npm, GitHub Actions, releases) of this project linter Issues or pull requests regarding the tests / linter of the JSON files. size:xs [PR only] 0-6 LoC changed labels May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@danyalahmed1995
Copy link
Copy Markdown
Author

System file check failed because I changed the lint/fix.js 🫠

Comment thread lint/fix.js
const { files = dataFolders, only } = argv;

await main(files, { only });
process.exit((await lint(files)) ? 1 : 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting workaround that I hadn't thought about, but unfortunately it would significantly increase the time it takes to run fix:lint.

I will bring this up in tomorrow's BCD meeting.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, I kept this intentionally small to match the current behavior gap, but I can see how re-running the full lint pass after lint:fix could be too expensive for regular use.

I will look for a better solution and get back to you.

Copy link
Copy Markdown
Author

@danyalahmed1995 danyalahmed1995 May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are couple of options we can take a look at

  1. Keep this as-is, but accept the extra lint pass on the same target files.
  2. Add a strict mode such as --fail-on-unfixed, so normal lint:fix stays fast while pre-commit/CI can fail when unfixable errors remain.
  3. Move the follow-up lint call only into the pre-commit path, since that is where the issue was observed.
  4. Run only a narrower post-fix validation for unfixable checks like the standard_track / spec_url case.
  5. Do a larger linter/fixer unification so fixable and unfixable diagnostics come from one shared pass.

Let me know what you think.

@caugner caugner added the meeting agenda Issues or pull requests in need of discussion in a project meeting. label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra Infrastructure issues (npm, GitHub Actions, releases) of this project linter Issues or pull requests regarding the tests / linter of the JSON files. meeting agenda Issues or pull requests in need of discussion in a project meeting. size:xs [PR only] 0-6 LoC changed

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Fixer does not report "Marked as standard_track, but missing required spec_url"

3 participants