|
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + browser: true, |
| 4 | + es2021: true, |
| 5 | + }, |
| 6 | + parser: 'vue-eslint-parser', |
| 7 | + extends: [ |
| 8 | + 'plugin:@typescript-eslint/recommended', |
| 9 | + 'plugin:vue/vue3-essential', |
| 10 | + 'prettier', |
| 11 | + ], |
| 12 | + parserOptions: { |
| 13 | + ecmaVersion: 'latest', |
| 14 | + parser: '@typescript-eslint/parser', |
| 15 | + sourceType: 'module', |
| 16 | + }, |
| 17 | + settings: { |
| 18 | + 'import/resolver': { |
| 19 | + alias: { |
| 20 | + map: [['@', './src']], |
| 21 | + extensions: ['.ts', '.js', '.jsx', '.json', '.vue'], |
| 22 | + }, |
| 23 | + }, |
| 24 | + }, |
| 25 | + plugins: ['vue', '@typescript-eslint', 'prettier'], |
| 26 | + rules: { |
| 27 | + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| 28 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| 29 | + 'no-var': 'error', |
| 30 | + 'prettier/prettier': 'error', |
| 31 | + 'vue/no-multiple-template-root': 'off', |
| 32 | + 'no-mutating-props': 'off', |
| 33 | + 'vue/no-v-html': 'off', |
| 34 | + // @fixable 必须使用单引号,禁止使用双引号 |
| 35 | + quotes: [ |
| 36 | + 'error', |
| 37 | + 'single', |
| 38 | + { |
| 39 | + avoidEscape: true, |
| 40 | + allowTemplateLiterals: true, |
| 41 | + }, |
| 42 | + ], |
| 43 | + // 结尾必须有分号; |
| 44 | + semi: [ |
| 45 | + 'error', |
| 46 | + 'always', |
| 47 | + { |
| 48 | + omitLastInOneLineBlock: true, |
| 49 | + }, |
| 50 | + ], |
| 51 | + 'vue/script-setup-uses-vars': 'error', |
| 52 | + '@typescript-eslint/ban-ts-ignore': 'off', |
| 53 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 54 | + '@typescript-eslint/no-explicit-any': 'off', |
| 55 | + '@typescript-eslint/no-var-requires': 'off', |
| 56 | + '@typescript-eslint/no-empty-function': 'off', |
| 57 | + 'vue/custom-event-name-casing': 'off', |
| 58 | + 'no-use-before-define': 'off', |
| 59 | + '@typescript-eslint/no-use-before-define': 'off', |
| 60 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 61 | + '@typescript-eslint/ban-types': 'off', |
| 62 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 63 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 64 | + '@typescript-eslint/no-unused-vars': [ |
| 65 | + 'warn', |
| 66 | + { |
| 67 | + argsIgnorePattern: '^_', |
| 68 | + varsIgnorePattern: '^_', |
| 69 | + }, |
| 70 | + ], |
| 71 | + 'no-unused-vars': [ |
| 72 | + 'warn', |
| 73 | + { |
| 74 | + argsIgnorePattern: '^_', |
| 75 | + varsIgnorePattern: '^_', |
| 76 | + }, |
| 77 | + ], |
| 78 | + 'space-before-function-paren': 'off', |
| 79 | + 'vue/attributes-order': 'off', |
| 80 | + 'vue/v-on-event-hyphenation': 'off', |
| 81 | + 'vue/multi-word-component-names': 'off', |
| 82 | + 'vue/one-component-per-file': 'off', |
| 83 | + 'vue/html-closing-bracket-newline': 'off', |
| 84 | + 'vue/max-attributes-per-line': 'off', |
| 85 | + 'vue/multiline-html-element-content-newline': 'off', |
| 86 | + 'vue/singleline-html-element-content-newline': 'off', |
| 87 | + 'vue/attribute-hyphenation': 'off', |
| 88 | + 'vue/require-default-prop': 'off', |
| 89 | + }, |
| 90 | + globals: { |
| 91 | + defineProps: 'readonly', |
| 92 | + defineEmits: 'readonly', |
| 93 | + defineExpose: 'readonly', |
| 94 | + withDefaults: 'readonly', |
| 95 | + uni: 'readonly', |
| 96 | + }, |
| 97 | +}; |
0 commit comments