Conversation
Add --report-unused-disable-directives and --report-unused-disable-directives-severity CLI flags, plus the linterOptions.reportUnusedDisableDirectives config option, for native Go rules. Tracks per-directive usage in DisableManager and reports eslint-disable/-line/-next-line comments that suppressed no diagnostic.
Add CLI reference, linterOptions config option, and an inline-directives cross-reference for the new unused-disable-directive reporting feature.
…--api rule.DiagnosticSeverity's zero value is SeverityError, not SeverityOff, so RunLinterOptions literals that don't set the field implicitly enable the new unused-disable-directive check. This broke unrelated rule tests and would have silently affected --api consumers (e.g. the VS Code extension).
Matches the general off/warn/error severity convention, so the enum's zero value is now the safe default (off) instead of error. Drops the explicit ReportUnusedDisableDirectives: SeverityOff workarounds added for the previous ordering, since the zero value is now correct.
Contributor
Author
|
I'll put this PR on hold for now. The required changes on the Node.js side turned out to be more complex than expected, and this feature is not a high priority at the moment. I'll revisit it when there is a stronger need or more time to address the related work. |
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.
Summary
--report-unused-disable-directivesand--report-unused-disable-directives-severity <off|warn|error>CLI flags, plus alinterOptions.reportUnusedDisableDirectivesconfig option, matching ESLint's semantics.DisableManager(internal/rule/disable_manager.go) per (directive-comment, rule) pair, marking a directive used the moment it actually suppresses a diagnostic; report everyeslint-disable/-line/-next-linedirective still unused once a file's rules finish running.apply-disable-directives.ts's existing documented design choice not to support this feature.Related Links
Checks run:
gofmt -lon all changed Go files (clean)go build ./internal/... ./cmd/...go test ./internal/rule/...,./cmd/rslint/...,./internal/config/...,./internal/linter/...Checklist