Eslint-plugin-react: Crash on react/no-adjacent-inline-elements with one child

Created on 10 Apr 2020  路  2Comments  路  Source: yannickcr/eslint-plugin-react

With the react/no-adjacent-inline-elements rule enabled, ESLint crashes on the following: React.createElement("div", null, "Hello").


Stacktrace

TypeError: Cannot read property 'length' of undefined
Occurred while linting /path/to/here/case.js:4
    at validate (/path/to/here/node_modules/eslint-plugin-react/lib/rules/no-adjacent-inline-elements.js:87:36)
    at CallExpression (/path/to/here/node_modules/eslint-plugin-react/lib/rules/no-adjacent-inline-elements.js:111:9)
    at /path/to/here/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/path/to/here/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/path/to/here/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/path/to/here/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/path/to/here/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/path/to/here/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)
    at /path/to/here/node_modules/eslint/lib/linter/linter.js:936:32

Small gist to reproduce the issue

bug

All 2 comments

Thanks! Would you like to make a PR with a failing test case (and maybe also a fix)?

@ljharb I am not familliar with the codebase, but I still tried with #2621

Was this page helpful?
0 / 5 - 0 ratings