大前端

vue中eslint的配置文件,解决N多头疼脑热小毛病

2020-11-06  本文已影响0人  万州客

今天开始撸js时,遇到很多头疼脑热的小毛病,比如,空格和TAB呀,import无法识别呀,unexpected token呀之类的。最后,我在项目里,额外加了一个.eslintrc.js来解决。

累记错误
Mixed spaces and tabs no-mixed-spaces-and-tabs
Parsing error: The keyword 'import' is reserved
Vue error: Parsing error: Unexpected token

项目根目录下的.eslintrc.js文件内容

// https://eslint.org/docs/user-guide/configuring

module.exports = {
  'parser': "vue-eslint-parser",
  'parserOptions': {
    'parser': 'babel-eslint',
    'ecmaVersion': 2018,
    'sourceType': 'module'
  },

  // add your custom rules here
  'rules': {
    'no-tabs': 0,
    'no-mixed-spaces-and-tabs': 0,
    'indent': ["off", "tab"],
    'no-trailing-spaces': 0
  }
}
上一篇下一篇

猜你喜欢

热点阅读