-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[eslint-patch] Improve performance and correctness of eslint-bulk-suppressions #5055
base: main
Are you sure you want to change the base?
Conversation
Defer detection of bulk suppressions until after inline suppressions. Simplify patching of eslint to be entirely in-memory.
if (!newSerializedSuppressions.has(serializedSuppression)) { | ||
newSerializedSuppressions.add(serializedSuppression); | ||
newSuppressions.push(suppression); | ||
suppressions.push(suppression); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suppressions.push(suppression); | |
if (!serializedSuppressions.has(suppression)) { | |
suppressions.push(suppression); | |
} |
|
||
const highStack: number[] = []; | ||
|
||
traverser.traverse(sourceCode.ast, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is producing suboptimal results when the desired position is inside of a comment. Additional logic will need to be added to detect which node a comment is associated with.
Summary
Fixes #5054
Fixes #5006
Fixes an issue with incorrect computation of scope ids that were resulting in overly broad suppressions.
Details
linter.js
into memory and only overrideLinter.prototype.verify
, without generating any temporary files.ESLINT_BULK_ESLINTRC_FOLDER_PATH
that, if specified, short-circuits the patch searching for.eslintrc.js
from every single file.@rushstack/heft-eslint-plugin
to setESLINT_BULK_ESLINTRC_FOLDER_PATH
to the parent of its detected ESLint config.eslint-tests
to the ESLint test projects to make them easier to runHow it was tested
Ran in the ESLint test projects.
Linked this version of the patch into a repository that has tons of bulk suppressions and ran it there.
Profiled this version vs. the old, for the projects tested the latency was cut roughly in half, though the AST walk is now most of the cost.
Impacted documentation
Behavior should be the same, other than ensuring that the suppressions from this feature show up in the output of
getSuppressedMessages()
.