eslint-plugin-react
eslint-plugin-react copied to clipboard
Fix failures of jsx-max-depth on empty nodes
On some my code (didn't check what code exactly) I got this:
Cannot read property 'type' of null
TypeError: Cannot read property 'type' of null
at find (/path/to/package/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:93:27)
at findJSXElement (/path/to/package/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:102:49)
at JSXExpressionContainer (/path/to/package/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:137:25)
So, for now, I just have fixed it. No tests have been changed as I didn't investigate it.
@j-martyn @ljharb Any ETA ? I see this crash too.
FYI, it happens on files with jsx-control-statements.
@ferhatelmas if you could provide a failing test case (on a branch in your fork), and link it here, i'll add it to the PR and we can get this in.
cc @alexzherdev if you're interested in taking a look at this one, i'm happy to add any commits you like to this PR branch :-) (cc #1824)
I'll see if I can reproduce this 👍
ping @alexzherdev, any progress?