vscode es6语法报错


本文摘自PHP中文网,作者angryTom,侵删。

vscode es6语法报错

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

解决方法:

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

.eslintrc.js

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

// 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

1

2

build/*.js

config/*.js

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

以上就是vscode es6语法报错的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

vsCode如何修改终端

vsCode如何使用git管理代码

vsCode编辑js代码经常报错

vsCode todo如何使用

vsCode中快速搭建vue模板的方法介绍

解决vsCode格式保存后出现的问题

vsCode中怎么设置背景色?

vsCode有中文版吗

vsCode如何取消标签提示下划线

ubuntu如何使用vsCode

更多相关阅读请进入《vsCode》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...