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
[Fix] no-array-index-key
: catch toString and String() usage
#2813
Conversation
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.
This looks good, but it seems like any reference to the index should be warned on, not just .toString
or String()
. Can we have it do that?
This seems a bit tricky to write if I'm trying to explicitly hard code cases to look for. Is there an existing util in the codebase to do this, or something in ESLint? Do we take some sort of recursive algo approach in checking all the nodes arguments and callee's? |
I don't have a specific suggestion. I'd say that any identifier inside a jsx attribute that matches the index should be flagged? |
cb92bd2
to
492b5f1
Compare
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.
Let's go ahead and land this, and hopefully there will be further improvements in the future.
Codecov Report
@@ Coverage Diff @@
## master #2813 +/- ##
==========================================
+ Coverage 97.64% 97.67% +0.02%
==========================================
Files 121 121
Lines 8440 8459 +19
Branches 3033 3048 +15
==========================================
+ Hits 8241 8262 +21
+ Misses 199 197 -2
Continue to review full report at Codecov.
|
Sorry forgot about this. If we open another issue I can take a look again once I have some time. But happy to let others take it if they want to |
Closes #2140