|
| 1 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 2 | +import tsParser from '@typescript-eslint/parser'; |
| 3 | +import path from 'node:path'; |
| 4 | +import { fileURLToPath } from 'node:url'; |
| 5 | +import js from '@eslint/js'; |
| 6 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 7 | +import eslintPluginTSDoc from 'eslint-plugin-tsdoc'; |
| 8 | +import openWcConfig from '@open-wc/eslint-config'; |
| 9 | + |
| 10 | +const __filename = fileURLToPath(import.meta.url); |
| 11 | +const __dirname = path.dirname(__filename); |
| 12 | +const compat = new FlatCompat({ |
| 13 | + baseDirectory: __dirname, |
| 14 | + recommendedConfig: js.configs.recommended, |
| 15 | + allConfig: js.configs.all, |
| 16 | +}); |
| 17 | + |
| 18 | +export default [ |
| 19 | + ...openWcConfig, |
| 20 | + ...compat.extends( |
| 21 | + 'eslint:recommended', |
| 22 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 23 | + 'plugin:@typescript-eslint/recommended', |
| 24 | + ), |
| 25 | + { |
| 26 | + ignores: ['dist/', 'node_modules', 'coverage', 'doc'], |
| 27 | + }, |
| 28 | + |
| 29 | + { |
| 30 | + plugins: { |
| 31 | + '@typescript-eslint': typescriptEslint, |
| 32 | + 'eslint-plugin-tsdoc': eslintPluginTSDoc, |
| 33 | + }, |
| 34 | + |
| 35 | + languageOptions: { |
| 36 | + parser: tsParser, |
| 37 | + }, |
| 38 | + |
| 39 | + rules: { |
| 40 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 41 | + |
| 42 | + '@typescript-eslint/no-unused-vars': [ |
| 43 | + 'error', |
| 44 | + { |
| 45 | + args: 'all', |
| 46 | + argsIgnorePattern: '^_', |
| 47 | + caughtErrors: 'all', |
| 48 | + caughtErrorsIgnorePattern: '^_', |
| 49 | + destructuredArrayIgnorePattern: '^_', |
| 50 | + varsIgnorePattern: '^_', |
| 51 | + ignoreRestSiblings: true, |
| 52 | + }, |
| 53 | + ], |
| 54 | + 'no-use-before-define': 'off', |
| 55 | + 'class-methods-use-this': [ |
| 56 | + 'error', |
| 57 | + { |
| 58 | + exceptMethods: ['locale'], |
| 59 | + }, |
| 60 | + ], |
| 61 | + '@typescript-eslint/no-explicit-any': [ |
| 62 | + 'error', |
| 63 | + { |
| 64 | + ignoreRestArgs: true, |
| 65 | + }, |
| 66 | + ], |
| 67 | + 'import-x/no-extraneous-dependencies': [ |
| 68 | + 'error', |
| 69 | + { |
| 70 | + devDependencies: [ |
| 71 | + '**/*.test.ts', |
| 72 | + '**/*.spec.ts', |
| 73 | + 'eslint.config.js', |
| 74 | + 'web-test-runner.config.js', |
| 75 | + ], |
| 76 | + }, |
| 77 | + ], |
| 78 | + curly: ['error', 'all'], |
| 79 | + 'import-x/no-unresolved': 'off', |
| 80 | + 'import-x/extensions': [ |
| 81 | + 'error', |
| 82 | + 'always', |
| 83 | + { |
| 84 | + ignorePackages: true, |
| 85 | + }, |
| 86 | + ], |
| 87 | + }, |
| 88 | + }, |
| 89 | +]; |
0 commit comments