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
no-magic-numbers false negatives on invalid array indexes #12845
Comments
I think it makes sense to warn on the first two (and assume this is a computed property name on |
Forgot to mention that I'm not seeing the BigInt example in our demo. |
I didn't include a demo link because of that, but forgot to mention why. Online demo is still
Agreed, wasn't really sure about that. I'll fix the option to have the following behavior: treat all non-negative integer numbers and non-negative bigints as array indexes (assuming that unary minus before the literal is a part of the number/bigint). |
Ah, right, that makes sense!
Sounds good to me. |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
When
ignoreArrayIndexes
is set tofalse
this code has 3 errors, so I would expect the same when this option is set totrue
.2.5
and-3
are not array indexes.Less sure about the bigint since it will indeed get the element at index 10. Still, a bigint there looks more like member access than array index.
What actually happened? Please include the actual, raw output from ESLint.
no errors.
Are you willing to submit a pull request to fix this bug?
Yes.
The text was updated successfully, but these errors were encountered: