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
JSX linting fails due to espree minor release including major dependency bump #11018
JSX linting fails due to espree minor release including major dependency bump #11018
Comments
Hi, thanks for the report. Could you provide an example of a source file that fails to parse? JSX parsing in general seems to be working for me using the latest version of |
Based on the discussion in eslint/espree#393, it seems like this might be the result of a bug in npm. |
I am also experiencing this. Getting a lot of crazy parse errors on JSX files that have not changed since the last time CI passed, while plain old JS files seem to be unaffected. One thing to note about my setup is I am using ESLint via XO. Interestingly, I wasn't able to quickly reproduce with a global XO or global ESLint install, only the local one in my project (even after refreshing $ npm ls acorn-jsx
└─┬ xo@0.23.0
└─┬ eslint@5.7.0
└─┬ espree@4.1.0
└── acorn-jsx@5.0.0 The most basic JSX syntax is failing to parse. const broken = () => {
return <p>I should parse correctly</p>;
}; $ xo lib/components/foo.jsx
lib/components/foo.jsx:2:40
✖ 2:40 Parsing error: Unexpected token / |
Took a long time, but I managed to narrow this down to something interesting. The parsing error stops happening if I remove Using the same simple source file I posted earlier and running with Working{
"name": "eslint-bug-repro",
"version": "0.0.1",
"homepage": "https://github.com/sholladay",
"main": "index.js",
"author": {
"name": "Seth Holladay",
"url": "https://seth-holladay.com"
},
"license": "MPL-2.0",
"devDependencies": {
"xo": "^0.23.0"
}
} Broken{
"name": "eslint-bug-repro",
"version": "0.0.1",
"homepage": "https://github.com/sholladay",
"main": "index.js",
"author": {
"name": "Seth Holladay",
"url": "https://seth-holladay.com"
},
"license": "MPL-2.0",
"devDependencies": {
"browser-env": "^3.2.5",
"xo": "^0.23.0"
}
} Since XO has a cache, it's a good idea to run this in between: rm -rf ~/.xo-cache package-lock.json node_modules Definitely feels like some sort of npm issue. |
So this is a bug in npm. npm doesn't seem to install dependencies correctly if a package which has a name before |
Hi, I've two projects A and B, both with same subset and config of react+babel+eslint. Not sure if relevant, but:
I've deleted |
I also got weird lint errors after upgrading eslint to v5.8.0
Deleting |
Confirmed that I got rid of those errors by also removing |
note that linting is currently broken due to an apparent ESLint / npm issue: eslint/eslint#11018
@mysticatea @not-an-aardvark has this been addressed now or are we still waiting for an npm fix? |
Since this happens in eslint 5.8 but not 5.7, perhaps whatever changed to surface the npm bug should be reverted and shipped in a patch release? |
I don't think the revert makes sense. This causes by acorn's breaking change. Currently, the npm's bug appears when there is a older acorn in another dependency. After reverting, it will appear when there is a newer acorn in another dependency. I had emailed with the npm support and they said they will discuss about this bug in npm inc. But my request (please share the current status on https://npm.community/t/failed-to-install-eslint-in-a-specific-situation/2975) was ignored or they have no progress. |
The npm support team told me: "the bug fix requires substantial architectural changes, as a result, it's on our roadmap for 2019 and might be implemented in the summer." Probably, it's the following item in the roadmap:
|
* Fixed jsx parsing error refs eslint/eslint#11018 * Fixed parsing error in eslint@5. * Changed the definition of JOB.
Espree has released a minor version 4.1.0 which bumps acorn-jsx to a new major version (5), which in turn breaks JSX linting (see eslint/espree#393)
Acorn-jsx
needs to be used in a different way as of version 5,acornjs/acorn-jsx@ddcc01d
We are running command
eslint **/*.jsx
in the terminal, errors thrown:error Parsing error: Unexpected token =
ESLint: 5.7.0
Node: any
npm: any
Configuration
The text was updated successfully, but these errors were encountered: