module.exports = {
  extends: [
    'alloy',
    'alloy/vue',
    'alloy/typescript',
    'plugin:@typescript-eslint/recommended',
    './.auto-import.json',
  ],
  parser: 'vue-eslint-parser',
  parserOptions: {
    parser: {
      js: '@babel/eslint-parser',
      jsx: '@babel/eslint-parser',
      ts: '@typescript-eslint/parser',
      tsx: '@typescript-eslint/parser',
    },
  },
  rules: {
    // 'vue/html-indent': ['error', 4],
    // 'vue/max-attributes-per-line': 'off',
    // 'vue/html-self-closing': 'off',
    // no-duplicate-attr-inheritance 禁止重复属性继承
    '@typescript-eslint/consistent-type-imports': 'off',
    '@typescript-eslint/consistent-type-assertions': 'off',
    '@typescript-eslint/prefer-optional-chain': 'off',
    '@typescript-eslint/explicit-member-accessibility': 'off',
    '@typescript-eslint/no-non-null-assertion': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
    '@typescript-eslint/no-unused-vars': 'off',
    '@typescript-eslint/consistent-type-definitions': 'off',
    '@typescript-eslint/method-signature-style': 'off',
    'no-return-assign': 'off',
    'guard-for-in': 'off',
    'vue/custom-event-name-casing': 'off',
    'vue/no-duplicate-attributes': 'off',
    'no-param-reassign': 'off',

    'vue/no-setup-props-destructure': 'off',
    'vue/no-duplicate-attr-inheritance': 'off',
    'vue/prefer-true-attribute-shorthand': 'off',
    'no-eq-null': 'off', // 允许 == 用于 null

    'vue/v-on-event-hyphenation': 'off', // 关闭 vue 中 @ 使用短横线命名
    'vue/require-toggle-inside-transition': 'off',
    'no-duplicate-imports': 'off', // 使用ts-eslint的重复导入规则
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'vue/multi-word-component-names': 'off',
    'max-params': ['error', { max: 4 }],
    // 圈复杂度 每个函数的最高圈复杂度
    complexity: [
      'error',
      {
        max: 30,
      },
    ],
  },
  globals: {
    defineProps: 'readonly',
    defineEmits: 'readonly',
    defineExpose: 'readonly',
    withDefaults: 'readonly',
    anyObj: true,
    __VERSION__: true,
  },
  plugins: ['@typescript-eslint'],
}
