美文网首页ESLint专题
vue-cli4.x创建 vue项目 引入 ESLint 配置文

vue-cli4.x创建 vue项目 引入 ESLint 配置文

作者: 莘栀 | 来源:发表于2021-02-13 18:44 被阅读0次
    ESLint Standard生成配置文件
    module.exports = {
      root: true,
      env: {
        node: true
      },
      extends: [
        'plugin:vue/essential',
        '@vue/standard'
      ],
      parserOptions: {
        parser: 'babel-eslint'
      },
      rules: {
        'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
        'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
      }
    }
    
    // .editorconfig
    [*.{js,jsx,ts,tsx,vue}]
    indent_style = space
    indent_size = 2
    trim_trailing_whitespace = true
    insert_final_newline = true
    
    ESLint Pretiter生成配置文件
    module.exports = {
      root: true,
      env: {
        node: true
      },
      extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
      parserOptions: {
        parser: "babel-eslint"
      },
      rules: {
        "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
        "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
      }
    };
    
    ESLint Airbnb配置文件
    // .eslintrc.js
    module.exports = {
      root: true,
      env: {
        node: true,
      },
      extends: [
        'plugin:vue/essential',
        '@vue/airbnb',
      ],
      parserOptions: {
        parser: 'babel-eslint',
      },
      rules: {
        'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
        'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
      },
    };
    
    // .editorconfig
    [*.{js,jsx,ts,tsx,vue}]
    indent_style = space
    indent_size = 2
    end_of_line = lf
    trim_trailing_whitespace = true
    insert_final_newline = true
    max_line_length = 100
    

    相关文章

      网友评论

        本文标题:vue-cli4.x创建 vue项目 引入 ESLint 配置文

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