首頁  >  文章  >  開發工具  >  vscode es6文法報錯

vscode es6文法報錯

angryTom
angryTom原創
2019-11-07 14:54:413851瀏覽

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文法報錯的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn