Closed damianobarbati closed 4 years ago
I don't know where this bug is... here is the eslint ref https://github.com/eslint/eslint/issues/8720
wow I didn't see that: did you just open the same issue some hours before I did? xD Maybe something due to latest updates?
I opened it last night, but they (eslint) suggested the bug may be here. So I came here to report... but found yours :)
This is serious.
In order to compile I'm now with "no-undef": "off"
: I just lost the whole morning (~3hours) to track down a simple not defined variable which eslint would spot in milliseconds.
Sorry this is causing issues. I'm not familiar with the codebase much. Could someone dive in a bit and provide a suggested solution/pull request?
Is think broken in eslint 3.19 as well or just 4.0?
@soda0289 hell yeah, fixed in 4.0! Thanks so much ( @jsg2021 )
i don't see any changes in this or eslint... how is it fixed?
@soda0289 this wasn't a problem in eslint 3.x.x
If this problem started with eslint v4 it probably has something to do with the new scope analysis fork eslint uses. It was changed from escope to eslint-scope.
I think the problem is that babel-eslint is failing to find and monkey patch eslint-scope. It might be finding escope from some other installation of eslint. How are you running eslint?
Rules in package.json
"eslintConfig": {
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module",
"impliedStrict": true,
"ecmaFeatures": {
"jsx": true,
"impliedStrict": true,
"globalReturn": false,
"experimentalObjectRestSpread": true
}
},
"env": {
"browser": true,
"node": true,
"jest": true,
"es6": true
},
"plugins": [
"import",
"react",
"jest"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jest/recommended"
],
"rules": {
"no-console": "off",
"no-unused-vars": "off",
"no-unsafe-finally": "off",
"no-unreachable": "off",
"react/no-unescaped-entities": "off",
"react/prop-types": "off"
}
},
"stylelint": {
"extends": [
"stylelint-config-standard",
"stylelint-config-sass-guidelines"
],
"rules": {
"indentation": 4,
"no-missing-end-of-source-newline": null,
"selector-list-comma-newline-after": null,
"max-nesting-depth": null,
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": [
"global",
"local"
]
}
]
}
},
"babel": {
"presets": [
[
"env",
{
"targets": {
"browsers": [
"chrome 54",
"safari 9",
"firefox 50",
"edge 12",
"explorer 11"
]
},
"modules": false,
"useBuiltIns": true,
"debug": true
}
],
"stage-0",
"react"
],
"plugins": [
"transform-decorators-legacy",
"transform-class-properties",
[
"react-css-modules",
{
"filetypes": {
".scss": "postcss-scss"
}
}
]
]
},
"jest": {
"bail": true
},
"dependencies": {
"array-to-csv": "^1.0.1",
"axios": "^0.16.2",
"better-console": "^1.0.0",
"child-process-promise": "^2.2.1",
"compare-versions": "^3.0.1",
"cssnano-preset-default": "^4.0.0-rc.0",
"csv-parse": "^1.2.0",
"csvjson": "^4.3.3",
"docdash": "^0.4.0",
"esdoc": "^0.5.2",
"fs-promise": "^2.0.2",
"jest": "^20.0.4",
"jsdoc": "^3.4.3",
"jsdoc-strip-async-await": "^0.1.0",
"jws": "^3.1.4",
"koa": "^2.2.0",
"koa-basic-auth": "^2.0.0",
"koa-better-ratelimit": "^2.1.2",
"koa-body": "^2.1.0",
"koa-compress": "^2.0.0",
"koa-cors": "0.0.16",
"koa-json": "^2.0.2",
"koa-mount": "^3.0.0",
"koa-passport": "^3.0.0",
"koa-remove-trailing-slashes": "1.0.0",
"koa-router": "^7.2.0",
"koa-send": "^4.1.0",
"koa-sslify": "^2.1.2",
"koa-useragent": "^1.0.0",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"mz": "^2.6.0",
"node-schedule": "^1.1.1",
"node-xlsx": "^0.7.4",
"nodemailer": "^4.0.1",
"passport": "^0.3.2",
"passport-facebook": "^2.1.1",
"passport-google-oauth": "^1.0.0",
"pm2": "^2.4.4",
"sequelize": "^4.1.0",
"slack-node": "^0.1.8",
"sleep-promise": "^2.0.0",
"sqlite3": "^3.1.8",
"stripe": "^4.22.0",
"tsv": "^0.2.0",
"xlsx-populate": "^1.6.0",
"yargs": "^8.0.1"
},
"devDependencies": {
"autobind-decorator": "^1.3.4",
"autoprefixer": "^7.1.1",
"babel-core": "^6.7.4",
"babel-eslint": "^7.1.1",
"babel-loader": "7.0.0",
"babel-plugin-react-css-modules": "^2.6.0",
"babel-plugin-syntax-class-properties": "^6.13.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-polyfill": "^6.20.0",
"babel-preset-env": "2.0.0-alpha.3",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.16.0",
"babili": "^0.1.3",
"babili-webpack-plugin": "^0.1.0",
"case-sensitive-paths-webpack-plugin": "^2.1.1",
"clean-webpack-plugin": "0.1.16",
"compression-webpack-plugin": "^0.4.0",
"css-loader": "^0.28.4",
"cssnano": "^3.10.0",
"deep-diff": "^0.3.8",
"eslint": "^4.0.0",
"eslint-loader": "^1.8.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jest": "^20.0.3",
"eslint-plugin-react": "^7.1.0",
"extract-text-webpack-plugin": "^2.1.0",
"favicons-webpack-plugin": "^0.0.7",
"file-loader": "^0.11.1",
"history": "^4.6.2",
"html-webpack-plugin": "^2.25.0",
"img-loader": "^2.0.0",
"json-loader": "^0.5.4",
"material-ui": "^0.18.1",
"material-ui-community-icons": "^0.15.0",
"node-sass": "^4.1.1",
"open-browser-webpack-plugin": "^0.0.5",
"postcss-load-config": "^1.1.0",
"postcss-loader": "^2.0.5",
"postcss-scss": "^1.0.0",
"query-string": "^4.3.4",
"react": "^15.6.1",
"react-addons-perf": "^15.4.2",
"react-create-app": "^1.0.3",
"react-create-store": "^1.0.4",
"react-dimensions": "^1.3.0",
"react-dom": "^15.6.1",
"react-ga": "^2.2.0",
"react-highcharts": "^12.0.0",
"react-moment": "^0.2.4",
"react-redux": "^5.0.1",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-router-redux": "next",
"react-sizeme": "^2.3.2",
"react-svg-inline": "^2.0.0",
"react-swipeable-views": "^0.12.3",
"react-tap-event-plugin": "^2.0.0",
"react-transition-group": "^1.1.3",
"recompose": "^0.23.4",
"redux": "^3.6.0",
"redux-action-buffer": "^1.0.1",
"redux-actions": "^2.0.3",
"redux-devtools-extension": "^2.13.2",
"redux-logger": "^3.0.6",
"redux-persist": "^4.1.0",
"redux-persist-crosstab": "^3.5.2",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.1.0",
"sass-loader": "^6.0.6",
"string-replace-loader": "^1.2.0",
"style-loader": "^0.18.2",
"stylelint-config-sass-guidelines": "^2.1.0",
"stylelint-config-standard": "^16.0.0",
"stylelint-scss": "^1.4.4",
"stylelint-webpack-plugin": "^0.7.0",
"url-loader": "^0.5.8",
"webpack": "^2.5.1",
"webpack-bundle-analyzer": "^2.8.2",
"webpack-chunk-hash": "^0.4.0",
"webpack-notifier": "^1.5.0"
}
}
I'm on npm 5, node 8.
I execute eslint by: eslint --ext .js,.jsx ./src
my eslint config is pretty simple...
{
extends: 'eslint:recommended',
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
impliedStrict: true,
globalReturn: false
}
},
env: {
es6: true,
node: true,
browser: true,
jest: true
}
}
eslint is only depended on once in my package.
@jsg2021
So you are using the globally installed eslint. Can you try the locally installed one:
node node_modules/.bin/eslint --ext .js,.jsx ./src
that was the local one. I have ./node_modules/.bin/
on my path. I don't use global packages.
I'm always local:
"scripts": {
"pm2": "./node_modules/pm2/bin/pm2",
"lint": "./node_modules/eslint/bin/eslint.js --ignore-path .gitignore --ignore-pattern **/*.min.js .",
Why is this issue closed? There are multiple reports here and in eslint: eslint/eslint#8720
This issue was resolved for me when upgrading to 7.2.2
(might have even worked before that, only know it did not work with 6.1.2
).
Occurs for me on 7.2.2 and eslint 4.3.0
Same here on 7.2.3 and ESLint 4.3.0.
This was fixed for us (node 6.2.0
) by explicitly invoking the ./node_modules/eslint/bin/eslint.js
script rather than using the binary in ./node_modules/.bin/eslint
I would suggest that perhaps there's some issue with the binary being generated in 4.3.x
?
It just went away for me... don't know when/how it changed. I'm on node 8.2.1, npm 5.3.0, latest eslint 4.x, latest babel 6.x, babel-eslint 7.x
I'm having this problem with node v6.11.1, npm 5.3, eslint@4.3.0, babel-eslint@^7.2.3 eslint-plugin-react@7.1.0 eslint-plugin-import@2.7.0
Same for me! ALARM!
I can confirm I'm having this same issue as well. no-undef false positive with babel-esint: 7.2.3
and eslint: 4.4.1
I was getting this just in the webpack build, and not when running eslint
from the command line. I deleted the node_modules
folder and did a yarn install
and all the problems went away. babel-esint: 7.2.3
and eslint: 4.4.1
FWIW it appears to occur when packages are installed with Yarn instead of NPM. Running npm rebuild
after a fresh yarn install
fixes the problem for me.
This is the content of the package.json
file:
{
...
"scripts": {
...
"lint": "eslint --cache --ext .jsx,.js .",
...
},
...
"devDependencies": {
...
"eslint": "4.4.1",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.2.0",
...
},
...
}
These are the versions of Node, NPM, and Yarn running on my machine:
node --version
v6.11.2
npm --version
3.10.10
yarn --version
0.27.5
We also have this exact problem after upgrading to latest eslint and babel-eslint.
I am having this issue after upgrade. My devDependencies are:
"devDependencies": {
"autoprefixer": "^7.1.1",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.0",
"babel-plugin-angularjs-annotate": "^0.8.0",
"babel-plugin-flow-runtime": "^0.11.1",
"babel-plugin-syntax-flow": "^6.8.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-env": "^1.6.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-stage-3": "^6.24.1",
"css-loader": "^0.28.4",
"del-cli": "^1.1.0",
"eslint": "^4.6.1",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-flowtype": "^2.34.0",
"eslint-plugin-import": "^2.7.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.1",
"firebase-tools": "^3.9.2",
"flow-bin": "^0.53.1",
"flow-runtime-mobx": "^0.14.0",
"html-loader": "^0.5.0",
"html-webpack-plugin": "^2.30.1",
"mobx-logger": "^0.6.0",
"ngtemplate-loader": "^2.0.1",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.1",
"svgo": "^0.7.2",
"svgo-loader": "^1.2.1",
"webpack": "^3.3.0",
"webpack-dev-server": "^2.4.5",
"webpack-notifier": "^1.5.0",
"xo": "^0.18.2",
"yargs": "^8.0.1"
}
Seems like I've encountered this problem after adding flow
related packages:
...
+ "babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^7.2.3",
"babel-jest": "^21.0.0",
"babel-loader": "^7.1.2",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-module-resolver": "^2.7.1",
"babel-plugin-ramda": "^1.4.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-constant-elements": "^6.23.0",
"babel-plugin-transform-react-inline-elements": "^6.22.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
"babel-preset-env": "^1.6.0",
+ "babel-preset-flow": "^6.23.0",
"babel-preset-jest": "^21.0.0",
"babel-preset-react": "^6.24.1",
...
"eslint": "3.19.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-import-resolver-babel-module": "^3.0.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-compat": "^1.0.4",
"eslint-plugin-fetch": "0.0.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "^7.3.0",
"eventsource-polyfill": "^0.9.6",
+ "flow-bin": "^0.54.1",
"identity-obj-proxy": "^3.0.0",
"jest": "^21.0.1",
...
+ "prettier-eslint": "^8.0.0",
...
Same issue.
I can also confirm that we have no-undef false positive with babel-esint: ^7.2.3 and eslint: ^4.4.1.
+1
Is anyone taking a look at this? It seems this should be done by someone who knows a bit about eslints and this plugins internals to make the correct adjustments needed for the newer eslint versions?
+1
also happening with eslint 3.19.0
and babel-eslint 7.2.3
Any workaround for this for the time being without just disabling no-undef
?
i solved this by updating the relative dependencies. new version : "eslint": "^4.8.0", "babel-eslint": "^8.0.1"
hope it helps
It works by eslint . --ext js,jsx
But it is broken when use new CLIEngine().executeOnFiles(['path/to/files'])
node 8.4.0
babel-eslint 8.0.1
eslint: 4.9.0
Still occurring with
eslint ^4.11 babel-eslint ^8.0.2 node 8.9.1
There's been changes in the class-properties
implementation in 7.0.0-beta.x
after v6.x
see.
Was seeing this error, then updated to "eslint": "^4.12.0"
and "babel-eslint": "^8.0.2"
and now it's fixed. Updating only babel-eslint did not fix it. I'm on node v8.8.1 and npm v5.5.1
This issue started for me when I added prettier-eslint
. prettier-eslint is using "eslint": "^4.5.0"
, if I add "prettier-eslint@6.4.2"
(when they're using eslint 3.1.9) the issue goes away. I'm using "eslint": "3.19.0"
and "babel-eslint": "7.2.3"
Reverted from babel-eslint@8.0.3
to babel-eslint@7.2.3
and all is well 👌
Didn't even need to change my eslint version. Kept eslint the whole time at 4.13.1
$ node -v
v8.9.2
$ npm -v
5.5.1
I am experiencing the same issue. If I use babel-eslint@7.2.3
the errors goes away. But if I upgrade to babel-eslint@8.x.x
I start to get these errors.
I don't use Eslint
, but Standard
instead. First I thought it was something wrong with Standard
, but after finding this issue I understand that it has something to do with babel-eslint
.
How come these kind of issues starts to occur with babel-eslint@^8.x.x
?
$ node -v
v9.2.0
$ npm -v
5.5.1
devDependencies: {
...
"babel-eslint": "7.2.3",
"husky": "^0.14.3",
"snazzy": "^7.0.0",
"standard": "^10.0.3",
...
},
"lint-staged": {
"*.js": [
"yarn run lint",
"git add"
]
},
"config": {},
"standard": {
"parser": "babel-eslint",
"globals": [
"describe",
"test",
"jest",
"expect",
"fetch",
"navigator",
"__DEV__",
"XMLHttpRequest",
"FormData",
"React$Element"
]
}
I still have this problem in 8.2.1 !!
I updated all my packages, see my package.json:
"devDependencies": {
"babel-eslint": "^8.2.1",
"eslint": "^4.16.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1"
},
and my .eslintrc is so
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
I hope I can have helped
Same here, tried above and it's the same.
From what I can tell, this is now fixed in babel-eslint ^8.1.0, which drops the unreliable monkey-patching in favor of the new eslint parser API. To make this work, you also need eslint ^4.14.0, which is the first release that includes the new parser API. Otherwise, babel-eslint will fall back on the old & buggy code path.
Still happens to me:
"babel-core": "^6.26.0",
"babel-eslint": "7.2.3",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native": "^4.0.0",
"eslint": "4.13.1",
"eslint-config-standard-react": "^5.0.0",
"eslint-plugin-flowtype": "^2.44.0",
"standard": "^10.0.3"
"standard": {
"plugins": [
"flowtype"
],
"parser": "babel-eslint"
}
{
"parser": "babel-eslint",
"extends": [
"standard",
"standard-react"
]
}
@swansontec I tried with babel-eslint@8.1.2
and eslint@4.18
and also had the issues
With eslint at ^4.18.1
and babel-eslint at ^8.2.2
the issue is gone for me.
If, like me, you have a global installation of eslint, you might want to check where the command is being run from. In my case the eslint version inside the project dependencies, where it was being run from, was an older one. After updating the dependency, props are no longer producing lint errors for me. Hope this helps!
hey, it seems this still break eslint@3, maybe should pick a patch?
In the following JS I get a "no-undef" on webpack compilation because of
inputPicks
andcontextTypes
static class properties but it does not happen firing ESLint from command line.Package.json
Dependencies: