-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(visitor-keys): fix visitor keys order #11279
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
fix(visitor-keys): fix visitor keys order #11279
Conversation
Thanks for the PR, @overlookmotel! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
View your CI Pipeline Execution ↗ for commit b5f8186.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11279 +/- ##
=======================================
Coverage 90.91% 90.91%
=======================================
Files 501 501
Lines 50869 50869
Branches 8382 8382
=======================================
Hits 46248 46248
Misses 4606 4606
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Thanks for sending this!
RE the test coverage - I think let's get this merged and I'd invite you to file a followup issue for the test coverage question.
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.
|
PR Checklist
Overview
As discussed in #11276, visitor keys are not in source code order for 5 types:
TSImportType
TSIndexedAccessType
TSMethodSignature
TSPropertySignature
TSTypePredicate
This PR fixes that by altering the order of keys in
AdditionalKeys
.The changes to test snapshots are incidental details.
It appears that visitation happening in source code order is not covered by tests, but no lint rules are impacted by this change. If required, I would be happy to add tests, if someone can point me to where to put them.
FYI: Oxc's JS-side AST for TS files now aligns exactly with TS-ESLint parser's. The discrepancies in visitation order addressed in this PR were discovered during the work on alignment to get there. Our conformance testing ensures that visitor keys (after the changes in this PR) result in visitation in source code order for all AST types, for all Test262 and TypeScript test cases.
Except...
ExportSpecifier
wherelocal
andexported
are visited in wrong order. However, TS-ESLint inherits that problem fromeslint-visitor-keys
. eslint/js#655 hopes to address that one upstream.Anyway, my point is: I imagine it'd be preferable for TS-ESLint to have your own test coverage for visitation order. However, if you choose to believe me, I can tell you that the types changed in this PR +
ExportSpecifier
are the only places where there is a problem.