|
| 1 | +const tsParser = require('@typescript-eslint/parser'); |
| 2 | +const js = require('@eslint/js'); |
| 3 | +const globals = require('globals'); |
| 4 | +const ts = require('@typescript-eslint/eslint-plugin'); |
| 5 | +const ng = require('@angular-eslint/eslint-plugin'); |
| 6 | +const esImport = require('eslint-plugin-import'); |
| 7 | + |
| 8 | +module.exports = [ |
| 9 | + { |
| 10 | + files: ['**/*.ts'], |
| 11 | + plugins: { |
| 12 | + '@typescript-eslint': ts, |
| 13 | + '@angular-eslint': ng, |
| 14 | + import: esImport, |
| 15 | + }, |
| 16 | + languageOptions: { |
| 17 | + parser: tsParser, |
| 18 | + globals: { |
| 19 | + ...globals.browser, |
| 20 | + }, |
| 21 | + parserOptions: { |
| 22 | + project: ['tsconfig.build.json', 'tsconfig.json', 'tsconfig.spec.json'], |
| 23 | + }, |
| 24 | + }, |
| 25 | + rules: { |
| 26 | + ...js.configs.recommended.rules, |
| 27 | + ...ts.configs['recommended-requiring-type-checking'].rules, |
| 28 | + ...ts.configs['stylistic-type-checked'].rules, |
| 29 | + ...ng.configs.recommended.rules, |
| 30 | + ...esImport.configs.errors.rules, |
| 31 | + // eslint/js rules |
| 32 | + 'no-undef': 'off', |
| 33 | + 'no-redeclare': 'off', |
| 34 | + 'prefer-arrow-callback': 'error', |
| 35 | + 'curly': 'error', |
| 36 | + 'no-dupe-class-members': 'off', |
| 37 | + "no-restricted-imports": ["error", "rxjs/Rx"], |
| 38 | + "no-console": ["error", {allow: ['log', 'error', 'warn']}], |
| 39 | + 'sort-imports': [ |
| 40 | + 'error', |
| 41 | + { |
| 42 | + ignoreDeclarationSort: true, |
| 43 | + }, |
| 44 | + ], |
| 45 | + // @typescript-eslint rules |
| 46 | + '@typescript-eslint/prefer-nullish-coalescing': 'off', // require `strictNullChecks` |
| 47 | + '@typescript-eslint/no-explicit-any': 'off', |
| 48 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 49 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 50 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 51 | + '@typescript-eslint/no-unsafe-return': 'off', |
| 52 | + '@typescript-eslint/no-unsafe-declaration-merging': 'off', |
| 53 | + '@typescript-eslint/no-unsafe-argument': 'off', |
| 54 | + '@typescript-eslint/no-floating-promises': 'off', |
| 55 | + '@typescript-eslint/no-unnecessary-type-assertion': 'off', |
| 56 | + '@typescript-eslint/no-redundant-type-constituents': 'off', // causing pipeline error in src/compat/firestore/utils.spec.ts |
| 57 | + '@typescript-eslint/no-non-null-assertion': 'error', |
| 58 | + "@typescript-eslint/member-ordering": ["error", { |
| 59 | + "default": [ |
| 60 | + "static-field", |
| 61 | + "instance-field", |
| 62 | + "static-method", |
| 63 | + "instance-method" |
| 64 | + ] |
| 65 | + }], |
| 66 | + '@typescript-eslint/no-unused-vars': [ |
| 67 | + 'error', {args: "after-used", "argsIgnorePattern": "^_"} |
| 68 | + ], |
| 69 | + // @angular-eslint rules |
| 70 | + '@angular-eslint/directive-selector': [ |
| 71 | + 'error', |
| 72 | + { |
| 73 | + type: 'attribute', |
| 74 | + prefix: 'app', |
| 75 | + style: 'camelCase', |
| 76 | + }, |
| 77 | + ], |
| 78 | + '@angular-eslint/component-selector': [ |
| 79 | + 'error', |
| 80 | + { |
| 81 | + type: 'element', |
| 82 | + prefix: 'app', |
| 83 | + style: 'kebab-case', |
| 84 | + }, |
| 85 | + ], |
| 86 | + // import rules |
| 87 | + 'import/no-unresolved': 'off', |
| 88 | + 'import/namespace': 'off', |
| 89 | + 'import/default': 'off', |
| 90 | + 'import/export': 'off', |
| 91 | + 'import/newline-after-import': 'error', |
| 92 | + 'import/order': [ |
| 93 | + 'error', |
| 94 | + { |
| 95 | + alphabetize: {order: 'asc'}, |
| 96 | + "newlines-between": "never" |
| 97 | + }, |
| 98 | + ], |
| 99 | + }, |
| 100 | + }, |
| 101 | + { |
| 102 | + files: ['**/*.spec.ts'], |
| 103 | + languageOptions: { |
| 104 | + globals: { |
| 105 | + ...globals.jasmine, |
| 106 | + }, |
| 107 | + }, |
| 108 | + }, |
| 109 | +]; |
0 commit comments