‘eqeqeq‘: [“error“, “always“]

在这里插入图片描述

rules: {
    
    
//'no-undef': 2,
eqeqeq: ['error', 'always'], //强制使用三等和没有使用的要删除掉
'no-console': 'off',
'no-debugger': 'off',
'vue/no-v-html': 'off',
'vue/html-self-closing': [
  'error',
  {
    
    
    html: {
    
    
      void: 'any',
      normal: 'any',
      component: 'always',
    },
    svg: 'always',
    math: 'always',
  },
],

eqeqeq参考文档
增加校验的严格性,如三等,或定义为使用的参数或接口名都需要删除,这里统一使用校验,git提交代码如果不按照规范,无法提交代码
文件.eslintrc.js

module.exports = {
    
    
  root: true,
  env: {
    
    
    node: true,
  },
  extends: [
    'plugin:vue/vue3-recommended',
    'eslint:recommended',
    '@vue/prettier',
  ],
  parser: 'vue-eslint-parser',
  parserOptions: {
    
    
    ecmaVersion: 2020,
    sourceType: 'module',
    ecmaFeatures: {
    
    
      jsx: true,
    },
  },
  globals: {
    
    
    aliUploadVideo: true,
    AliyunUpload: true,
  },
  rules: {
    
    
    //'no-undef': 2,
    eqeqeq: ['error', 'always'], //强制使用三等和没有使用的要删除掉
    'no-console': 'off',
    'no-debugger': 'off',
    'vue/no-v-html': 'off',
    'vue/html-self-closing': [
      'error',
      {
    
    
        html: {
    
    
          void: 'any',
          normal: 'any',
          component: 'always',
        },
        svg: 'always',
        math: 'always',
      },
    ],
    // Vue.js风格指南(https://cn.vuejs.org/v2/style-guide/)
    // Vue组件排序
    'vue/order-in-components': [
      'warn',
      {
    
    
        order: [
          'el',
          'name',
          'key',
          'parent',
          'functional',
          ['delimiters', 'comments'],
          ['components', 'directives', 'filters'],
          'extends',
          'mixins',
          ['provide', 'inject'],
          'ROUTER_GUARDS',
          'layout',
          'middleware',
          'validate',
          'scrollToTop',
          'transition',
          'loading',
          'inheritAttrs',
          'model',
          ['props', 'propsData'],
          'emits',
          'setup',
          'fetch',
          'asyncData',
          'data',
          'head',
          'computed',
          'watch',
          'watchQuery',
          'LIFECYCLE_HOOKS',
          'methods',
          ['template', 'render'],
          'renderError',
        ],
      },
    ],
    // Vue属性排序
    'vue/attributes-order': [
      'warn',
      {
    
    
        order: [
          'DEFINITION',
          'LIST_RENDERING',
          'CONDITIONALS',
          'RENDER_MODIFIERS',
          'GLOBAL',
          'UNIQUE',
          'TWO_WAY_BINDING',
          'OTHER_DIRECTIVES',
          'OTHER_ATTR',
          'EVENTS',
          'CONTENT',
        ],
        alphabetical: true, //字母顺序
      },
    ],
  },
  overrides: [
    {
    
    
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)',
      ],
      env: {
    
    
        jest: true,
      },
    },
  ],
}

Guess you like

Origin blog.csdn.net/weixin_41056807/article/details/115730083