赞助
module.exports = {
  root: true,
  extends: [
    'eslint:recommended'
  ],
  env: {
    browser: true,
    node: true,
    es6: true
  },
  globals: {
    wx: true
  },
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module'
  },
  // required to lint *.vue files
  plugins: [
    'vue'
    // 'html',
    // 'flowtype'
  ],
  // check if imports actually resolve
  settings: {
    'import/resolver': {
      // Note: webpack resolver removed as we're using rsbuild now
      // If needed, configure alias resolution via eslint-import-resolver-alias or similar
    }
  },
  // add your custom rules here
  // it is base on https://github.com/vuejs/eslint-config-vue
  rules: {
    'no-console': 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
    'no-sequences': 2,
    'no-return-assign': [2, 'except-parens'],
    'no-async-promise-executor': 'warn',
    'no-unused-vars': [2, { 'vars': 'all', 'args': 'none' }],
    'no-extra-boolean-cast': 2, // 禁止不必要的布尔转换
    'no-extra-parens': [2, 'functions'], // 禁止不必要的括号
    'no-extra-semi': 2, // 禁止不必要的分号
    'no-regex-spaces': 2, // 禁止正则表达式字面量中出现多个空格
    'no-unsafe-negation': 2, // 禁止对关系运算符的左操作数使用否定操作符
    'curly': [2, 'multi-line'], // 强制所有控制语句使用一致的括号风格
    'dot-location': [2, 'property'], // 强制在点号之前和之后一致的换行
    'dot-notation': 2, // 强制尽可能地使用点号
    'eqeqeq': [2, 'allow-null'], // 要求使用 === 和 !==
    'no-div-regex': 2, // 禁止除法操作符显式的出现在正则表达式开始的位置
    'no-else-return': [2, { 'allowElseIf': true }], // 禁止 if 语句中 return 语句之后有 else 块
    'no-extra-bind': 2, // 禁止不必要的 .bind() 调用
    'no-extra-label': 2, // 禁用不必要的标签
    'no-floating-decimal': 2, // 禁止数字字面量中使用前导和末尾小数点
    'no-implicit-coercion': [2, { // 禁止使用短符号进行类型转换
      'boolean': false,
      'number': true,
      'string': false,
      'allow': ['!!', '+'/* , '~', '*' */]
    }],
    'no-multi-spaces': [2], // 禁止使用多个空格
    'no-unused-labels': 2, // 禁用出现未使用过的标
    'no-useless-return': 2, // 禁止多余的 return 语句
    'wrap-iife': [2, 'any'], // 要求 IIFE 使用括号括起来
    'yoda': [2, 'never'], // 要求或禁止 “Yoda” 条件
    'strict': [2, 'never'], // 要求或禁止使用严格模式指令
    'no-undef-init': 2, // 禁止将变量初始化为 undefined
    'array-bracket-newline': [1, 'consistent'], // 在数组开括号后和闭括号前强制换行
    'array-bracket-spacing': [2, 'always'], // 强制数组方括号中使用一致的空格
    'array-element-newline': [1, 'consistent'], // 强制数组元素间出现换行
    'block-spacing': [2, 'always'], // 禁止或强制在代码块中开括号前和闭括号后有空格
    'brace-style': [2, '1tbs', { 'allowSingleLine': true }], // 强制在代码块中使用一致的大括号风格
    'capitalized-comments': [0, 'never'], // 强制或禁止对注释的第一个字母大写
    'comma-dangle': [2, 'never'], // 要求或禁止末尾逗号
    'comma-spacing': [2, { 'before': false, 'after': true }], // 强制在逗号前后使用一致的空格
    'comma-style': [2, 'last'], // 强制使用一致的逗号风格
    'computed-property-spacing': [2, 'never'], // 强制在计算的属性的方括号中使用一致的空格
    'eol-last': [2, 'always'], // 要求或禁止文件末尾存在空行
    'func-call-spacing': [2, 'never'], // 要求或禁止在函数标识符和其调用之间有空格
    'function-paren-newline': [2, 'consistent'], // 强制在函数括号内使用一致的换行
    'implicit-arrow-linebreak': [1, 'beside'], // 强制隐式返回的箭头函数体的位置
    'indent': [2, 2, { // 强制使用一致的缩进
      'SwitchCase': 0
    }],
    'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }], // 强制在对象字面量的属性中键和值之间使用一致的间距
    'keyword-spacing': [2, { 'before': true, 'after': true }], // 强制在关键字前后使用一致的空格
    'linebreak-style': [2, 'unix'], // 强制使用一致的换行风格
    'linebreak-style': [0, "error", "windows"], // 兼容windows换行符
    'lines-around-comment': [2, { // 要求在注释周围有空行
      'beforeBlockComment': false,
      'afterBlockComment': false,
      'beforeLineComment': false,
      'afterLineComment': false,
      'allowBlockStart': true,
      'allowBlockEnd': true,
      'allowObjectStart': true, // 允许注释出现在对象字面量的开始位置
      'allowObjectEnd': true, // 允许注释出现在对象字面量的结束位置
      'allowArrayStart': true, // 允许注释出现在数组字面量的开始位置
      'allowArrayEnd': true, // 允许注释出现在数组字面量的结束位置
      'allowClassStart': true, // 允许注释出现在类的开始位置
      'allowClassEnd': true // 允许注释出现在类的结束位置
      // 'applyDefaultIgnorePatterns', // 启用或禁用该规则忽略的默认注释模式
      // 'ignorePattern' // 被该规则忽略的自定义模式
    }],
    'multiline-comment-style': [0, 'starred-block'], // 强制对多行注释使用特定风格
    'new-parens': [2/* , 'always' */], // 强制或禁止调用无参构造函数时有圆括号
    'newline-per-chained-call': [1, { 'ignoreChainWithDepth': 2 }], // 要求方法链中每个调用都有一个换行符
    'no-lonely-if': 2, // 禁止 if 作为唯一的语句出现在 else 语句中
    'no-multiple-empty-lines': [2, { 'max': 1, 'maxEOF': 1, 'maxBOF': 1 }], // 禁止出现多行空行
    'no-trailing-spaces': 0, // 禁用行尾空格(已关闭)
    'no-unneeded-ternary': [2, { 'defaultAssignment': false }], // 禁止可以在有更简单的可替代的表达式时使用三元操作符
    'no-whitespace-before-property': 2, // 禁止属性前有空白
    'nonblock-statement-body-position': [2, 'any'/* 'below' */], // 强制单个语句的位置
    'object-curly-newline': [2, { 'consistent': true }], // 强制大括号内换行符的一致性
    'object-curly-spacing': [2, 'always', { 'objectsInObjects': false }], // 强制在大括号中使用一致的空格
    'object-property-newline': [2, { 'allowAllPropertiesOnSameLine': true }], // 强制将对象的属性放在不同的行上
    'one-var': [2, { 'initialized': 'never' }], // 强制函数中的变量要么一起声明要么分开声明
    'one-var-declaration-per-line': [1, 'initializations'], // 要求或禁止在变量声明周围换行
    'operator-assignment': [2, 'always'], // 要求或禁止在可能的情况下使用简化的赋值操作符
    'operator-linebreak': [2, 'after', { 'overrides': { '?': 'before', ':': 'before' } }], // 强制操作符使用一致的换行符
    'padded-blocks': [2, 'never'], // 要求或禁止块内填充
    'padding-line-between-statements': 1, // 要求或禁止在语句间填充空行
    'prefer-object-spread': 2, // 禁止使用以对象字面量作为第一个参数的 Object.assign,优先使用对象扩展。
    'quote-props': [2, 'as-needed'], // 要求对象字面量属性名称用引号括起来
    'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }], // 'single' 强制使用一致的反勾号、双引号或单引号
    'semi': [2, 'always'], // 要求或禁止使用分号代替 ASI
    'semi-spacing': [2, { 'before': false, 'after': true }], // 强制分号之前和之后使用一致的空格
    'semi-style': [2, 'last'], // 强制分号的位置
    'sort-vars': 0, // 要求同一个声明块中的变量按顺序排列
    'space-before-blocks': [2, 'always'], // 强制在块之前使用一致的空格
    'space-before-function-paren': [2, 'never'], // 强制在 function的左括号之前使用一致的空格
    'space-in-parens': [2, 'never'], // 强制在圆括号内使用一致的空格
    'space-infix-ops': [2], // 要求操作符周围有空格
    'space-unary-ops': [2, { 'words': true, 'nonwords': false }], // 强制在一元操作符前后使用一致的空格
    'spaced-comment': [2, 'always', { // 强制在注释中 // 或 /* 使用一致的空格
      'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
    }],
    'switch-colon-spacing': [2, { 'before': false, 'after': true }], // 强制在 switch 的冒号左右有空格
    'template-tag-spacing': [2, 'never'], // 要求或禁止在模板标记和它们的字面量之间有空格
    'unicode-bom': [2, 'never'], // 要求或禁止 Unicode 字节顺序标记 (BOM)
    'wrap-regex': 0, // 要求正则表达式被括号括起来
    'arrow-body-style': [2, 'as-needed'], // 要求箭头函数体使用大括号
    'arrow-parens': [2, 'as-needed'], // 要求箭头函数的参数使用圆括号
    'arrow-spacing': [2, { 'before': true, 'after': true }], // 强制箭头函数的箭头前后使用一致的空格
    'generator-star-spacing': [2, { 'before': false, 'after': true }], // 强制 generator 函数中 * 号周围使用一致的空格
    'no-confusing-arrow': [2, { 'allowParens': true }], // 禁止在可能与比较操作符相混淆的地方使用箭头函数
    'no-useless-computed-key': 2, // 禁止在对象中使用不必要的计算属性
    'no-useless-rename': 2, // 禁止在 import 和 export 和解构赋值时将引用重命名为相同的名字
    'no-var': 2, // 要求使用 let 或 const 而不是 var
    'object-shorthand': [2, 'always'], // 要求或禁止对象字面量中方法和属性使用简写语法
    'prefer-arrow-callback': [1, { 'allowNamedFunctions': false, 'allowUnboundThis': false }], // 要求回调函数使用箭头函数
    'prefer-const': [2, { // 要求使用 const 声明那些声明后不再被修改的变量
      'destructuring': 'all', // any
      'ignoreReadBeforeAssign': false
    }],
    'prefer-destructuring': [2, { // 优先使用数组和对象解构
      'array': false,
      'object': true
    }, {
      'enforceForRenamedProperties': false
    }],
    'prefer-numeric-literals': 2, // 禁用 parseInt() 和 Number.parseInt(),使用二进制,八进制和十六进制字面量
    'prefer-template': 2, // 要求使用模板字面量而非字符串连接
    'rest-spread-spacing': [2, 'never'], // 强制剩余和扩展运算符及其表达式之间有空格
    'sort-imports': 0, // 强制模块内的 import 排序
    'template-curly-spacing': [2, 'never'], // 要求或禁止模板字符串中的嵌入表达式周围空格的使用
    'yield-star-spacing': [2, 'after'], // 强制在 yield* 表达式中 * 周围使用空格

    'no-cond-assign': 2,
    'no-nested-ternary': 1,
    'no-mixed-operators': [2, {
      'groups': [
        // ['+', '-', '*', '/', '%', '**'],
        // ['&', '|', '^', '~', '<<', '>>', '>>>'],
        // ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
        // ['&&', '||'],
        ['in', 'instanceof']
      ],
      'allowSamePrecedence': true
    }],
    'no-shadow': 1,
    'no-multi-assign': 1,
    'array-callback-return': 2,
    'no-fallthrough': 2,
    'no-empty': 2,
    'no-void': 2,

    'accessor-pairs': 2,
    'camelcase': [1, { 'properties': 'always' }],
    'constructor-super': 2,
    'handle-callback-err': [2, '^(err|error)$'],
    'new-cap': [2, {
      'newIsCap': true,
      'capIsNew': false
    }],
    'no-array-constructor': 2,
    'no-caller': 2,
    'no-class-assign': 2,
    'no-const-assign': 2,
    'no-control-regex': 2,
    'no-delete-var': 2,
    'no-dupe-args': 2,
    'no-dupe-class-members': 2,
    'no-dupe-keys': 2,
    'no-duplicate-case': 2,
    'no-empty-character-class': 2,
    'no-empty-pattern': 2,
    'no-eval': 2,
    'no-ex-assign': 2,
    'no-extend-native': 2,
    'no-func-assign': 2,
    'no-implied-eval': 2,
    'no-inner-declarations': [2, 'functions'],
    'no-invalid-regexp': 2,
    'no-irregular-whitespace': 1,
    'no-iterator': 2,
    'no-label-var': 2,
    'no-labels': [2, {
      'allowLoop': false,
      'allowSwitch': false
    }],
    'no-lone-blocks': 2,
    'no-mixed-spaces-and-tabs': 2,
    'no-multi-str': 2,
    'no-native-reassign': 2,
    'no-negated-in-lhs': 2,
    'no-new-object': 0,
    'no-new-require': 2,
    'no-new-symbol': 2,
    'no-new-wrappers': 2,
    'no-obj-calls': 2,
    'no-octal': 2,
    'no-octal-escape': 2,
    'no-path-concat': 2,
    'no-proto': 2,
    'no-redeclare': 2,
    'no-self-assign': 2,
    'no-self-compare': 2,
    'no-shadow-restricted-names': 2,
    'no-spaced-func': 2,
    'no-sparse-arrays': 2,
    'no-this-before-super': 2,
    'no-throw-literal': 0,
    'no-undef': 2,
    'no-unexpected-multiline': 2,
    'no-unmodified-loop-condition': 2,
    'no-unreachable': 2,
    'no-unsafe-finally': 2,
    'no-useless-call': 2,
    'no-useless-constructor': 2,
    'no-useless-escape': 0,
    'no-with': 2,
    'use-isnan': 2,
    'valid-typeof': 2,

    'max-len': [1, 200],
    'multiline-ternary': 0,
    'no-constant-condition': 1,
    'no-restricted-syntax': [1, 'WithStatement', "BinaryExpression[operator='in']"],

    'jsx-quotes': [2, 'prefer-single']
  },
  overrides: [
    {
      files: ['*.vue'],
      plugins: ['vue'],
      parser: 'vue-eslint-parser',
      parserOptions: {
        parser: 'babel-eslint',
        ecmaVersion: 2018,
        sourceType: 'module'
      },
      rules: {
        // Vue 规则(仅包含 eslint-plugin-vue 6.2.2 实际支持的规则)
        'vue/component-name-in-template-casing': ['warn', 'PascalCase'],
        'vue/no-boolean-default': ['warn', 'default-false'],
        'vue/prop-name-casing': ['warn', 'camelCase'],
        'vue/require-default-prop': 1,
        'vue/require-prop-types': 'off',
        'vue/v-on-function-call': ['warn', 'never'],
        'vue/attribute-hyphenation': 'off',
        'vue/html-closing-bracket-newline': 2,
        'vue/html-closing-bracket-spacing': [2, {
          'startTag': 'never',
          'endTag': 'never',
          'selfClosingTag': 'always'
        }],
        'vue/html-end-tags': 2,
        'vue/html-indent': [2, 2], // 暂时禁用以避免 babel-eslint 兼容性问题
        'vue/html-quotes': [2, 'double', { 'avoidEscape': false }],
        'vue/html-self-closing': [2, {
          'html': {
            'void': 'never',
            'normal': 'always',
            'component': 'always'
          },
          'svg': 'always',
          'math': 'always'
        }],
        'vue/max-attributes-per-line': ['error', {
          'singleline': { 'max': 6 },
          'multiline': { 'max': 1 }
        }],
        'vue/multiline-html-element-content-newline': 'off',
        'vue/mustache-interpolation-spacing': ['error', 'always'],
        'vue/no-multi-spaces': [2, {
          'ignoreProperties': false
        }],
        'vue/no-spaces-around-equal-signs-in-attribute': [2],
        'vue/no-template-shadow': 'off',
        'vue/one-component-per-file': 'off',
        'vue/singleline-html-element-content-newline': [0, {
          'ignoreWhenNoAttributes': true,
          'ignoreWhenEmpty': true,
          'ignores': ['pre', 'textarea', 'b', 'i', 'a', 'span']
        }],
        'vue/v-bind-style': [2, 'shorthand'],
        'vue/v-on-style': [2, 'shorthand'],
        'vue/v-slot-style': [2, {
          'atComponent': 'v-slot',
          'default': 'v-slot',
          'named': 'shorthand'
        }],
        'vue/attributes-order': ['error', {
          'order': [
            'DEFINITION',
            'LIST_RENDERING',
            'CONDITIONALS',
            'RENDER_MODIFIERS',
            'GLOBAL',
            ['UNIQUE', 'SLOT'],
            'TWO_WAY_BINDING',
            'OTHER_DIRECTIVES',
            'OTHER_ATTR',
            'EVENTS',
            'CONTENT'
          ],
          'alphabetical': false
        }],
        'vue/no-v-html': 'off',
        'vue/order-in-components': ['warn'],
        'vue/this-in-template': ['warn', 'never'],
        'vue/component-tags-order': ['error', {
          'order': ['template', 'script', 'style']
        }],
        'vue/no-use-v-if-with-v-for': 1,
        'vue/no-async-in-computed-properties': 1,
        'vue/no-dupe-keys': [2, {
          'groups': []
        }],
        'vue/no-duplicate-attributes': [2, {
          'allowCoexistClass': true,
          'allowCoexistStyle': true
        }],
        'vue/no-parsing-error': [2, {
          'abrupt-closing-of-empty-comment': true,
          'absence-of-digits-in-numeric-character-reference': true,
          'cdata-in-html-content': true,
          'character-reference-outside-unicode-range': true,
          'control-character-in-input-stream': true,
          'control-character-reference': true,
          'eof-before-tag-name': true,
          'eof-in-cdata': true,
          'eof-in-comment': true,
          'eof-in-tag': true,
          'incorrectly-closed-comment': true,
          'incorrectly-opened-comment': true,
          'invalid-first-character-of-tag-name': false, // 允许模板中的三元运算符,避免误报
          'missing-attribute-value': true,
          'missing-end-tag-name': true,
          'missing-semicolon-after-character-reference': true,
          'missing-whitespace-between-attributes': true,
          'nested-comment': true,
          'noncharacter-character-reference': true,
          'noncharacter-in-input-stream': true,
          'null-character-reference': true,
          'surrogate-character-reference': true,
          'surrogate-in-input-stream': true,
          'unexpected-character-in-attribute-name': true,
          'unexpected-character-in-unquoted-attribute-value': true,
          'unexpected-equals-sign-before-attribute-name': true,
          'unexpected-null-character': true,
          'unexpected-question-mark-instead-of-tag-name': true,
          'unexpected-solidus-in-tag': true,
          'unknown-named-character-reference': true,
          'end-tag-with-attributes': true,
          'duplicate-attribute': true,
          'end-tag-with-trailing-solidus': true,
          'non-void-html-element-start-tag-with-trailing-solidus': false,
          'x-invalid-end-tag': true,
          'x-invalid-namespace': true
        }],
        'vue/no-reserved-keys': [2, {
          'reserved': [],
          'groups': []
        }],
        'vue/no-shared-component-data': 'off',
        'vue/no-side-effects-in-computed-properties': 1,
        'vue/no-template-key': 'off',
        'vue/no-textarea-mustache': 'off',
        'vue/no-unused-components': 1,
        'vue/no-unused-vars': 1,
        'vue/require-component-is': 2,
        'vue/require-prop-type-constructor': 1,
        'vue/require-render-return': 2,
        'vue/require-valid-default-prop': 1,
        'vue/require-v-for-key': 1,
        'vue/return-in-computed-property': 1,
        'vue/use-v-on-exact': 'off',
        'vue/valid-template-root': 1,
        'vue/valid-v-bind': 2,
        'vue/valid-v-bind-sync': 1,
        'vue/valid-v-cloak': 'off',
        'vue/valid-v-else': 2,
        'vue/valid-v-else-if': 2,
        'vue/valid-v-for': 2,
        'vue/valid-v-html': 2,
        'vue/valid-v-if': 2,
        'vue/valid-v-model': 2,
        'vue/valid-v-on': 2,
        'vue/valid-v-once': 2,
        'vue/valid-v-pre': 2,
        'vue/valid-v-show': 1,
        'vue/valid-v-slot': 2,
        'vue/valid-v-text': 2,
        'vue/script-indent': [0, 2, { 'baseIndent': 0 }], // 暂时禁用以避免 babel-eslint 兼容性问题
        // Vue 格式化规则(禁用以避免 babel-eslint token 兼容性问题)
        // 'indent': 'off', // 禁用标准的 indent 规则,避免与 babel-eslint 兼容性问题
        'indent': [2, 2, {
          'SwitchCase': 0
        }],
        'object-curly-spacing': [2, 'always'], // 禁用以避免 babel-eslint token 兼容性问题
        'array-bracket-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'computed-property-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'key-spacing': [2, {
            'beforeColon': false,  // 冒号前不加空格
            'afterColon': true     // 冒号后加空格 ✅ 这个就是控制冒号后有空格的
          }], // 禁用以避免 babel-eslint token 兼容性问题
        'space-in-parens': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'space-before-blocks': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'space-before-function-paren': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'space-infix-ops': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'space-unary-ops': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'keyword-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'comma-spacing':  [2, {
            'before': false,
            'after': true      // 逗号后加空格:[1, 2, 3]
          }], // 禁用以避免 babel-eslint token 兼容性问题
        'brace-style': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'curly': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'semi-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'block-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'func-call-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'switch-colon-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'template-tag-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'arrow-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'generator-star-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'rest-spread-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'template-curly-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'yield-star-spacing': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'dot-location': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'object-curly-newline': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        'object-property-newline': 'off', // 禁用以避免 babel-eslint token 兼容性问题
        // 禁用 Vue 特定的格式化规则,避免 babel-eslint token 兼容性问题
        'vue/object-curly-spacing': [2, 'always'],
        'vue/array-bracket-spacing': 'off',
        'vue/comma-spacing': 'off',
        'vue/key-spacing': 'off',
        'vue/keyword-spacing': 'off',
        'vue/space-in-parens': 'off',
        'vue/space-before-blocks': 'off',
        'vue/space-before-function-paren': 'off',
        'vue/space-infix-ops': 'off',
        'vue/space-unary-ops': 'off',
        'vue/arrow-spacing': 'off',
        'vue/block-spacing': 'off',
        'vue/brace-style': 'off',
        'vue/comma-style': 'off',
        'vue/func-call-spacing': 'off',
        'vue/object-curly-newline': 'off',
        'vue/object-property-newline': 'off',
        'vue/operator-linebreak': 'off',
        'vue/template-curly-spacing': 'off',
        // Vue 自定义规则配置
        'vue/no-parsing-error': [2, {
          'abrupt-closing-of-empty-comment': true,
          'absence-of-digits-in-numeric-character-reference': true,
          'cdata-in-html-content': true,
          'character-reference-outside-unicode-range': true,
          'control-character-in-input-stream': true,
          'control-character-reference': true,
          'eof-before-tag-name': true,
          'eof-in-cdata': true,
          'eof-in-comment': true,
          'eof-in-tag': true,
          'incorrectly-closed-comment': true,
          'incorrectly-opened-comment': true,
          'invalid-first-character-of-tag-name': false, // 允许模板中的三元运算符,避免误报
          'missing-attribute-value': true,
          'missing-end-tag-name': true,
          'missing-semicolon-after-character-reference': true,
          'missing-whitespace-between-attributes': true,
          'nested-comment': true,
          'noncharacter-character-reference': true,
          'noncharacter-in-input-stream': true,
          'null-character-reference': true,
          'surrogate-character-reference': true,
          'surrogate-in-input-stream': true,
          'unexpected-character-in-attribute-name': true,
          'unexpected-character-in-unquoted-attribute-value': true,
          'unexpected-equals-sign-before-attribute-name': true,
          'unexpected-null-character': true,
          'unexpected-question-mark-instead-of-tag-name': true,
          'unexpected-solidus-in-tag': true,
          'unknown-named-character-reference': true,
          'end-tag-with-attributes': true,
          'duplicate-attribute': true,
          'end-tag-with-trailing-solidus': true,
          'non-void-html-element-start-tag-with-trailing-solidus': false,
          'x-invalid-end-tag': true,
          'x-invalid-namespace': true
        }],
        'vue/valid-template-root': 1,
        'vue/valid-v-show': 1,
        'vue/valid-v-if': 2,
        'vue/valid-v-else-if': 2,
        'vue/valid-v-else': 2,
        'vue/valid-v-model': 2,
        'vue/valid-v-for': 2,
        'vue/valid-v-html': 2,
        'vue/valid-v-text': 2,
        'vue/valid-v-bind': 2,
        'vue/valid-v-on': 2,
        'vue/valid-v-once': 2,
        'vue/valid-v-pre': 2,
        'vue/valid-v-slot': 2,
        'vue/html-indent': [2, 2], // 暂时禁用以避免 babel-eslint 兼容性问题
        'vue/script-indent': [0, 2, { 'baseIndent': 0 }], // 暂时禁用以避免 babel-eslint 兼容性问题
        'vue/html-self-closing': [2, {
          'html': {
            'void': 'never',
            'normal': 'always',
            'component': 'always'
          },
          'svg': 'always',
          'math': 'always'
        }],
        'vue/html-closing-bracket-spacing': [2, {
          'startTag': 'never',
          'endTag': 'never',
          'selfClosingTag': 'always'
        }],
        'vue/no-dupe-keys': [2, {
          'groups': []
        }],
        'vue/no-duplicate-attributes': [2, {
          'allowCoexistClass': true,
          'allowCoexistStyle': true
        }],
        'vue/no-reserved-keys': [2, {
          'reserved': [],
          'groups': []
        }],
        'vue/no-multi-spaces': [2, {
          'ignoreProperties': false
        }],
        'vue/no-spaces-around-equal-signs-in-attribute': [2],
        'vue/html-quotes': [2, 'double', { 'avoidEscape': false }],
        'vue/this-in-template': ['warn', 'never'],
        'vue/no-async-in-computed-properties': 1,
        'vue/component-tags-order': ['error', {
          'order': ['template', 'script', 'style']
        }],
        'vue/order-in-components': ['warn'],
        'vue/no-use-v-if-with-v-for': 1,
        'vue/require-component-is': 2,
        'vue/require-prop-type-constructor': 1,
        'vue/require-render-return': 2,
        'vue/require-v-for-key': 1,
        'vue/require-valid-default-prop': 1,
        'vue/return-in-computed-property': 1,
        'vue/no-unused-vars': 1,
        'vue/no-unused-components': 1,
        'vue/no-side-effects-in-computed-properties': 1,
        'vue/valid-v-bind-sync': 1,
        'vue/html-closing-bracket-newline': 2,
        'vue/html-end-tags': 2,
        'vue/require-default-prop': 1,
        'vue/v-bind-style': [2, 'shorthand'],
        'vue/v-on-style': [2, 'shorthand'],
        'vue/v-slot-style': [2, {
          'atComponent': 'v-slot',
          'default': 'v-slot',
          'named': 'shorthand'
        }],
        'vue/attributes-order': ['error', {
          'order': [
            'DEFINITION',
            'LIST_RENDERING',
            'CONDITIONALS',
            'RENDER_MODIFIERS',
            'GLOBAL',
            ['UNIQUE', 'SLOT'],
            'TWO_WAY_BINDING',
            'OTHER_DIRECTIVES',
            'OTHER_ATTR',
            'EVENTS',
            'CONTENT'
          ],
          'alphabetical': false
        }],
        'vue/camelcase': [1, { 'properties': 'always' }],
        'vue/comma-dangle': [2, 'never'],
        'vue/eqeqeq': [1, 'allow-null'],
        'vue/max-len': 'off', // 禁用以避免配置格式问题
        'vue/multiline-ternary': 0,
        'vue/no-console': 'off',
        'vue/no-empty-pattern': 2,
        'vue/no-irregular-whitespace': 1,
        'vue/no-restricted-syntax': [1, 'WithStatement', "BinaryExpression[operator='in']"],
        'vue/component-definition-name-casing': [1, 'kebab-case'],
        'vue/max-attributes-per-line': ['error', {
          'singleline': { 'max': 6 },
          'multiline': { 'max': 1 }
        }],
        'vue/singleline-html-element-content-newline': [0, {
          'ignoreWhenNoAttributes': true,
          'ignoreWhenEmpty': true,
          'ignores': ['pre', 'textarea', 'b', 'i', 'a', 'span']
        }]
      }
    },
    {
      files: ['script/**/*.js', 'build/**/*.ts', 'src/**/*.js', 'src/**/*.ts'],
      parser: 'babel-eslint',
      parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module'
      }
    }
  ]
};

 

posted on 2026-04-14 14:41  Tsunami黄嵩粟  阅读(5)  评论(0)    收藏  举报