|
1 | 1 | // @ts-check
|
2 |
| -import { createConfigForNuxt } from '@nuxt/eslint-config/flat' |
3 |
| - |
4 |
| -// Run `npx @eslint/config-inspector` to inspect the resolved config interactively |
5 |
| -export default createConfigForNuxt({ |
6 |
| - features: { |
7 |
| - // Rules for module authors |
8 |
| - tooling: true, |
9 |
| - // Rules for formatting |
10 |
| - stylistic: true, |
| 2 | +import antfu from '@antfu/eslint-config' |
| 3 | + |
| 4 | +export default antfu({ |
| 5 | + // Type of the project |
| 6 | + typescript: true, |
| 7 | + vue: true, |
| 8 | + |
| 9 | + // Enable stylistic formatting rules |
| 10 | + stylistic: { |
| 11 | + indent: 2, |
| 12 | + quotes: 'single', |
| 13 | + semi: false, |
11 | 14 | },
|
12 |
| - dirs: { |
13 |
| - src: [ |
14 |
| - './src', |
15 |
| - './playground', |
16 |
| - './test', |
17 |
| - ], |
| 15 | + |
| 16 | + // Customize rules |
| 17 | + rules: { |
| 18 | + // Allow console.warn and console.error |
| 19 | + 'no-console': ['warn', { allow: ['warn', 'error'] }], |
| 20 | + |
| 21 | + // TypeScript |
| 22 | + 'ts/no-explicit-any': 'warn', |
| 23 | + 'ts/no-unused-vars': ['error', { |
| 24 | + argsIgnorePattern: '^_', |
| 25 | + varsIgnorePattern: '^_', |
| 26 | + }], |
| 27 | + |
| 28 | + // Node/Process - we're in a browser environment primarily |
| 29 | + 'node/prefer-global/process': 'off', |
| 30 | + 'no-restricted-globals': 'off', // Allow 'global' in test files |
| 31 | + |
| 32 | + // Allow assignment in conditions when intentional |
| 33 | + 'no-cond-assign': ['error', 'except-parens'], |
| 34 | + |
| 35 | + // Allow function hoisting |
| 36 | + 'ts/no-use-before-define': ['error', { functions: false }], |
| 37 | + |
| 38 | + // Vue/Nuxt specific |
| 39 | + 'vue/multi-word-component-names': 'off', |
| 40 | + |
| 41 | + // Style preferences for this project |
| 42 | + 'style/brace-style': ['error', '1tbs'], |
| 43 | + 'style/arrow-parens': ['error', 'always'], |
| 44 | + |
| 45 | + // JSON sorting - not critical |
| 46 | + 'jsonc/sort-keys': 'off', |
18 | 47 | },
|
| 48 | + |
| 49 | + // Files to ignore |
| 50 | + ignores: [ |
| 51 | + '**/dist', |
| 52 | + '**/node_modules', |
| 53 | + '**/.nuxt', |
| 54 | + '**/coverage', |
| 55 | + '**/playground/.nuxt', |
| 56 | + '**/playground/.output', |
| 57 | + '**/*.md', |
| 58 | + ], |
19 | 59 | })
|
20 |
| - .append({ |
21 |
| - rules: { |
22 |
| - // Allow console in playground and tests |
23 |
| - 'no-console': ['warn', { allow: ['warn', 'error'] }], |
24 |
| - // TypeScript specific |
25 |
| - '@typescript-eslint/no-explicit-any': 'warn', |
26 |
| - '@typescript-eslint/no-unused-vars': ['error', { |
27 |
| - argsIgnorePattern: '^_', |
28 |
| - varsIgnorePattern: '^_', |
29 |
| - }], |
30 |
| - }, |
31 |
| - }) |
|
0 commit comments