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): [prefer-readonly-parameter-types] add ignoreInferredTypes
option
#2668
feat(eslint-plugin): [prefer-readonly-parameter-types] add ignoreInferredTypes
option
#2668
Conversation
…Types option Allows `prefer-readonly-parameter-types` users to specify an `ignoreInferredTypes` option, which if true will ignroe errors on parameters with no explicit type parameter. This may be useful for cases where an external dependency specifies mutable parameter types, e.g. for parameters in callbacks.
Thanks for the PR, @eyelidlessness! 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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Dang, I knew it was risky for me to make that second commit without rerunning lint etc locally. Fixes incoming! |
Codecov Report
@@ Coverage Diff @@
## master #2668 +/- ##
=======================================
Coverage 92.83% 92.83%
=======================================
Files 294 294
Lines 9666 9669 +3
Branches 2711 2712 +1
=======================================
+ Hits 8973 8976 +3
Misses 327 327
Partials 366 366
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Okay, so I was looking at the code coverage report to try to see why it was such a significant reduction, and... discovered that not only had I implemented this incorrectly... I also had gotten false positives in the tests because apparently |
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.
nice and simple - thanks for this option, should save people a lot of pain.
ignoreInferredTypes
option
This PR addresses part of #2079. I'm not sure whether I should mark this as
fixes
, since there's discussion of other wants. So I'll leave that determination up to the reporter and maintainers).This introduces an
ignoreInferredTypes
option forprefer-readonly-parameter-types
, which iftrue
ignores errors on parameters with no explicit type parameter. This may be useful for cases where an external dependency specifies mutable parameter types, e.g. for parameters in callbacks.