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
Cannot read property 'type' of null error in no-array-index-key.js #1242
Comments
So, setting aside "errors while you're typing", which isn't something that needs supporting, it looks like |
Exactly. It looks like the variable which holds the value is null, which throws the TypeError. |
Confirmed by adding a test case: 1) no-array-index-key invalid foo.map((bar, i) => <Foo key />):
TypeError: Cannot read property 'type' of null But... should it be valid, or invalid? According to this specific rule I guess it should be valid, since it's not assigning the index to the key... but then again, just having |
In that case, it's setting the |
Version 7.0.1
The full stack trace can be found below.
The issue occurs when I begin to add the key to this code:
If I begin to enter the
key
attribute:An error in the console is triggered, although I wasn't finished writing the new line.
The issue appears to be on this line, and I suspect it could be corrected altering the line to be
if (!value || value.type !== 'JSXExpressionContainer') {
, but I'm not sure about the implication of making that change.The text was updated successfully, but these errors were encountered: