-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
ES6 syntax support isn't working in VSCode #2394
Comments
I checkout the same code, but there is nothing wrong with this~~~ |
@jrieken can you please comment. It is 'your' GitHub repository. |
I'm seeing this same issue in the latest Alpha build 1.9.0. Hovering over "import" shows "Parsing error: the import keyword is reserved (null)". I tried creating a {
"compilerOptions": {
"target": "ES6",
"module": "commonjs"
}
} Didn't solve the syntax highlighting issue. Additionally, I would expect a syntax error that isn't shown. In my example above |
The error message comes from @waderyan can you check your eslint configuration and whether you enabled ecmaVersion 6, see below? With the following setting the error goes away for me. {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
}
} @dbaeumer has the change to prefix lint errors by the |
@egamma I did not have the options for eslint set, however it does not fix the issue. |
@waderyan but with the eslintrc config the error for the The error message for the |
Creating .eslintrc fixed it. We also have eslint.options in preferences. I assumed they performed the same function, but they don't in this case. Snippet:
jsconfig.json
|
These are false positives reported by eslint. I suggest to disable the rule |
@waderyan //eslint-disable-line //eslint-disable-line no-unused-vars |
Good to know. I talked to @gregvanl today about some of this in a doc for React / ES6 developers. Wasn't easy for me to figure out. |
fully agreed, this is why I was much interested into this issue. I'll cover setting up eslint in the change notes, deferring to @gregvanl to add this to the main docs. |
Great. I've created an issue in vscode-docs to track this. |
I found another issue and want to keep it documented. Do you think this is the best place? I can create a separate issue or find another place to track these es6 issues. This is from ReactStarterKit. Here is the code not in an image.
The error message I see is 'property declarations can only be used in a .ts file' |
Ah ... I think I got it. Decorators are an ES7 feature. |
In general, given that we transition to Salsa the TypeScript repository is the right place to file ES6 issues.
This is issue microsoft/TypeScript#6997
This is microsoft/TypeScript#6872. This should be in TS 1.8.2 according the bug report. Can you confirm that you are using TS 1.8.2 (which now the default in the code-alpha channel). |
I'll file a bug. |
Has this been fixed? I am not sure how to fix this. |
I am using version 1.1.0 |
@waderyan Same issues here. Have you found a solution? |
@waderyan I've tried following this and the related conversations but I can't seem to find a way to resolve the warnings in VSCode Version 1.1.1 (1.1.1) |
any update on this? i am using v1.2.1 |
@reggieboyYEAH , have you tried creating an .eslintrc file at the root dir of your project with in it? That solved it for me as suggested above |
.eslintrc.json * |
I sometimes run into this issue. Restarting seems to fix this for a while. I'm not sure what triggers it. I'm running VSCode 1.8.1 and version 1.2.1 of the ESLint plugin. |
I can't really get this to work. I am using VSCode 1.8.1 too, I tried with the ESLint plugin enabled and disabled, with the jsconfig.json file and the .eslintrc but none of them are working to me EDIT: TypeScript version 2.1.5, if needed |
I got this problem too, nb: Fixed by restarting vscode |
Hey guys, i have downloaded this project i just tried to declare "const" in any file and is not recognized, i already checked the esLint but it doesnt works,, is not recognized .... COME ON GUYS EVERY DELIVER OF VSCODE, COMES WITH MORE AND MORE ISSUES |
That did the trick for me: I installed ESLint so I get the valid javascript validation warnings from ESLint, and I disabled the default VSCode javascript validation so I don't get the "falsy" javascript validation warnings from VSCode. https://code.visualstudio.com/docs/languages/javascript
|
Try to add const in any method. |
I cloned the ES6 example repo (https://github.com/jrieken/es6-vscode-sample), but when I open it, the syntax support is broken

The text was updated successfully, but these errors were encountered: