eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

Fix failures of jsx-max-depth on empty nodes

Open j-martyn opened this issue 6 years ago • 5 comments

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 avatar Mar 12 '18 15:03 j-martyn

@j-martyn @ljharb Any ETA ? I see this crash too.

FYI, it happens on files with jsx-control-statements.

ferhatelmas avatar Jun 04 '18 16:06 ferhatelmas

@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.

ljharb avatar Jun 04 '18 19:06 ljharb

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)

ljharb avatar Dec 27 '18 21:12 ljharb

I'll see if I can reproduce this 👍

alexzherdev avatar Dec 28 '18 02:12 alexzherdev

ping @alexzherdev, any progress?

ljharb avatar May 09 '20 22:05 ljharb