-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
refactor(linter): improve eslint/no-constant-condition
#8845
base: main
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
CodSpeed Performance ReportMerging #8845 will not alter performanceComparing Summary
|
fn run_once(&self, ctx: &LintContext) { | ||
let mut current_scope = Span::default(); | ||
let mut scopes = Vec::<(Span, FxHashSet<Span>)>::new(); | ||
for node in ctx.semantic().nodes() { |
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.
For correctness
rules, we must not loop over the ast nodes again due to performance reasons. You can use a ref cell in the rule config if you really need to store state.
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.
Got it.
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.
We seem to have tried this before, but because the rule is shared across multiple threads, it seems impossible to store it in the rule config.
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.
Wait for #8854
I've re-ported all the test cases for
eslint/no-constant-condition
and ensured they pass successfully. Additionally, I have aligned its options configuration witheslint
.