|
| 1 | +import tsPlugin from '@typescript-eslint/eslint-plugin' |
| 2 | +import tsParser from '@typescript-eslint/parser' |
| 3 | +import vuePlugin from 'eslint-plugin-vue' |
| 4 | +import vitestPlugin from '@vitest/eslint-plugin' |
| 5 | + |
| 6 | +export default [ |
| 7 | + // Global ignores (replaces --ignore-path .gitignore) |
| 8 | + { |
| 9 | + ignores: [ |
| 10 | + 'node_modules/**', |
| 11 | + '**/*.log*', |
| 12 | + '.nuxt/**', |
| 13 | + '.nitro/**', |
| 14 | + '.cache/**', |
| 15 | + '.output/**', |
| 16 | + '.env', |
| 17 | + '.data/**', |
| 18 | + 'dist/**', |
| 19 | + 'coverage/**', |
| 20 | + '.eslintcache', |
| 21 | + ], |
| 22 | + }, |
| 23 | + |
| 24 | + // Vue flat config (sets up vue-eslint-parser + vue rules for .vue files) |
| 25 | + ...vuePlugin.configs['flat/essential'], |
| 26 | + |
| 27 | + // JS / TS files: use TypeScript parser directly (vue-eslint-parser is overridden here) |
| 28 | + { |
| 29 | + files: ['**/*.{js,ts}'], |
| 30 | + languageOptions: { |
| 31 | + parser: tsParser, |
| 32 | + parserOptions: { |
| 33 | + sourceType: 'module', |
| 34 | + ecmaVersion: 'latest', |
| 35 | + }, |
| 36 | + }, |
| 37 | + }, |
| 38 | + |
| 39 | + // JS / TS / Vue files config |
| 40 | + { |
| 41 | + files: ['**/*.{js,ts,vue}'], |
| 42 | + plugins: { |
| 43 | + '@typescript-eslint': tsPlugin, |
| 44 | + }, |
| 45 | + languageOptions: { |
| 46 | + parserOptions: { |
| 47 | + // TypeScript parser delegated from vue-eslint-parser for <script> blocks |
| 48 | + parser: tsParser, |
| 49 | + sourceType: 'module', |
| 50 | + ecmaVersion: 'latest', |
| 51 | + ecmaFeatures: { jsx: true }, |
| 52 | + }, |
| 53 | + globals: { |
| 54 | + // Browser |
| 55 | + window: 'readonly', |
| 56 | + document: 'readonly', |
| 57 | + navigator: 'readonly', |
| 58 | + console: 'readonly', |
| 59 | + setTimeout: 'readonly', |
| 60 | + clearTimeout: 'readonly', |
| 61 | + setInterval: 'readonly', |
| 62 | + clearInterval: 'readonly', |
| 63 | + fetch: 'readonly', |
| 64 | + URL: 'readonly', |
| 65 | + URLSearchParams: 'readonly', |
| 66 | + // Node |
| 67 | + process: 'readonly', |
| 68 | + __dirname: 'readonly', |
| 69 | + __filename: 'readonly', |
| 70 | + require: 'readonly', |
| 71 | + module: 'readonly', |
| 72 | + exports: 'readonly', |
| 73 | + }, |
| 74 | + }, |
| 75 | + rules: { |
| 76 | + // TypeScript recommended rules |
| 77 | + ...tsPlugin.configs.recommended.rules, |
| 78 | + |
| 79 | + // TypeScript overrides (equivalent to @nuxtjs/eslint-config-typescript) |
| 80 | + '@typescript-eslint/no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }], |
| 81 | + 'no-unused-vars': 'off', |
| 82 | + 'no-undef': 'off', |
| 83 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 84 | + '@typescript-eslint/consistent-indexed-object-style': 'off', |
| 85 | + '@typescript-eslint/naming-convention': 'off', |
| 86 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 87 | + '@typescript-eslint/explicit-member-accessibility': 'off', |
| 88 | + '@typescript-eslint/no-explicit-any': 'off', |
| 89 | + '@typescript-eslint/no-empty-interface': 'off', |
| 90 | + |
| 91 | + // Project-specific overrides |
| 92 | + 'vue/multi-word-component-names': 'off', |
| 93 | + 'vue/no-v-html': 'off', |
| 94 | + }, |
| 95 | + }, |
| 96 | + |
| 97 | + // Vitest test files |
| 98 | + { |
| 99 | + files: ['**/*.test.{js,ts}', '**/*.spec.{js,ts}'], |
| 100 | + plugins: { |
| 101 | + vitest: vitestPlugin, |
| 102 | + }, |
| 103 | + rules: { |
| 104 | + ...vitestPlugin.configs.recommended.rules, |
| 105 | + }, |
| 106 | + }, |
| 107 | +] |
0 commit comments