New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[standard] Parsing error: Unexpected token = #1165
Comments
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 |
@CodeDraken i have the same issue but using the babel-eslint parser just change the error to for this code 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. |
Yep, seeing same behavior. |
Encountering the same issue! |
same issue with @kaigouthro |
Seeing the same issue when writing this (including in the online demo):
|
Seeing the same issue as well. Oddly when I run the |
Same for me. |
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:
In any case, it's the first |
@ThomasGoehringer, @srevenant are you using |
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... |
Hi everyone! A couple things to try:
Thanks! |
Prerelease version doesn't work either. Here's the output of
And here's a link to a repo where I'm having this problem: https://github.com/ThomasGoehringer/react-course-2-expensify-app |
Running standard as I would, but on version 13, received a TB the first time, but the second time it ran without error. However, it didn't actually work even though it ran without error. The TB:
$
|
@ThomasGoehringer What do you mean by "doesn't work"? I cloned the repo you linked to, ran "scripts": {
...
"lint": "standard",
...
} And it worked just fine, outputting the following errors:
When upgrading to v13.0.1, it also works just fine. Perhaps you have an old version of Then run add a script to |
@srevenant I believe that your issue is a duplicate of #1329 |
I wasn't running standard via script but with the VS Code plugin. So the issue is at another place. Thanks. |
I solved the problem by adding these three lines on my
|
@linxuyalun myself and many other future travelers thank you profusely. |
@linxuyalun -- this fixed my issue. THANK YOU SO VERY MUCH! |
I got it running worked after spending some time trying out different options. Hope this helps anyone else getting stuck. .eslintrc.json (in root project folder): {
"env": {
"browser": true,
"es2021": true,
"jest/globals": true
},
"extends": [
"standard",
"plugin:jest/all"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"jest/no-hooks": [
"error",
{
"allow": [
"afterEach",
"beforeEach"
]
}
]
},
"plugins": [
"jest"
]
} Empty .babelrc (in root project folder): {} .package.json (in root project folder): {
"scripts": {
"test": "jest",
"lint": "npx eslint --format=table .",
"lintfix": "npx eslint --fix ."
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/eslint-parser": "^7.15.0",
"aws-sdk-mock": "^5.2.1",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"jest": "^27.0.6"
}
} VS Code settings.xml (editor configuration: enables auto fix on save + babel parser): "eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.options": {
"parser": "@babel/eslint-parser"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript"
] |
time traveler here from 2021! i'm so grateful! |
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
devDeps
babelrc
The text was updated successfully, but these errors were encountered: