Commit 6ec1112
fix(linter): mark unused disable directive fix as suggestion (#18703)
## Summary
Changes the auto-fix for "unused disable directives" from a safe fix to a suggestion, preventing unintended removal of directives needed byother linters.
Fixes #17522
## Problem
The auto-fix for unused disable directives would automatically remove `eslint-disable` or `oxlint-disable` comments when running `oxlint --fix`. However, these directives might be:
1. Needed for ESLint when both linters are used
2. For JS plugins not yet supported by oxlint
## Solution
Changed the fix kind from `FixKind::Fix` to `FixKind::Suggestion` in:
- `crates/oxc_linter/src/context/host.rs` (line 323)
- `crates/oxc_linter/src/disable_directives.rs` (lines 118 and 141)
## Behavior Change
- **Before**: `oxlint --fix` automatically removes unused disable
directives
- **After**: The fix is a suggestion (requires `--fix-suggestions` to
apply)
## Test plan
- [x] All 11 tests in the `disable_directives` module pass
- [ ] Verify `--fix` no longer auto-removes disable directives
- [ ] Verify `--fix-suggestions` still applies the fix when desired
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: ddmoney420 <ddmoney420@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Cameron <cameron.clark@hey.com>1 parent 5bd6758 commit 6ec1112
2 files changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
324 | 326 | | |
325 | 327 | | |
326 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
0 commit comments