添加ESLINT配置文件.eslintrc.js,规范前端代码格式

依赖:

"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",

.eslintrc.js文件配置

module.exports = {
    
    
  env: {
    
    
    browser: true,
    es6: true,
    node: true
  },
  extends: [
    'plugin:vue/essential',
    'standard',
    'plugin:vue/recommended'
  ],
  globals: {
    
    
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
    
  },
  parserOptions: {
    
    
    ecmaVersion: 2018
  },
  plugins: [
    'vue'
  ],
  rules: {
    
    
    'eqeqeq': 'off',
    'vue/no-v-html': 'off',
    'no-debugger': 'off',
    "vue/html-closing-bracket-newline": ["error", {
    
    
      "singleline": "never",
      "multiline": "always"
    }],
    "vue/singleline-html-element-content-newline": 'off',
    'vue/no-unused-components': 'off',
    'vue/require-default-prop': 'off',
    'no-unused-vars': 'off',
    'no-unused-vars': 'off',
    "vue/attribute-hyphenation": 'off',
    'vue/require-valid-default-prop': 'off',
    'no-tabs': 'off',
    'camelcase': 'off',
    'no-undef': 'off',
    'no-useless-escape': 'off',
    'no-control-regex' :'off',
    'vue/attribute-hyphenation': 'off',
    'vue/order-in-components': 'off',
    'vue/prop-name-casing': 'off',
    'vue/attribute-hyphenation': 'off',
    'no-self-assign': 'off',
    'vue/require-prop-types': 'off',
    "vue/max-attributes-per-line": ["error", {
    
    
      "singleline": 5,
      "multiline": {
    
    
        "max": 1,
        "allowFirstLine": false
      }
    }]
  }
}

猜你喜欢

转载自blog.csdn.net/weixin_42050406/article/details/112317530