Repository navigation
Apply fixable rule customizations per problem - #2251
Open
Ngo Quoc Viet (NgoQuocViet2001) wants to merge 1 commit into
Open
Ngo Quoc Viet (NgoQuocViet2001) wants to merge 1 commit into
Ngo Quoc Viet (NgoQuocViet2001) wants to merge 1 commit into
Conversation
RuleSeverities cached the override by rule ID only, so the fixable filter was evaluated for the first problem of a rule and reused for all later problems of that rule. Include the problem's fixability in the cache key.
There was a problem hiding this comment.
🟢 Approval recommended
The localized change consistently updates cache access and includes regression coverage for both reported failure cases.
No open issues 🎉
What changed in this PR
This PR fixes order-dependent severity customizations in the ESLint server by caching overrides per rule and problem fixability, preserving the per-problem behavior introduced in #1841.
Changes:
- Include fixability in all severity-cache reads and writes.
- Add regression tests covering fixable-first and non-fixable-first encounter orders.
| File | Description |
|---|---|
server/src/tests/eslint.test.ts |
Tests both encounter orders for fixability-based customizations. |
server/src/eslint.ts |
Includes problem fixability in the severity-override cache key. |
Review effort: Balanced
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.
eslint.rules.customizationsentries withfixableare matched against each problem (problem.fix !== undefined, added in #1841), butRuleSeverities.getOverridecaches the result by rule ID only. The first problem of a rule therefore decides the override for every later problem of that rule, across documents, until settings or watched files change. Some rules report both kinds. Foreqeqeq,typeof a == 'string'gets a fix anda == bdoes not. With{ "rule": "*", "fixable": true, "severity": "off" }, if the fixable problem is seen first, the non-fixablea == berror is hidden as well. In the reverse order, the fixable problem keeps its original severity.This adds the problem's fixability to the cache key and keeps the per-problem behavior from #1841. Open #2175 also changes this cache key, so whichever lands second will need a small rebase.
npm run compile,npm run lint(no errors),npm test(client 27/27, server 10/10).server/src/tests/eslint.test.tsfail on main ('off' !== undefined,undefined !== 'off') and pass with this change.