|
1 | | -import globals from 'globals' |
2 | | -import typescriptLint from 'typescript-eslint'; |
3 | | -import pluginVue from 'eslint-plugin-vue' |
| 1 | +import js from '@eslint/js'; |
| 2 | +import globals from 'globals'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import pluginVue from 'eslint-plugin-vue'; |
| 5 | +import prettierConfig from 'eslint-config-prettier'; |
4 | 6 |
|
5 | | -export default typescriptLint.config({ |
6 | | - files: [ |
7 | | - 'src/**/*.{ts,vue,js,tsx,jsx}' |
8 | | - ], |
| 7 | +/** @type {import('eslint').Linter.Config[]} */ |
| 8 | +export default tseslint.config( |
| 9 | + { |
| 10 | + ignores: [ |
| 11 | + '**/dist/**', |
| 12 | + '**/node_modules/**', |
| 13 | + '**/public/**', |
| 14 | + 'src/sitemap/sitemap.js', |
| 15 | + 'src/env.d.ts', |
| 16 | + ], |
| 17 | + }, |
| 18 | + |
| 19 | + ...pluginVue.configs['flat/recommended'], |
9 | 20 |
|
10 | | - extends: [ |
11 | | - ...typescriptLint.configs.recommended, |
12 | | - ...pluginVue.configs['flat/recommended'], |
13 | | - ], |
| 21 | + /** |
| 22 | + * The TypeScript lint settings |
| 23 | + */ |
| 24 | + { |
| 25 | + files: ['**/*.ts', '**/*.tsx'], |
| 26 | + extends: [ |
| 27 | + ...tseslint.configs.recommendedTypeChecked, |
| 28 | + ...tseslint.configs.stylisticTypeChecked, |
| 29 | + ], |
| 30 | + languageOptions: { |
| 31 | + parserOptions: { |
| 32 | + projectService: true, |
| 33 | + tsconfigRootDir: import.meta.dirname, |
| 34 | + }, |
| 35 | + }, |
| 36 | + }, |
| 37 | + |
| 38 | + /** |
| 39 | + * These are the Vue lint settings |
| 40 | + */ |
| 41 | + { |
| 42 | + files: ['**/*.vue'], |
| 43 | + plugins: { |
| 44 | + vue: pluginVue, |
| 45 | + }, |
| 46 | + languageOptions: { |
| 47 | + parser: pluginVue.parser, |
| 48 | + parserOptions: { |
| 49 | + parser: tseslint.parser, |
| 50 | + extraFileExtensions: ['.vue'], |
| 51 | + sourceType: 'module', |
| 52 | + } |
| 53 | + }, |
| 54 | + }, |
14 | 55 |
|
15 | | - rules: { |
16 | | - // override/add rules settings here, such as: |
17 | | - // 'vue/no-unused-vars': 'error' |
| 56 | + /** |
| 57 | + * The global variables and language options |
| 58 | + */ |
| 59 | + { |
| 60 | + languageOptions: { |
| 61 | + globals: { |
| 62 | + ...globals.browser, |
| 63 | + ...globals.node, |
| 64 | + }, |
| 65 | + }, |
18 | 66 | }, |
19 | | - languageOptions: { |
20 | | - sourceType: 'module', |
21 | | - globals: { |
22 | | - ...globals.browser |
23 | | - } |
| 67 | + { |
| 68 | + rules: { |
| 69 | + 'vue/no-v-html': [ |
| 70 | + 'error', |
| 71 | + { |
| 72 | + ignorePattern: '^sanitizedHtml', |
| 73 | + }, |
| 74 | + ], |
| 75 | + // '@typescript-eslint/no-explicit-any': 'warn', |
| 76 | + // 'no-unused-vars': 'off', |
| 77 | + // '@typescript-eslint/no-unused-vars': [ |
| 78 | + // 'warn', |
| 79 | + // { |
| 80 | + // argsIgnorePattern: '^_', |
| 81 | + // varsIgnorePattern: '^_', |
| 82 | + // }, |
| 83 | + // ], |
| 84 | + // '@typescript-eslint/no-unsafe-assignment': 'warn', |
| 85 | + // '@typescript-eslint/no-unsafe-member-access': 'warn', |
| 86 | + // '@typescript-eslint/no-unsafe-call': 'warn', |
| 87 | + // '@typescript-eslint/no-unsafe-return': 'warn', |
| 88 | + // '@typescript-eslint/no-floating-promises': 'warn', |
| 89 | + // '@typescript-eslint/await-thenable': 'warn', |
| 90 | + // '@typescript-eslint/no-unsafe-argument': 'warn', |
| 91 | + } |
24 | 92 | }, |
25 | | -}) |
| 93 | + prettierConfig, |
| 94 | +); |
0 commit comments