|
| 1 | +import angularEslintPlugin from '@angular-eslint/eslint-plugin'; |
| 2 | +import angularEslintTemplate from '@angular-eslint/eslint-plugin-template'; |
| 3 | +import parser from '@angular-eslint/template-parser'; |
| 4 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 5 | +import js from '@eslint/js'; |
| 6 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 7 | +import tsParser from '@typescript-eslint/parser'; |
| 8 | +import globals from 'globals'; |
| 9 | +import path from 'node:path'; |
| 10 | +import { fileURLToPath } from 'node:url'; |
| 11 | + |
| 12 | +const __filename = fileURLToPath(import.meta.url); |
| 13 | +const __dirname = path.dirname(__filename); |
| 14 | +const compat = new FlatCompat({ |
| 15 | + baseDirectory: __dirname, |
| 16 | + recommendedConfig: js.configs.recommended, |
| 17 | + allConfig: js.configs.all, |
| 18 | +}); |
| 19 | + |
| 20 | +export default [ |
| 21 | + { |
| 22 | + ignores: ['**/*.worker.ts'], |
| 23 | + }, |
| 24 | + { |
| 25 | + languageOptions: { |
| 26 | + globals: { |
| 27 | + ...globals.browser, |
| 28 | + ...globals.node, |
| 29 | + }, |
| 30 | + }, |
| 31 | + }, |
| 32 | + ...compat |
| 33 | + .extends( |
| 34 | + 'eslint:recommended', |
| 35 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 36 | + 'plugin:@typescript-eslint/recommended', |
| 37 | + 'plugin:@typescript-eslint/recommended-requiring-type-checking' |
| 38 | + ) |
| 39 | + .map((config) => ({ |
| 40 | + ...config, |
| 41 | + files: ['**/*.ts'], |
| 42 | + })), |
| 43 | + { |
| 44 | + files: ['**/*.ts'], |
| 45 | + plugins: { |
| 46 | + '@typescript-eslint': typescriptEslint, |
| 47 | + '@angular-eslint': angularEslintPlugin, |
| 48 | + }, |
| 49 | + languageOptions: { |
| 50 | + parser: tsParser, |
| 51 | + ecmaVersion: 10, |
| 52 | + sourceType: 'module', |
| 53 | + |
| 54 | + parserOptions: { |
| 55 | + project: [ |
| 56 | + './tsconfig.serve.json', |
| 57 | + './src/tsconfig.app.json', |
| 58 | + './src/tsconfig.spec.json', |
| 59 | + './e2e/tsconfig.e2e.json', |
| 60 | + ], |
| 61 | + |
| 62 | + ecmaFeatures: { |
| 63 | + modules: true, |
| 64 | + }, |
| 65 | + }, |
| 66 | + }, |
| 67 | + rules: { |
| 68 | + '@typescript-eslint/indent': 0, |
| 69 | + 'no-unused-vars': 'off', |
| 70 | + '@typescript-eslint/no-unused-vars': ['error'], |
| 71 | + '@typescript-eslint/no-empty-function': 0, |
| 72 | + '@typescript-eslint/no-unsafe-argument': 0, |
| 73 | + '@typescript-eslint/no-var-requires': 0, |
| 74 | + '@typescript-eslint/no-explicit-any': 0, |
| 75 | + '@typescript-eslint/no-unsafe-call': 0, |
| 76 | + '@typescript-eslint/no-unsafe-member-access': 0, |
| 77 | + '@typescript-eslint/no-unsafe-assignment': 0, |
| 78 | + '@typescript-eslint/no-unsafe-return': 0, |
| 79 | + '@typescript-eslint/no-floating-promises': 0, |
| 80 | + '@typescript-eslint/unbound-method': ['off'], |
| 81 | + '@angular-eslint/use-injectable-provided-in': 'error', |
| 82 | + '@angular-eslint/no-attribute-decorator': 'error', |
| 83 | + '@typescript-eslint/no-require-imports': 'warn', |
| 84 | + }, |
| 85 | + }, |
| 86 | + { |
| 87 | + files: ['**/*.component.html'], |
| 88 | + plugins: { |
| 89 | + '@angular-eslint/template': angularEslintTemplate, |
| 90 | + }, |
| 91 | + languageOptions: { |
| 92 | + parser: parser, |
| 93 | + }, |
| 94 | + rules: { |
| 95 | + '@angular-eslint/template/banana-in-box': 'error', |
| 96 | + '@angular-eslint/template/no-negated-async': 'error', |
| 97 | + }, |
| 98 | + }, |
| 99 | +]; |
0 commit comments