question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSX linting fails due to espree minor release including major dependency bump

See original GitHub issue

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'
			}
		}
	]
};

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:25 (16 by maintainers)

github_iconTop GitHub Comments

6reactions
mysticateacommented, Nov 14, 2018

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.

4reactions
ferosscommented, Aug 15, 2019

This is the simplest workaround I’ve found:

rm -rf node_modules && npm install --legacy-bundling

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint - npm
However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump...
Read more >
My create-react-app is failing to compile due to ESLint error
It seems that the react-scripts was causing the lint errors for me. ... This will create a patches folder, with the dependency patch...
Read more >
eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >
npm Peer Dependencies - Fathom
When an application includes your module, that application will in turn need to include the declared dependency. With npm version 4 through to...
Read more >
ESLint: Find and fix problems in your JavaScript code - Morioh
A bug fix in a rule that results in ESLint reporting fewer linting errors. ... it's not always clear when a minor or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found