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

`no-useless-fragment` fixer crash #2680

Closed
SimenB opened this issue Jun 29, 2020 · 2 comments
Closed

`no-useless-fragment` fixer crash #2680

SimenB opened this issue Jun 29, 2020 · 2 comments

Comments

@SimenB
Copy link
Contributor

@SimenB SimenB commented Jun 29, 2020

Code:

// comp.js
import React from 'react';

const Comp = () => (
  <html>
    <React.Fragment />
  </html>
);

Error:

TypeError: Cannot read property 'range' of null
Occurred while linting /Users/simen/repos/monorepo/comp.js:5
    at Object.fix (/Users/simen/repos/monorepo/node_modules/eslint-plugin-react/lib/rules/jsx-no-useless-fragment.js:175:94)
    at normalizeFixes (/Users/simen/repos/monorepo/node_modules/eslint/lib/linter/report-translator.js:178:28)
    at /Users/simen/repos/monorepo/node_modules/eslint/lib/linter/report-translator.js:343:49
    at Object.report (/Users/simen/repos/monorepo/node_modules/eslint/lib/linter/linter.js:905:41)
    at checkNode (/Users/simen/repos/monorepo/node_modules/eslint-plugin-react/lib/rules/jsx-no-useless-fragment.js:187:17)
    at JSXElement (/Users/simen/repos/monorepo/node_modules/eslint-plugin-react/lib/rules/jsx-no-useless-fragment.js:206:11)
    at /Users/simen/repos/monorepo/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/simen/repos/monorepo/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/simen/repos/monorepo/node_modules/eslint/lib/linter/node-event-generator.js:254:26)

This is using v7.20.1

@ljharb ljharb closed this in d2a131a Jun 29, 2020
@ljharb
Copy link
Collaborator

@ljharb ljharb commented Jun 29, 2020

Thanks for the repro; I'll have the fix released later today.

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Jun 29, 2020

v7.20.2 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.