Using version ^8.0.1 and started getting this error on every run of eslint after updating node_modules.
0:0 error Parsing error: Cannot set property '0' of undefined
Seems similar to https://github.com/babel/babel-eslint/issues/155
+1, thought these were exterminated a while back..
Same here, also getting this error :(
+1
+1.
$ node_modules/eslint/bin/eslint.js --debug ./index.js
eslint:cli Running on files +0ms
eslint:glob-util Creating list of files to process. +0ms
eslint:ignored-paths Looking for ignore file in /Users/me/work/project +0ms
eslint:ignored-paths Could not find ignore file in cwd +0ms
eslint:cli-engine Processing /Users/me/work/project/index.js +0ms
eslint:cli-engine Linting /Users/me/work/project/index.js +0ms
eslint:config Constructing config file hierarchy for /Users/me/work/project +0ms
eslint:config Using .eslintrc and package.json files +0ms
eslint:config Loading /Users/me/work/project/.eslintrc.json +0ms
eslint:config-file Loading JSON config file: /Users/me/work/project/.eslintrc.json +0ms
eslint:config-file Loading airbnb +103ms
eslint:config-file Attempting to resolve eslint-config-airbnb +0ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb/index.js +1ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb/rules/react-a11y.js +2ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb/rules/react-a11y.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb/rules/react.js +176ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb/rules/react.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/strict.js +31ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/strict.js +1ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/index.js +1ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/index.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/imports.js +2ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/imports.js +1ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/es6.js +85ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/es6.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/variables.js +12ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/variables.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/style.js +6ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/style.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/node.js +84ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/node.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/errors.js +2ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/errors.js +0ms
eslint:config-file Loading /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/best-practices.js +5ms
eslint:config-file Loading JS config file: /Users/me/work/project/node_modules/eslint-config-airbnb-base/rules/best-practices.js +0ms
eslint:config Using /Users/me/work/project/.eslintrc.json +528ms
eslint:config-ops Using config from partial cache +0ms
eslint:config-ops Apply environment settings to config +1ms
eslint:config-ops Creating config for environment node +0ms
eslint:config-ops Creating config for environment es6 +0ms
eslint:linter Linting code for /Users/me/work/project/index.js (pass 1) +0ms
eslint:linter Generating fixed text for /Users/me/work/project/index.js (pass 1) +128ms
eslint:text-fixer Applying fixes +0ms
eslint:text-fixer shouldFix parameter was false, not attempting fixes +0ms
eslint:cli-engine Linting complete in: 664ms +661ms
/Users/me/work/project/index.js
0:0 error Parsing error: Cannot set property '0' of undefined
โ 1 problem (1 error, 0 warnings)
$ cat .eslintrc.json
{
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
"react/jsx-filename-extension": [
1,
{
"extensions": [
".js",
".jsx"
]
}
],
"react/prefer-stateless-function": 0,
"react/prop-types": 0
}
}
$ cat package.json
{
"name": "project",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"eslint": "^4.18.2",
"react": "^16.3.0-alpha.1",
"react-native": "0.54.0-rc.3",
"react-native-i18n": "^2.0.12",
"react-native-safe-area-view": "^0.7.0",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^1.2.1",
"react-navigation-redux-helpers": "^1.0.1",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-persist": "^4.8.3",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"babel-jest": "22.4.1",
"babel-preset-react-native": "4.0.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"jest": "22.4.2",
"react-test-renderer": "^16.3.0-alpha.1"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./App/assets/font/"
]
}
}
I don't get this error when I use the globally-installed eslint. I don't understand why one works, other doesn't. My globally-installed packages: http://fuzzymunchkin.com/tmp/globalpackages.txt
... and not sure if related:
$ yarn install
yarn install v1.5.1
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
warning Pattern ["[email protected]"] is trying to unpack in the same destination "/Users/Tim/Library/Caches/Yarn/v1/npm-babylon7-7.0.0-beta.40-91fc8cd56d5eb98b28e6fde41045f2957779940a" as pattern ["babylon@^7.0.0-beta.40"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["babylon7@npm:babylon@^7.0.0-beta"] is trying to unpack in the same destination "/Users/Tim/Library/Caches/Yarn/v1/npm-babylon7-7.0.0-beta.40-91fc8cd56d5eb98b28e6fde41045f2957779940a" as pattern ["babylon@^7.0.0-beta.40"]. This could result in non-deterministic behavior, skipping.
[3/4] ๐ Linking dependencies...
warning "react-native > metro > @babel/[email protected]" has incorrect peer dependency "@babel/[email protected]".
[4/4] ๐ Building fresh packages...
success Saved lockfile.
โจ Done in 2.68s.
Update: If i remove babel-eslint from my .estlintrc.json, the errors go away (but I get all the annoying warnings about ES7 features that I was using it to avoid in the first place)
Having the same problem, as suggested by @xaphod if I remove "parser": "babel-eslint" from .eslintrc no more errors
I'm using ES7 feature as well so this is a blocker for me.
managed to fix the issue, by starting to use the following in .eslint
{
"parser": "babel-eslint",
"extends": [ "airbnb", "plugin:react/recommended", "prettier", "prettier/react", "prettier/standard" ],
"plugins": [ "react", "import", "promise", "compat", "prettier" ],
...
}
I'm now scared of touching it :P
@xaphod are you able to take a look yourself and validate?
Apologies, i'm in a totally different universe now :(
Thank you for the issue. Now that @babel/eslint-parser has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.
Most helpful comment
... and not sure if related:
Update: If i remove babel-eslint from my .estlintrc.json, the errors go away (but I get all the annoying warnings about ES7 features that I was using it to avoid in the first place)