vscode es6语法报错怎么办

2023-06-26,,

这篇文章给大家分享的是有关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 es6语法报错怎么办”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

《vscode es6语法报错怎么办.doc》

下载本文的Word格式文档,以方便收藏与打印。