-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(typescript-estree): warn on deprecated AST property accesses #6525
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
feat(typescript-estree): warn on deprecated AST property accesses #6525
Conversation
Thanks for the PR, @JoshuaKGoldberg! 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 site settings. |
ed2939a
to
0c7af52
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v6 #6525 +/- ##
==========================================
+ Coverage 87.40% 87.42% +0.01%
==========================================
Files 365 365
Lines 12508 12517 +9
Branches 3694 3696 +2
==========================================
+ Hits 10933 10943 +10
+ Misses 1213 1212 -1
Partials 362 362
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 looking good to me! should be really helpful to help people migrate.
I wonder if we should only log during testing scenarios..? It might spam users otherwise. Hmmm
Right now that's the default: typescript-eslint/packages/typescript-estree/src/parseSettings/createParseSettings.ts Lines 76 to 78 in 0c7af52
|
@JoshuaKGoldberg rebase this on v6 and fix the build and you're good to land! |
@JoshuaKGoldberg This change breaks Prettier, we do an AST transform after parse, which will override some of those properties. I decide not to use the new properties because babel still use those old properties, I was thinking to update print logic after babel adopt those changes. Do you think maybe we can add a setter? CI Log |
Or maybe when |
PR Checklist
Overview
Follows up on #5384 by wrapping the
@deprecated
properties with a getter that, when a newsuppressDeprecatedPropertyWarnings
option isn't enabled,console.warn
s about the properties.suppressDeprecatedPropertyWarnings
defaults toprocess.env.NODE_ENV !== "test"
(false in Jest and similar). Meaning, it'll only log in tests by default.This also has the benefit of making the new property not
enumerable
, which cleans up the AST snapshots and playground representation of the AST to not have the seemingly duplicate properties. 🧹