Skip to content

feat!: move AST traversal into SourceCode#18167

Merged
mdjermanovic merged 11 commits intomainfrom
traverse
Mar 21, 2024
Merged

feat!: move AST traversal into SourceCode#18167
mdjermanovic merged 11 commits intomainfrom
traverse

Conversation

@nzakas
Copy link
Copy Markdown
Member

@nzakas nzakas commented Mar 4, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

  • Moved AST traversal out of Linter and into SourceCode#traverse().
  • Updated no-useless-returns, constructor-super, and no-this-before-super to they still work. These rules were also tested against v8.57.0 to ensure that such changes would be backwards compatible.
  • Updated the v9 migration guide

Refs #16999

Is there anything you'd like reviewers to focus on?

I deviated from the RFC in how I represented the traversal steps. I realized while implementing that relying on type and phase as string comparisons would be a big performance hit, so I added the kind property as a number (keeping type for easier debugging, though not sure if that's needed) and switched phase to a number. That saves us a lot of string comparisons during traversal.

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint rule Relates to ESLint's core rules

Projects

Archived in project
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants