vscode es6语法报错

vscode es6语法报错

用VS Code开发ES6语法的项目,Promise等关键字和语法不识别,报错。

解决方法:

在项目根目录下建两个文件: .eslintrc.js .eslintignore

.eslintrc.js

// http://eslint.org/docs/user-guide/configuringmodule.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    browser: true,
  },
  // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
  extends: 'standard',
  // required to lint *.vue files
  plugins: [
    'html'
  ],
  // add your custom rules here
  'rules': {
    // allow paren-less arrow functions
    'arrow-parens': 0,
    // allow async-await
    'generator-star-spacing': 0,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }}

.eslintignore

build/*.js
config/*.js

相关推荐:《vscode使用教程》

以上就是vscode es6语法报错的详细内容,更多请关注www.sxiaw.com其它相关文章!