Skip to content
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

Crash on react/no-adjacent-inline-elements with one child #2620

Closed
Rogdham opened this issue Apr 10, 2020 · 2 comments · Fixed by #2621
Closed

Crash on react/no-adjacent-inline-elements with one child #2620

Rogdham opened this issue Apr 10, 2020 · 2 comments · Fixed by #2621
Labels

Comments

@Rogdham
Copy link
Contributor

Rogdham commented Apr 10, 2020

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

@ljharb
Copy link
Member

ljharb commented Apr 10, 2020

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

@Rogdham
Copy link
Contributor Author

Rogdham commented Apr 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants