-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [no-deprecated] add rule #9783
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(eslint-plugin): [no-deprecated] add rule #9783
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 configuration. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 5cd8b82. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
2116020
to
fcc6579
Compare
eslint-visitor-keys: ^3.4.1 | ||
checksum: 67c7e6003d5af042d8703d11538fca9d76899f0119130b373402819ae43f0bc90d18656aa7add25a24427ccf1a0efd0804157ba83b0d4e145f06107d7d1b7433 | ||
languageName: node | ||
linkType: hard |
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.
Aside: it is very pleasing to no longer have a dependency on v6 versions of our packages. 🙃
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9783 +/- ##
==========================================
+ Coverage 88.01% 88.04% +0.02%
==========================================
Files 406 407 +1
Lines 13879 13948 +69
Branches 4055 4078 +23
==========================================
+ Hits 12216 12280 +64
- Misses 1354 1355 +1
- Partials 309 313 +4
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.
Looks great to me, just a few questions!
Co-authored-by: Kirk Waiblinger <[email protected]>
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.
Maybe mention deprecation/deprecation
and why we have this rule?
0f4e484
packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-deprecated.shot
Outdated
Show resolved
Hide resolved
symbol: ts.Signature | ts.Symbol | undefined, | ||
): string | undefined { | ||
const tag = symbol | ||
?.getJsDocTags(checker) |
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 forces us to do "jsdoc parsing" by default :(
I kind of wish we could do it without using this -- eg with a regex so we can speed up parsing.
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.
OH, this just reminded me we have JSDocParsingMode
. Adding jsDocParsingMode: 'none'
to the test file's languageOptions.parserOptions
causes all the invalid
tests to fail for not having any parsed JSDocs. Great.
I think we're going to want to do our own regex-based parsing. I'll put the PR back in draft in the meantime.
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.
I think this is one of the few usecases of jsdoc via TS AST in the ecosystem. So yeah if we can remove this then we can consider flipping the default in the next version to speed up parsing in the general case!
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.
Well, I tried using on symbol.valueDeclaration
and symbol.valueDeclaration.parent
in the first invalid
test case:
ts.getJSDocCommentsAndTags
: Nothing retrievedtsutils.forEachComment
: Retrieved the comment, but took ~750ms
deprecation/deprecation
also uses symbol.getJsDocTags
and suffers from the same issue. We don't (yet?) default jsdocParsingMode
to 'none'
or 'type-info'
for lint users. I added a thrown error for those modes in 5cd8b82.
Back-linking to past conversation (cc @jakebailey as FYI): #7997 (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.
Proposal: let's treat "do our own regex-based parsing" as a followup?
Edit: #9857
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.
Yeah for sure - file an issue.
Wasnt sposed to be a blocking comment. More of a "hey if we can that'd be good" thing
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.
Perhaps it's worth adding @deprecated
to the list of tags that we parse out unconditionally in the API? Would that be simpler?
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.
That could work yeah! Do you know what the performance impact would be?
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.
I'd have to test and see. Unfortunate though as my enum names were too clever, @deprecated
is not used for checking :(
57e4120
into
typescript-eslint:main
The rule was renamed to |
Alas, changing the commit history & linked changelogs would be hard 😞 sorry about that. I edited the PR title just to help folks find it. |
PR Checklist
Overview
Reimplements logic from scratch - both for licensing reasons and because I wanted to see how the structure would differ from previous implementations. After doing it myself, then looking back at the others, I think it ended up closest to eslint-plugin-deprecation by coincidence.
💖