vscode에서 ES6 / ES7 구문 지원을 켜는 방법이 있습니까?
편집 3 : 버전 0.4.0부터 jsconfig.json
다음 내용으로 프로젝트 폴더에 파일을 추가하여 ES6 구문을 켤 수 있습니다 .
{
"compilerOptions": {
"target": "ES6"
}
}
편집 2 : 사용자 음성으로이 기능에 투표 할 수 있습니다.
Visual Studio Code에서 ES6 / ES7을 "켜는"방법이 있습니까?
편집 1
@sarvesh의 제안을 시도 javascript.validate.target
했습니다. vscode를 무시 하고 다시 시작했습니다. 도움이되지 않았습니다.
현재 ES6 및 ES7 기능을 사용하는 유일한 방법은 Typescript 를 사용하는 것 입니다.
반면에, 여기 당신은 ES6 및 ES7에 대한 기능 요청이있는 것을 볼 수 있습니다
프로젝트의 루트에서 jsconfig.json 파일을 만들고이 객체를 작성하는 것은 매우 쉽습니다.
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs"
}
}
이 링크 는 많은 도움 이 되었습니다. 프로젝트에 jsconfig.json 파일을 추가하는 것은별로 도움이되지 않았거나 최선의 해결책이 아닙니다. 파일> 환경 설정> 설정으로 이동합니다. settings.json 파일에서 다음 행을 추가하십시오.
"jshint.options": { "esversion": 6 }
위의 답변에 추가 중 ...
VS 코드 문서에 따라 ..
jsconfig.json을 작업 공간의 루트가 아닌 JavaScript 프로젝트 의 루트 에 배치했는지 확인하십시오 . 아래는 JavaScript 대상을 ES6으로 정의하고 exclude 속성이 node_modules 폴더를 제외하는 jsconfig.json 파일입니다.
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules"
]
}
다음은 명시 적 파일 속성이있는 예입니다.
{
"compilerOptions": {
"target": "ES6"
},
"files": [
"src/app.js"
]
}
files 속성은 exclude 속성과 함께 사용할 수 없습니다. 둘 다 지정하면 files 속성이 우선합니다.
also try editing the "target" property in tsconfig.json
{
"compilerOptions": {
"target": "es5",//es6
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
Otherwise you can use ESLint to highlight ES7 error (using babel parser or others): VSCode Linter ES6 ES7 Babel linter
Alternatively you can use Flow instead of Typescript, which is much easier to setup and migrate to. I wrote a small article on how to setup Flow with VS Code.
As of this date and according to the ESLint docs on the VSCode Marketplace, including a .eslintrc configuration file in the root of the project enables ES6 linting in the ESLint VSCode extension.
My .eslintrc config file looks like this:
extends:
- standard
parser: babel-eslint
rules:
object-curly-spacing: [ error, always ]
react/prop-types: off
space-before-function-paren: off
I have eslint installed via npm in node_modules and all I know is that with .eslintrc in the project root folder ES6 linting works and without it, it doesn't.
도움이 되었기를 바랍니다...
'IT박스' 카테고리의 다른 글
ggplot2에서 qplot ()과 ggplot () 중에서 선택 (0) | 2020.08.24 |
---|---|
Emacs 용 태그 : etags, ebrowse, cscope, GNU Global 및 활기 넘치는 ctags 간의 관계 (0) | 2020.08.24 |
ASP.NET에서 SASS 사용 (0) | 2020.08.24 |
Windows 배치 파일의 명령 결과로 변수 값 설정 (0) | 2020.08.24 |
Select2 또는 Chosen에 대한 적절하게 테스트 된 대안이 있습니까? (0) | 2020.08.24 |