feat(oxlint/lsp)!: show/fix safe suggestions by default#19816
feat(oxlint/lsp)!: show/fix safe suggestions by default#19816
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
9ba7686 to
75f63c0
Compare
There was a problem hiding this comment.
Pull request overview
This pull request changes the default fixKind behavior for the oxlint LSP server from SafeFix to SafeFixOrSuggestion, aligning it with ESLint's default editor experience of showing suggestions by default. This builds on recent architectural improvements that introduced the FixedContentKind enum (PR #19113) and explicit type checking for fix kinds (PR #19795), which now enable differentiating between safe and dangerous fixes/suggestions.
Changes:
- Updated the default
LintFixKindFlagenum value fromSafeFixtoSafeFixOrSuggestion - Inverted test logic to verify suggestions are shown by default and only hidden when explicitly setting
fixKindtosafe_fix - Updated snapshot tests to reflect that safe suggestions are now included in code actions and fix-all operations
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxlint/src/lsp/options.rs | Changed the #[default] attribute from SafeFix to SafeFixOrSuggestion in the LintFixKindFlag enum, and updated the corresponding test assertion |
| apps/oxlint/test/lsp/code_action/code_action.test.ts | Inverted test structure: basic tests now use default config (showing suggestions), while filtered tests explicitly set fixKind: "safe_fix" to hide suggestions |
| apps/oxlint/src/lsp/snapshots/*.snap | Updated snapshots to reflect that code actions and fix-all operations now include safe suggestions by default (previously showed "None") |

ESLint shows by default suggestions in the editor. We did not have the right architecture to difference between safe or dangerous fix / suggestions. With #19113 we know now what kind of fix this is.
This allows us now to align more with the ESLint editor experience. The last found tech dep was #19795.
This will not apply for editors which manage its own configurations like VS Code editor and IntelliJ Plugin (cc @nrayburn-tech). These editors need their own default value changed.
When using auto save
source.fixAll.oxcorsource.fixAllcode action, or theoxc.fixAllcommand, the suggestions will be applied too. Because this is always in a context of one file only, I guess this is safe. Or we can change the line for this:oxc/apps/oxlint/src/lsp/code_actions.rs
Lines 96 to 100 in a45b9f4