Cannot read property 'ecmaFeatures' of undefined
See original GitHub issueGetting
Parsing error: Cannot read property 'ecmaFeatures' of undefined
Tell us about your environment
- ESLint Version: 5.1.0
- Node Version: 10.6.0
- **npm Version:**6.1.0"
my eslintrc
env:
node: true
es6: true
jquery: false
browser: false
extends:
- eslint:recommended
rules:
curly: off
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:16 (12 by maintainers)
Top Results From Across the Web
Error while running ESlint: Cannot read property file
I have the following error in the line of "import React" in each file. import React, { Component } from 'react'. The error...
Read more >parsing error: cannot read properties of undefined ... - You.com
I'm getting error Parsing error: Cannot read properties of undefined (reading 'map') on this line in my module file: import { StoreLocation, Location...
Read more >eslint/eslint - Gitter
It is look like the issue in the npm script, but I can't understand where is it. ... This error "Cannot read property...
Read more >@justeat/gulp-build-fozzie - npm
... Parsing error: Cannot read property 'ecmaFeatures' of undefined . ... Each of these tasks copies the specified set of assets from the ......
Read more >Supressing ESLint LS errors - Language Server Protocol (LSP)
ESLint : Cannot read properties of undefined (reading 'loc') Occurred while linting /home/non/test/index.ts. Please see the 'ESLint' output ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The root cause of this issue is that two different versions of
espree
are being loaded simultaneously with the same version ofacorn
.espree
works by adding a plugin to theacorn
parser, andacorn
’s plugin API seems to require setting global state on theacorn
object. As a result,espree@4
is setting some state by adding listeners to acorn, and thenespree@3
is getting loaded and is overriding the state that was set byespree@4
. This is causingespree@3
’s listeners to unexpectedly get called even though the running version of ESLint is usingespree@4
, which is causingespree@3
to throw an error.To me, it seems like the best way to fix this would be for
acorn
to allow registering a plugin without modifying global state on theacorn
package. Another possibility would be forespree
to includeacorn
as a bundled dependency to ensure that it never shares its version ofacorn
with any other packages.@not-an-aardvark This bug comes when eslint@5 and eslint@4 are used in project. It’s not specific at
standard
(https://github.com/xojs/xo/issues/336 and https://github.com/javascript-obfuscator/webpack-obfuscator/issues/35).A test case with only ESLint:
To test, decompress testcase.tar.gz. Execute
npm install
and./testcase.js
. This JSON is displayed in console:If you comment line 4 of testcase.js (
require("other");
), the output is: