-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [no-unsafe-argument] add rule #3256
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
Conversation
Fixes #791 This adds a new rule which just checks the passing of arguments. This case is a lot more complex than most cases due to spread arguments.
Thanks for the PR, @bradzacher! 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. |
Codecov Report
@@ Coverage Diff @@
## master #3256 +/- ##
==========================================
- Coverage 92.91% 92.84% -0.08%
==========================================
Files 316 317 +1
Lines 10854 10923 +69
Branches 3069 3086 +17
==========================================
+ Hits 10085 10141 +56
- Misses 342 348 +6
- Partials 427 434 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@bradzacher do you think this could be another one worth extending in i.e
I know I can satisfy this by casting to In saying that, I am casting for properties due to
Curious on if you have any opinions on if this is something extending :) |
this rule checks arguments using out typescript-eslint/packages/eslint-plugin/src/util/types.ts Lines 418 to 471 in cb22561
Which will allow assignments of |
But it looks like there is a bug in the rule. The jest function is typed as: declare function toHaveBeenCalledWith<E extends any[]>(...params: E): void; So at typecheck type, when called with |
which (if I remember and understand everything correctly) they're not - they're typed to receive So:
Gets
(that could be what you mean by |
shouldn't the new rule be added to the |
It will, but changes to the recommended sets is a breaking change. |
Fixes #791
This adds a new rule which just checks the passing of arguments.
This case is a lot more complex than most cases due to spread arguments.