美文网首页大前端
vue中eslint的配置文件,解决N多头疼脑热小毛病

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

作者: 万州客 | 来源:发表于2020-11-06 16:45 被阅读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
      }
    }
    

    相关文章

      网友评论

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

        本文链接:https://www.haomeiwen.com/subject/mfntbktx.html