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

Back-pin eslint-plugin-react to avoid linting syntax errors #11

Merged
merged 4 commits into from Oct 1, 2019

Conversation

skye2k2
Copy link
Contributor

@skye2k2 skye2k2 commented Oct 1, 2019

The recent release of eslint-plugin-react#7.15.0 chokes any time it runs into a property with JSX inside it (example code).

Example error from babylon:

TypeError: Cannot read property 'substring' of undefined
Occurred while linting /Users/clif/sandbox/frontier/fs-components/babylon/packages/attribution/src/Attribution.js:45
at Object.fix (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:129:30)
at normalizeFixes (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/report-translator.js:176:28)
at args (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/report-translator.js:278:18)
at Object.report (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/linter.js:721:41)
at reportUnnecessaryCurly (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:117:15)
at lintUnnecessaryCurly (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:198:9)
at JSXExpressionContainer (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:278:11)
at listeners.(anonymous function).forEach.listener (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach ()
at Object.emit (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/safe-emitter.js:45:38)

The recent release of [eslint-plugin-react#7.15.0](https://github.com/yannickcr/eslint-plugin-react/releases/tag/v7.15.0) chokes any time it runs into a property with JSX inside it ([example code](https://github.com/fs-webdev/babylon/blob/master/packages/person/src/Person.js#L391)).

Example error from babylon:

> TypeError: Cannot read property 'substring' of undefined
Occurred while linting /Users/clif/sandbox/frontier/fs-components/babylon/packages/attribution/src/Attribution.js:45
    at Object.fix (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:129:30)
    at normalizeFixes (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/report-translator.js:176:28)
    at args (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/report-translator.js:278:18)
    at Object.report (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/linter.js:721:41)
    at reportUnnecessaryCurly (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:117:15)
    at lintUnnecessaryCurly (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:198:9)
    at JSXExpressionContainer (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js:278:11)
    at listeners.(anonymous function).forEach.listener (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/clif/sandbox/frontier/fs-components/babylon/node_modules/eslint/lib/util/safe-emitter.js:45:38)
@skye2k2 skye2k2 requested a review from joeycozza October 1, 2019 14:39
@skye2k2
Copy link
Contributor Author

skye2k2 commented Oct 1, 2019

This is totally breaking our linting hardcore, this morning (https://travis-ci.com/fs-webdev/babylon/builds/129871120).

@skye2k2 skye2k2 requested a review from redbugz October 1, 2019 14:41
@redbugz
Copy link
Contributor

redbugz commented Oct 1, 2019

Does this appear to be the underlying issue?
jsx-eslint/eslint-plugin-react#2423

@redbugz
Copy link
Contributor

redbugz commented Oct 1, 2019

Need to update the package-lock

@skye2k2
Copy link
Contributor Author

skye2k2 commented Oct 1, 2019

Potentially. We often spread props into our JSX sub-elements.

There's no way I can manage four months' worth of changes on your package lock.

@spacerockzero
Copy link

you don't. you delete it, rebuild, and commit it again typically

@skye2k2
Copy link
Contributor Author

skye2k2 commented Oct 1, 2019

Rephrase: There is no way that I can verify full functionality for the 50 other changes that would consume.

@thorntonjn
Copy link

Thanks for figuring this out. It seems to also be blocking our PR https://github.com/fs-webdev/zion/pull/562

@redbugz redbugz merged commit 52a3127 into master Oct 1, 2019
@redbugz redbugz deleted the eslint-errors branch October 1, 2019 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants