vscode 支持es6语法
Posted webbky
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vscode 支持es6语法相关的知识,希望对你有一定的参考价值。
在首选项中 设置:
"jshint.enable": false,
在根目录中建立eslintrc.yml
parser: babel-eslint parserOptions: ecmaFeatures: jsx: true modules: true sourceType: module plugins: - babel - react env: browser: true es6: true node: true commonjs: true globals: __DEV__: true __BUILD_TIME__: false __COMMIT_HASH__: false rules: no-cond-assign: 0 no-constant-condition: 1 no-debugger: 1 no-dupe-args: 2 no-dupe-keys: 2 no-duplicate-case: 2 no-empty-character-class: 2 no-empty: 1 no-ex-assign: 2 no-extra-boolean-cast: 2 no-extra-semi: 2 no-func-assign: 2 no-inner-declarations: 2 no-invalid-regexp: 2 no-irregular-whitespace: 2 no-obj-calls: 2 no-sparse-arrays: 2 no-unexpected-multiline: 2 no-unreachable: 1 use-isnan: 2 valid-jsdoc: - 0 - requireParamDescription: false requireReturnDescription: false requireReturn: false prefer: returns: returns valid-typeof: 2 eqeqeq: 2 guard-for-in: 2 no-caller: 2 no-empty-pattern: 2 no-eq-null: 2 no-eval: 1 no-extend-native: 2 no-extra-bind: 2 no-multi-spaces: 2 no-multi-str: 2 no-new-wrappers: 2 no-redeclare: 2 no-self-assign: 2 no-throw-literal: 2 no-unused-labels: 2 no-useless-escape: 1 no-void: 0 no-with: 2 no-delete-var: 2 no-undef: 2 no-unused-vars: - 1 - args: none array-bracket-spacing: - 2 - never brace-style: - 2 - 1tbs - allowSingleLine: true camelcase: - 0 - properties: never comma-dangle: - 2 - never comma-spacing: 2 comma-style: 2 computed-property-spacing: 2 eol-last: 2 func-call-spacing: 2 key-spacing: 2 keyword-spacing: 2 linebreak-style: - error - unix max-len: - 2 - code: 180 tabWidth: 2 ignoreUrls: true new-cap: 0 no-array-constructor: 2 no-mixed-spaces-and-tabs: 2 no-multiple-empty-lines: - 2 - max: 4 no-new-object: 2 one-var: - 0 - var: never let: never const: never padded-blocks: - 2 - never quote-props: - 0 - consistent quotes: - 2 - single - allowTemplateLiterals: true require-jsdoc: - 0 - require: ClassDeclaration: true semi-spacing: 2 semi: ‘off‘ space-before-blocks: 2 space-before-function-paren: - 0 - always spaced-comment: - 1 - always arrow-parens: - 2 - as-needed constructor-super: 2 generator-star-spacing: - 2 - after no-const-assign: 2 no-dupe-class-members: 2 no-new-symbol: 2 no-this-before-super: 2 no-var: 2 object-shorthand: 1 prefer-rest-params: 2 prefer-spread: 2 rest-spread-spacing: 2 yield-star-spacing: - 2 - after babel/object-curly-spacing: 0 react/display-name: 0 react/jsx-boolean-value: 1 react/jsx-closing-bracket-location: 2 react/jsx-curly-spacing: 0 react/jsx-max-props-per-line: 0 react/jsx-indent-props: - 0 - 2 react/jsx-no-duplicate-props: 1 react/jsx-no-undef: 2 react/jsx-pascal-case: 1 react/sort-prop-types: 0 react/jsx-sort-props: 0 react/jsx-uses-react: 1 react/no-danger: 0 react/no-did-mount-set-state: 1 react/no-did-update-set-state: 2 react/no-multi-comp: 0 react/no-unknown-property: 1 react/react-in-jsx-scope: 0 react/self-closing-comp: 1 react/sort-comp: 1 react/jsx-uses-vars: 2
以上是关于vscode 支持es6语法的主要内容,如果未能解决你的问题,请参考以下文章