fix(linter): respect allow unused disable directives in LSP#22715
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes LSP behavior for unusedDisableDirectives: "allow" so that it disables unused-disable-directive reporting (no warning diagnostics and no “remove directive” code actions), matching the CLI behavior and resolving #22713.
Changes:
- Update LSP lint option mapping so
"allow"no longer enables unused-disable-directive reporting. - Add an LSP regression test + snapshot to ensure
"allow"produces only rule diagnostics and no unused-directive reports. - Add new LSP fixture covering unused directives + real rule violations to validate behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxlint/src/lsp/server_linter.rs | Treats LSP "allow" as “unused directive reporting disabled” and adds a regression test. |
| apps/oxlint/src/lsp/snapshots/[email protected] | Snapshot asserting no unused-directive diagnostics/actions are produced under "allow". |
| apps/oxlint/fixtures/lsp/allow_unused_disabled_directives/test.js | Fixture containing disable directives plus actual lint violations to validate LSP output. |
| apps/oxlint/fixtures/lsp/allow_unused_disabled_directives/.oxlintrc.json | Fixture config enabling rule errors used by the snapshot. |
Sysix
approved these changes
May 25, 2026
Member
Merge activity
|
Fixes #22713 This updates the LSP handling for `unusedDisableDirectives: "allow"` so it disables unused directive reporting instead of producing warning diagnostics and remove-directive code actions. The behavior now matches the CLI path: only `warn` and `deny` enable unused-disable reporting, while `allow`/`off` are treated as disabled. Added an LSP snapshot regression test covering the `"allow"` case.
69f9151 to
52bd016
Compare
Dunqing
added a commit
that referenced
this pull request
May 26, 2026
# Oxlint ### 🚀 Features - 10da26b linter: `no-misleading-character-class` add suggestions for regex literal (#22681) (Sysix) - b84941e linter/vue: Implement no-expose-after-await rule (#22675) (bab) - 98b98c1 linter/vue: Implement no-computed-properties-in-data rule (#22674) (bab) - 868e2e8 linter: Add suggestion for `no-misleading-character-class` (#22631) (Sysix) - 2d4c919 oxlint: Support `vite-plus/resolveConfig` for vite.config.ts (#22456) (leaysgur) - 2a60012 linter/vue: Implement require-render-return rule (#22613) (bab) - 9f227fd linter/vue: Implement no-deprecated-props-default-this rule (#21892) (bab) - 9cd28b3 linter: Add debug option to print files to be linted (#22546) (camchenry) - 87f065e linter/vue: Implement return-in-emits-validator rule (#21935) (bab) - ea0380c linter/unicorn: Implement `import-style` rule (#22173) (Hao Chen) - dde40fe linter/vue: Implement no-watch-after-await rule (#22006) (bab) - a735eb0 linter/vue: Implement valid-next-tick rule (#22531) (bab) - 6dc615d linter/vue: Implement no-shared-component-data rule (#21842) (bab) - a656418 linter/vue: Implement valid-define-options rule (#22107) (bab) - bb6f1b2 linter/vue: Implement require-slots-as-functions rule (#22244) (bab) - 5fa4774 linter/n: Implement `callback-return` rule (#22470) (Mikhail Baev) ### 🐛 Bug Fixes - 52bd016 linter: Respect allow unused disable directives in LSP (#22715) (camc314) - fa7c463 semantic: Correct TS enum member symbol spans (#22689) (camc314) - ed445ba linter: Respect flags overrides for `RegExp(/regex/i, "u")` (#22678) (Sysix) - 26b9396 semantic: Resolve parameter decorators outside parameter scope (#22623) (camc314) - 203952d linter: `no-misleading-character-class` fix `is_unicode_code_point_escape` check (#22655) (Sysix) - 2f64d3d linter: `no-misleading-character-class` own diagnostic for surrogate pairs without u flag (#22654) (Sysix) - 0c6ebc2 linter/eslint/no-lone-blocks: Do not flag empty loops (#22649) (Mikhail Baev) - 2a7562e linter/no-focused-tests: Mark fixer as a suggestion (#22645) (camc314) - dbe644f linter: Respect args none for unused rest parameters (#22627) (camc314) - d0211b0 linter: Allow undefined in DummyRuleMap index (#22626) (camc314) - 36fc0ec oxlint/lsp: "ignore this" actions merge with existing directive (#22604) (Sysix) - f7f370e linter/vitest/prefer-expect-type-of: Recommend `toBeTypeOf` instead of `expectTypeOf` (#22612) (Mikhail Baev) - 77063e5 linter/consistent-indexed-object-style: Preserve interface modifiers in fixes (#22579) (camc314) - 4f33aa7 linter: Treat `TSGlobalDeclaration` as ambient in `has_ambient_typescript_ancestor` (#22577) (camc314) ### ⚡ Performance - c22938d linter/no-async-endpoint-handlers: Populate node types (#22601) (camc314) - 607486e linter/no-negated-condition: Populate node types (#22602) (camc314) - 4dcaa59 linter/consistent-type-imports: Populate node types (#22600) (camc314) - 5bd3b25 linter/no-unused-vars: Avoid cloned ancestor iterator (#22598) (camc314) - 97fe9ba linter/no-extra-non-null-assertion: Reduce node matches (#22588) (camc314) - ae98296 linter/consistent-indexed-object-style: Populate node types (#22578) (camc314) # Oxfmt ### 🚀 Features - 16b8058 oxfmt: Support `vite-plus/resolveConfig` for vite.config.ts (#22454) (leaysgur) ### 🐛 Bug Fixes - 5a26479 formatter: Preserve import phases (#22692) (Cameron) ### ⚡ Performance - 78cf83f formatter: Pre-size output buffer using source text length (#22594) (Dunqing) Co-authored-by: Dunqing <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22713
This updates the LSP handling for
unusedDisableDirectives: "allow"so it disables unused directive reporting instead of producing warning diagnostics and remove-directive code actions.The behavior now matches the CLI path: only
warnanddenyenable unused-disable reporting, whileallow/offare treated as disabled.Added an LSP snapshot regression test covering the
"allow"case.