信息发布→ 登录 注册 退出

vscode es6语法报错

发布时间:2019-11-07

点击量:

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  # 报错  # 解决方法  # http  # org  # eslint  # docs  # user  # brush  # class  # pre  
在线客服
服务热线

服务热线

4008888355

微信咨询
二维码
返回顶部
×二维码

截屏,微信识别二维码

打开微信

微信号已复制,请打开微信添加咨询详情!