-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[restrict-plus-operands] Allowing any for summands #386
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
Comments
Typescript will run over your JS code and try a little bit to give types to things based on obvious things like JSDoc comments and variable usage. Which means we can get some type information for them. By default, eslint will apply every single configured rule to all files that match your cli command. I.e. if your codebase is mixed, and you have TS-specific rules enabled, eslint will run them over your JS code - it has no concept of JS vs TS. If you don't want your JS files to be linted by this (or any TS specific) rule, you can use eslint's As for skipping any's, happy for it to be added - will accept PRs for it. Personally, I'm not sure how much value there is in that as an option, as |
Shouldn’t |
I would say no, not by the base rule - for the same reason that |
Hello, I would also like to see this option, and it should be added to |
Repro
Enable the rule (see docs)
Either
Observe the following error in each case:
.eslintrc.js
Expected Result
The current result is fine, however too much strictness out of which you cannot opt out may get the rule challenging to use in existing codebases. I just tried enabling it in a monorepo with mixed js and ts code and got hundreds of errors. I understand the value behind this, just find it impossible to start using the rule to catch real issues (variable of known type
number
being added to a variable of known typestring
). Errors in js files are especially unfortunate.Would it be possible to optionally allow
any
in the rule?or even
Or should js files just be always skipped?
Versions
@typescript-eslint/eslint-plugin
1.5.0
@typescript-eslint/parser
1.5.0
TypeScript
3.3.4000
ESLint
5.15.3
node
10.15.2
yarn
1.13.0
/cc @armano2 (author of #70)
The text was updated successfully, but these errors were encountered: