Skip to content

fix(linter): suggest behavior-changing rewrites and preserve source syntax - #29522

Draft
Aschenbath wants to merge 4 commits into
oxc-project:mainfrom
Aschenbath:fix/safe-fixes-16911
Draft

Aschenbath wants to merge 4 commits into
oxc-project:mainfrom
Aschenbath:fix/safe-fixes-16911

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

Several automatic rule fixes change program behavior or discard source expressions. This moves intentional behavior changes to suggestions and corrects the remaining rewrites covered here, so --fix preserves the affected inputs' semantics.

  • Offer eslint/no-unsafe-negation, node/no-exports-assign, promise/no-new-statics, and the Jest/Vitest prefer-comparison-matcher, prefer-expect-resolves, and prefer-to-contain rewrites as suggestions. Tests exercise both safe-fix and suggestion modes.
  • Preserve expect aliases, message arguments, modifiers, matcher arguments, and surrounding syntax in the call-count matchers. Withhold prefer-called-times fixes when matcher arguments would be discarded.
  • Resolve React Fragment imports before rewriting JSX, including aliases and shadowed/local bindings.
  • Preserve directive prologues and ASI boundaries when removing labels, and preserve line terminators/token separation when removing TSLint comments.
  • Update the two type-aware rule capability declarations to match the companion TSGolint fixes in fix(rules): preserve types and comparison semantics in fixes tsgolint#1363.

Closes #29464
Closes #29466
Closes #29474
Closes #29475
Closes #29476
Closes #29480
Closes #29482
Closes #29483
Closes #29487
Closes #29488
Closes #29490

These are the native issues from the #16911 safety audit that did not already have linked PRs when checked. The other 22 reported rule cases remain covered by #29309 and #29493–#29512; this PR does not resolve the whole audit by itself.

Validation:

  • Unfiltered cargo test --all-features -p oxc_linter: 1,319 unit tests plus integration and doc tests passed; 7 existing doc tests ignored.
  • cargo lintgen, just lint -p oxc_linter, and just doc -p oxc_linter passed. Generated rule runner files are unchanged.
  • Rust and repository formatting and diff checks passed. Reviewed the directive-prologue snapshot change.

AI disclosure: OpenAI Codex was used to implement, review, and test this change.

@github-actions github-actions Bot added the A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details label Nov 14, 2026
@codspeed

codspeed Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 105 skipped benchmarks1


Comparing Aschenbath:fix/safe-fixes-16911 (4188cb8) with main (65659e6)

Open in CodSpeed

Footnotes

  1. 105 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@camc314 camc314 changed the title fix(linter): correct unsafe automatic fixes fix(linter): suggest behavior-changing rewrites and preserve source syntax Nov 15, 2026

This branch has not been deployed

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

Labels

A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details

Projects

None yet

2 participants