|
| 1 | +import pluginJs from '@eslint/js' |
| 2 | +import eslintConfigPrettier from 'eslint-config-prettier' |
| 3 | +import unusedImports from 'eslint-plugin-unused-imports' |
| 4 | +import pluginVue from 'eslint-plugin-vue' |
| 5 | +import { defineConfig } from 'eslint/config' |
| 6 | +import globals from 'globals' |
| 7 | +import { |
| 8 | + configs as tseslintConfigs, |
| 9 | + parser as tseslintParser |
| 10 | +} from 'typescript-eslint' |
| 11 | +import vueParser from 'vue-eslint-parser' |
| 12 | + |
| 13 | +const extraFileExtensions = ['.vue'] |
| 14 | + |
| 15 | +const commonParserOptions = { |
| 16 | + parser: tseslintParser, |
| 17 | + projectService: true, |
| 18 | + tsConfigRootDir: import.meta.dirname, |
| 19 | + ecmaVersion: 2020, |
| 20 | + sourceType: 'module', |
| 21 | + extraFileExtensions |
| 22 | +} as const |
| 23 | + |
| 24 | +export default defineConfig([ |
| 25 | + { |
| 26 | + ignores: ['out/*', 'dist/*', 'node_modules/*'] |
| 27 | + }, |
| 28 | + { |
| 29 | + files: ['./**/*.{ts,mts}'], |
| 30 | + languageOptions: { |
| 31 | + globals: { ...globals.node }, |
| 32 | + parserOptions: { |
| 33 | + ...commonParserOptions, |
| 34 | + projectService: { |
| 35 | + allowDefaultProject: ['electron.vite.config.ts', 'eslint.config.ts'] |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + }, |
| 40 | + { |
| 41 | + files: ['./**/*.vue'], |
| 42 | + languageOptions: { |
| 43 | + globals: { ...globals.browser }, |
| 44 | + parser: vueParser, |
| 45 | + parserOptions: commonParserOptions |
| 46 | + } |
| 47 | + }, |
| 48 | + pluginJs.configs.recommended, |
| 49 | + tseslintConfigs.recommended, |
| 50 | + pluginVue.configs['flat/recommended'], |
| 51 | + eslintConfigPrettier, |
| 52 | + { |
| 53 | + plugins: { |
| 54 | + 'unused-imports': unusedImports |
| 55 | + }, |
| 56 | + rules: { |
| 57 | + 'no-empty': ['error', { allowEmptyCatch: true }], |
| 58 | + '@typescript-eslint/no-explicit-any': 'off', |
| 59 | + '@typescript-eslint/no-unused-vars': 'off', |
| 60 | + '@typescript-eslint/consistent-type-imports': 'error', |
| 61 | + '@typescript-eslint/no-import-type-side-effects': 'error', |
| 62 | + '@typescript-eslint/no-empty-object-type': [ |
| 63 | + 'error', |
| 64 | + { allowInterfaces: 'always' } |
| 65 | + ], |
| 66 | + 'unused-imports/no-unused-imports': 'error', |
| 67 | + 'vue/no-v-html': 'off', |
| 68 | + 'vue/multi-word-component-names': 'off', |
| 69 | + 'vue/match-component-import-name': 'error', |
| 70 | + 'vue/no-unused-properties': 'error', |
| 71 | + 'vue/no-unused-refs': 'error', |
| 72 | + 'vue/no-useless-mustaches': 'error', |
| 73 | + 'vue/no-useless-v-bind': 'error', |
| 74 | + 'vue/no-unused-emit-declarations': 'error', |
| 75 | + 'vue/no-use-v-else-with-v-for': 'error', |
| 76 | + 'vue/one-component-per-file': 'error' |
| 77 | + } |
| 78 | + } |
| 79 | +]) |
0 commit comments