eslint: JSX linting fails due to espree minor release including major dependency bump
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 https://github.com/eslint/espree/issues/393)
Acorn-jsx
needs to be used in a different way as of version 5,
https://github.com/RReverser/acorn-jsx/commit/ddcc01d707b2eb5f9ae4de36ba32e2276a18ba3c
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
module.exports = {
env: {
node: true,
browser: true,
es6: true
},
plugins: [
'jsx-a11y'
],
extends: [
'eslint:recommended',
// https://github.com/jest-community/eslint-plugin-jest
'plugin:jest/recommended',
// https://github.com/yannickcr/eslint-plugin-react
'plugin:react/recommended',
// https://github.com/evcohen/eslint-plugin-jsx-a11y
'plugin:jsx-a11y/recommended'
],
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
// Support for ESM is not tied to an ES version
sourceType: 'module'
},
settings: {
react: {
version: '16.3'
}
},
rules: {
// We don't expect consumers of x-dash to use prop types
'react/prop-types': 'off',
// We don't use display names for SFCs
'react/display-name': 'off',
// This rule is intended to catch < or > but it's too eager
'react/no-unescaped-entities': 'off'
},
overrides: [
{
// Components in x-dash interact with x-engine rather than React
files: [ 'components/**/*.jsx' ],
settings: {
react: {
pragma: 'h',
createClass: 'Component'
}
},
rules: {
'react/prefer-stateless-function': 'error'
}
}
]
};
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 25 (16 by maintainers)
Commits related to this issue
- added CHANGELOG, documented release process note that linting is currently broken due to an apparent ESLint / npm issue: https://github.com/eslint/eslint/issues/11018 — committed to faucet-pipeline/faucet-pipeline-js by FND 6 years ago
- Recent eslint versions have a bug: https://github.com/eslint/eslint/issues/11018 — committed to change/javascript by quaelin 6 years ago
- Add acorn dependency to fix npm warning It seems there is a problem with npm installing 'peer dependencies' npm's warning says that we need to install this dependency ourselves. The bug is tracked he... — committed to alphagov/govuk-prototype-kit by joelanman 5 years ago
- Start tracking upstream prototype kit, and upgrade to kit v8.6 (#28) * Add missing value (data) attribute Currently, if a user enters an answer on examples/pass-data/vehicle-registration and then ... — committed to DFE-Digital/publish-teacher-training-prototype by fofr 5 years ago
- Upgrade prototype kit and govuk-frontend (#35) * Update run-sequence from 1.2.2 to 2.2.1 Tested by ensuring that the gulp tasks in gulp/tasks.js that use run-sequence still run without error. *... — committed to DFE-Digital/publish-teacher-training-prototype by fofr 5 years ago
- AppVeyor: use yarn instead of npm Works around https://github.com/eslint/eslint/issues/11018 (which seems to be a bug in NPM) — committed to electron/packager by malept 5 years ago
- Merge pull request #963 from electron-userland/dependabot/npm_and_yarn/eslint-plugin-ava-tw-6.0.0 * Update eslint-plugin-ava requirement from ^5.1.1 to ^6.0.0 * AppVeyor: use yarn instead of npm ... — committed to electron/packager by malept 5 years ago
- Regenerate package-lock due to NPM bug :( The ESLint upgrade runs afoul of a bad NPM bug with dependency resolution, which is in turn triggered by some interesting linking behavior by Acorn and its p... — committed to edgi-govdata-archiving/web-monitoring-ui by Mr0grog 5 years ago
- Regenerate package-lock due to NPM bug :( The ESLint upgrade runs afoul of a bad NPM bug with dependency resolution, which is in turn triggered by some interesting linking behavior by Acorn and its p... — committed to edgi-govdata-archiving/web-monitoring-ui by Mr0grog 5 years ago
- Regenerate package-lock due to NPM bug :( The ESLint upgrade runs afoul of a bad NPM bug with dependency resolution, which is in turn triggered by some interesting linking behavior by Acorn and its p... — committed to edgi-govdata-archiving/web-monitoring-ui by Mr0grog 5 years ago
- Workaround npm bug https://twitter.com/feross/status/1161900081492234240 https://github.com/eslint/espree/issues/393 https://github.com/eslint/eslint/issues/11018 https://npm.community/t/failed-to-in... — committed to feross/play.cash by feross 5 years ago
- [Tests] work around npm bug https://github.com/feross/play.cash/commit/a50d97fbde30b2ecad80f79d801701bde058c94c https://twitter.com/feross/status/1161900081492234240 eslint/espree#393 eslint/eslint#1... — committed to react-dates/react-dates by ljharb 5 years ago
- Fixed jsx parsing error refs https://github.com/eslint/eslint/issues/11018 — committed to vuejs/eslint-plugin-vue by ota-meshi 5 years ago
- Fixed jsx parsing error (#961) * Fixed jsx parsing error refs https://github.com/eslint/eslint/issues/11018 * Fixed parsing error in eslint@5. * Changed the definition of JOB. — committed to vuejs/eslint-plugin-vue by ota-meshi 5 years ago
- Fix: misuse token types (fixes #393, refs eslint/eslint#11018) — committed to eslint/espree by mysticatea 5 years ago
- Fix: problematic installation issue (fixes #11018) — committed to eslint/eslint by mysticatea 5 years ago
- Fix: misuse token types (fixes #393, refs eslint/eslint#11018) (#426) — committed to eslint/espree by mysticatea 5 years ago
- Fix: problematic installation issue (fixes #11018) (#12309) * Fix: problematic installation issue (fixes #11018) * update espree — committed to eslint/eslint by mysticatea 5 years ago
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.
This is the simplest workaround I’ve found:
It forces npm to install packages like it did in npm@2, with no attempt to flatten the tree (which is where the bug is happening).
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?
Since this issue seems to have been made worse by this past weekend’s release:
I don’t think we’re doing anything out of the ordinary here regarding Espree and its dependencies, and I’m curious if other projects are running into this issue at all.
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:
lol this is a bug, not a change request - please reopen it.
Agreed. I think this is helpful to leave open for now so that others experiencing this issue can track the progress of this.