-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New error with v7.12.4: TypeError: Cannot read property 'type' of null #2137
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
Okay, this is weird. The code failing in question is very simple. Here is a contrived example:
It's failing simply because of the property I wonder if this could actually be some unexpected transpiling issue that is then leading to |
Thanks; the repro code helps a lot. Any idea what file it’s crashing on? |
The file in question where the error is originating from is It's definitely strange that the property name of On another note, I switched from Sorry if I'm misunderstanding what you are asking! |
Sorry, I meant what rule, not what file :-) To reiterate, this code crashes: let items = [];
let testData = [{a: "test1", displayName: "test2"}, {a: "test1", displayName: "test2"}];
for (let item of testData) {
items.push({a: item.a, b: item.displayName});
}
return items; and this code does not: let items = [];
let testData = [{a: "test1", displayName: "test2"}, {a: "test1", displayName: "test2"}];
testData.forEach(item => {
items.push({a: item.a, b: item.displayName});
});
return items; |
Correct. This code also does not crash: let items = [];
let testData = [{a: "test1", anythingelse: "test2"}, {a: "test1", anythingelse: "test2"}];
for (let item of testData) {
items.push({a: item.a, b: item.anythingelse});
}
return items; It looks like this is coming from the rule (this makes so much more sense now): "react/display-name" |
Thanks for putting in a fix for this! |
Can we please publish this fix? This is breaking for me, too. |
I'm seeing a new linting error failing a previously working module build via Webpack after the latest update to this plugin. The error I'm seeing is:
A change was added where a new check to
refId.parent.init.type !== 'Identifier'
is being made, but it appearsrefId.parent.init
must be null in some cases, and there isn't null check protection in place.The commit in question is here:
5fc50aa#diff-bafb3355a409c4ba076a9e3d609ad65b
I can try to cobble together some files to try and reproduce this in some code if needed... I'll just have to put together a specific example to illustrate as I can't provide the existing code.
The text was updated successfully, but these errors were encountered: