-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
docs: blog post on Avoiding any
s with Linting and TypeScript
#10362
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
docs: blog post on Avoiding any
s with Linting and TypeScript
#10362
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. |
View your CI Pipeline Execution ↗ for commit 6ed0cb0.
☁️ Nx Cloud last updated this comment at |
</TabItem> | ||
</Tabs> | ||
|
||
One the types for `@example/package` are fixed to no longer produce a type error, the comment directive will itself produce a type error asking to delete itself. |
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 don't think this blog post should explain how // @ts-expect-error
/ // @ts-ignore
work. I think that'd be better served in a separate post on a TypeScript-dedicated page.
I haven't found one online I truly like so I might just put it on learningtypescript.com... the ideal state would be to have a dedicated page on the first-party typescriptlang.org docs IMO.
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.
It's blocked on eslint/eslint.org#664, and I don't think it's horrible if we don't include a link to it in the blog post. 🤷
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10362 +/- ##
==========================================
+ Coverage 87.00% 87.15% +0.15%
==========================================
Files 447 448 +1
Lines 15586 15578 -8
Branches 4542 4551 +9
==========================================
+ Hits 13560 13577 +17
+ Misses 1671 1645 -26
- Partials 355 356 +1
Flags with carried forward coverage won't be shown. Click here to find out more. |
Co-authored-by: YeonJuan <yeonjuan93@naver.com>
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 amazing 💯
`// @ts-expect-error` and `// @ts-ignore` are almost the same, except `// @ts-expect-error` will produce a new type error if its line doesn't already have one. | ||
It's generally preferable to use `// @ts-expect-error` over `// @ts-ignore`. |
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'm not sure if it's too niche to mention, but the error type (which can be created using the ignore directives) also counts as an any
.
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.
Ha, yeah, I think I'll skip that morass of confusing API nuances...
Co-authored-by: Ronen Amiel <ronen.amiel@gmail.com>
Co-authored-by: Ronen Amiel <ronen.amiel@gmail.com>
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.
The first time I enabled the no-unsafe-*
rules, I was shocked at how many any
s I had in my code base without even realizing it.
Explaining this better is so important 💯
any
s
FYI in e62fb94 I also reworked the opening paragraphs a bit. IMO they were too long before. |
Co-authored-by: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com>
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.
Co-authored-by: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com>
👍 I set the date for this to be tomorrow, the 21st, since today is a holiday in the US. I can manually deploy in the morning. |
55bed75
into
typescript-eslint:main
PR Checklist
Overview
Walks through how
any
s can sneak in even withnoImplicitAny
, then our suite of rules, as well as some other useful helpers.I'm having a bit of writer's block trying to write friendly prose here. If anybody can suggest how to make the writing more approachable, I'd appreciate it.
💖