[standard] Parsing error: Unexpected token =
What version of standard? 11.0.1
What operating system, Node.js, and npm version? OSX 6.1.0 10.3.0
What did you expect to happen? standard --fix to fix arrow functions.
What actually happened? Get a parsing error on arrow functions and standard --fix does not fix them.

All other rules appear to format ok
standard configs in package.json
"standard": {
"parser": "babel-eslint",
"ignore": [
"src/utils/epubjs/**/*.js"
],
"globals": [
"jest",
"expect",
"test",
"describe",
"it",
"beforeEach",
"beforeAll",
"afterAll",
"shallow",
"snapshot",
"localStorage",
"FileReader",
"FormData",
"location",
"all",
"history",
"mount"
]
}
devDeps
"babel-eslint": "^8.2.6",
"babel-jest": "22.4.3",
"babel-loader": "7.1.4",
"babel-plugin-react-component-data-attribute": "^0.5.0",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-do-expressions": "^6.22.0",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-function-bind": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-regenerator": "^6.26.0",
babelrc
"presets": [
["env"]
],
"plugins": [
"transform-class-properties",
"transform-decorators",
"transform-react-constant-elements",
"transform-react-inline-elements",
"transform-object-rest-spread",
"transform-function-bind",
"transform-do-expressions",
"transform-react-jsx",
"transform-export-extensions",
"syntax-dynamic-import",
"syntax-async-functions",
"transform-regenerator"
]
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
??
I'm also having this issue with the latest Create React App boilerplate. Usually adding "parser": "babel-eslint" would fix it.
@CodeDraken i have the same issue but using the babel-eslint parser just change the error to

for this code
componentDidMount = async() => {
const response = await getUserData()
localStorage.setItem('user', JSON.stringify(response))
}
are there any additional settings you have made for the default to ignore this rule?
@CodeDraken i have the same issue but using the babel-eslint parser just change the error to
for this code
componentDidMount = async() => { const response = await getUserData() localStorage.setItem('user', JSON.stringify(response)) }are there any additional settings you have made for the default to ignore this rule?
No there shouldn't be anything else required... but like I said I'm also having this issue, I think it's a conflict with Create-React-App.
@CodeDraken i have the same issue but using the babel-eslint parser just change the error to
for this code
componentDidMount = async() => { const response = await getUserData() localStorage.setItem('user', JSON.stringify(response)) }are there any additional settings you have made for the default to ignore this rule?No there shouldn't be anything else required... but like I said I'm also having this issue, I think it's a conflict with Create-React-App.
:/

same issue randomly where the first '=' of a file is marked as an invalid token. it's completely without pattern, and only in about 1/100 files, and doesn't seem to have any effect. in this example, it's state... but if i remove that statement, it automatically marks the next = as being the invalid token... doesn't matter what statement or type of code i place there, if it sees an = sign in absolutely any conceivable code i put there, it marks it invalid.
Yep, seeing same behavior.
Encountering the same issue!
same issue with @kaigouthro
Seeing the same issue when writing this (including in the online demo):
class MyClass {
x = () => 'Test'
}
Seeing the same issue as well. Oddly when I run the standard --verbose --fix command directly from the command line, instead of via npm run fix (which is configured to do exactly the same) the errors do not occur, and the subsequent running of npm run fix succeeds. I've checked to see whether any content within the project directory has changed, and I can see nothing at all different!!
Same for me.
standard --verbose --fix still produces the error in my case
when i replace standard(11.0.1) with standardx(3.0.1), i encountered the same issue.
Is there any update? I'm still having this issue.
It appears to be something to do with class level assignments (perhaps tied to React). It happens for me with both:
class Whatever extends Component {
state = {}
}
class Whatever extends Component {
myFunc = async (e) => {
}
}
In any case, it's the first = /within the class/ -- other equal signs either outside of the class or in other functions are fine.
@ThomasGoehringer, @srevenant are you using babel-eslint as the parser?
@ThomasGoehringer, @srevenant are you using
babel-eslintas the parser?
Yes. If there is guidance for something else, I'm game to try.
Yes, me too.
Also getting this issue. I don't want to have to use babel-eslint as the parser to make this lint'ing false positive go away...