-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
chore: extract AST check from convert.ts to ast-checks.ts #11748
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
chore: extract AST check from convert.ts to ast-checks.ts #11748
Conversation
|
Thanks for the PR, @Lonercode! 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 29a9c73
☁️ Nx Cloud last updated this comment at |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (25.75%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #11748 +/- ##
==========================================
- Coverage 90.49% 90.48% -0.01%
==========================================
Files 522 523 +1
Lines 53360 53375 +15
Branches 8911 8913 +2
==========================================
+ Hits 48286 48298 +12
- Misses 5059 5062 +3
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Can we run the AST check from https://github.com/Lonercode/typescript-eslint/blob/65803e4127b9557ec6cf4802df12e588370d9930/packages/typescript-estree/src/convert.ts#L509, and have a big switch-case in the new file to check every ts node? |
AST check |
|
No need change check-modifiers.ts. In the new file export a function to check ts node, it calls |
JoshuaKGoldberg
left a comment
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.
What fisker said 🙂
|
@fisker Please let me know if I need to remove every call to the ast check function from convert.ts. |
|
|
|
@JoshuaKGoldberg Are you fine with just one check in this PR? Or should all checks done in this one? If we want to copy variable declaration syntax check, better wait for #11777 and #11778 to merge first. |
|
Looks good to me, thanks! 🙏 Can't approve since I'm not a team member. |
|
Thanks @fisker |
JoshuaKGoldberg
left a comment
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 getting started on this! I think we should discuss the direction a bit.
|
Which part do you insist on changing for landing this PR? I have some other syntax check changes to make, and I'm waiting for this to merge first. Personally, I like the current implementation, the struct will be easy to extract other checks. How about we take another look after all the checks are extracted? I can make the changes as you request after we finish the migration. |
|
Oh, I'm not picky here. I'm happy to just see what you want to get refactored happen first. I'm not sure I'm following though. Are you proposing landing this as-is, or doing some refactors first? |
|
Land as it is, and continue to extract all syntax checks in follow up PR. |
JoshuaKGoldberg
left a comment
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.
Cool! Although this isn't my personal instinct for how I would write things, I think it's a good direction to try out. And I do think there's a nice simplicity in being able to "just" call checkSyntaxError and having checkModifiers + whatever node-specific checks are needed be run. So perhaps my instincts are wrong 😄.
Either way, thanks for bearing with the reviews @Lonercode, I appreciate you pushing forward on this! And also thanks to @fisker for taking on reviewing.
6a05a1a
into
typescript-eslint:main
|
I'll send follow-up PR. |

PR Checklist
Converter#11695Overview
This PR extracts the AST check (checkForStatementDeclaration) from
convert.tsto a fileast-checks.tsas requested in the issue due to the increasing length of code in the file. Therefore, a new fie has been added (ast-checks.ts), one modified (convert.ts) and tests have been run.