-
-
Notifications
You must be signed in to change notification settings - Fork 239
warning 'state' is not defined. #529
Comments
On what line of code? It sounds like it's giving you a valid warning, but you haven't shown any code so there's no way to address this. |
I am now getting lint errors of no-undef for decorators, defaultProps, and state in my React Components.
I'm using:
|
I had gotten this error but now have fixed it here is my full eslint related devDependencies: {
"devDependencies": {
"babel-eslint": "^8.0.2",
"eslint": "^4.12.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
"...": "...other stuff"
},
"eslintConfig": {
"extends": [
"airbnb",
"standard",
"standard-react"
],
"parser": "babel-eslint",
"plugins": [
"babel",
"react",
"promise"
],
"env": {
"browser": true,
"jest": true
}, |
I'm having the same issue, and its also happening with arrow methods, see my issue that I posted in the eslint issues here: |
Has this issue already been solved? I do not see/ understand the solution. |
@ehmkah I'm no longer having this issue, but my babel setup has changed significantly since then |
@ryanrogalski - ok maybe my configuration is too old. Hopeful this issue does not appear anymore update it. :-) |
in my case, it was because i was using the installing and including https://github.com/babel/eslint-plugin-babel fixed it |
Same problem here. |
can someone post full setup here |
Suddenly having this issue, nothing in my setup has changed. Relevant packages being used in "babel-eslint": "^7.1.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"eslint": "^3.19.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-react": "^7.0.1", And here is my {
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"globals": {
"process": true
},
"rules": {
"indent": [
"error",
2,
{ "SwitchCase": 1 }
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-console": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2
}
} I tried using the
Which gets thrown specifically in that package. Perhaps a version mismatch? I don't get it though, I never had to do this before. This just started happening all of a sudden. My guess is that someone put a breaking change in a minor package update somewhere... Update: Have installed Can everyone post what editor they are using? Perhaps it's related? I'm using Atom v1.30.0 with Update 2: I've fixed the issue. I went through all my dependencies in my develop branch and compared them to my current feature branch and found that the only difference was So here are my final "devDependencies": {
"babel-eslint": "^7.1.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"eslint": "^3.19.0",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-react": "^7.0.1",
"import-sort-cli": "^3.3.0",
"import-sort-parser-babylon": "^3.2.0",
"import-sort-style-absolute": "^1.0.1",
"madge": "^2.2.0",
"node-sass": "^4.9.2",
"react-scripts": "1.0.7"
}, Make sure you check |
@rohan-deshpande, I'm glad that you were able to fix but changing the version of |
@robbporto I didn't change it, it was |
Should be closed in favour of #487 |
My solution was to add: |
Thank you for the issue. Now that |
I use this linter with react and standardjs but I have this warning (
yarn lint
) :How can I fix it?
The text was updated successfully, but these errors were encountered: