|
1 | | -// @ts-check |
2 | | - |
3 | | -const OFF = 'off'; |
4 | | -const ERROR = 'error'; |
5 | | -const WARN = 'warn'; |
6 | | - |
7 | | -/** @type {import('eslint').ESLint.ConfigData} */ |
8 | 1 | module.exports = { |
9 | | - root: true, |
| 2 | + plugins: [ |
| 3 | + '@typescript-eslint', |
| 4 | + ], |
| 5 | + |
10 | 6 | env: { |
11 | 7 | node: true, |
12 | 8 | }, |
13 | | - settings: { |
14 | | - 'import/resolver': { |
15 | | - typescript: { |
16 | | - alwaysTryTypes: true, |
17 | | - }, |
18 | | - }, |
19 | | - }, |
20 | | - plugins: ['import'], |
21 | 9 | extends: [ |
22 | | - 'plugin:node/recommended', |
23 | | - 'plugin:prettier/recommended', |
24 | | - 'plugin:import/recommended', |
| 10 | + 'airbnb-base', |
25 | 11 | ], |
26 | | - rules: { |
27 | | - 'no-console': WARN, |
28 | | - 'no-debugger': WARN, |
29 | | - 'max-len': [ |
30 | | - ERROR, |
31 | | - 120, |
32 | | - 4, |
33 | | - { |
34 | | - ignoreComments: true, |
35 | | - ignoreUrls: true, |
36 | | - ignoreStrings: true, |
37 | | - ignoreTemplateLiterals: true, |
38 | | - ignoreRegExpLiterals: true, |
39 | | - }, |
40 | | - ], |
41 | | - curly: ERROR, |
42 | | - 'no-implicit-coercion': ERROR, |
43 | | - 'no-else-return': ERROR, |
44 | | - 'no-duplicate-imports': [ERROR, { includeExports: true }], |
45 | | - 'import/first': ERROR, |
46 | | - 'import/no-mutable-exports': ERROR, |
47 | | - 'import/no-self-import': ERROR, |
48 | | - 'import/no-named-default': ERROR, |
49 | | - 'import/no-relative-packages': ERROR, |
50 | | - 'import/no-unresolved': OFF, |
51 | | - 'import/order': [ |
52 | | - ERROR, |
53 | | - { |
54 | | - 'newlines-between': 'always', |
55 | | - pathGroups: [ |
56 | | - { pattern: '@nestjs/**', group: 'builtin', position: 'after' }, |
57 | | - ], |
58 | | - groups: [ |
59 | | - ['builtin', 'external'], |
60 | | - 'internal', |
61 | | - 'parent', |
62 | | - 'sibling', |
63 | | - 'type', |
64 | | - 'index', |
65 | | - 'object', |
66 | | - ], |
67 | | - pathGroupsExcludedImportTypes: ['builtin'], |
68 | | - alphabetize: { |
69 | | - order: 'asc', |
70 | | - caseInsensitive: false, |
71 | | - }, |
72 | | - }, |
73 | | - ], |
74 | | - 'import/no-cycle': OFF, |
75 | | - 'node/no-unsupported-features/es-syntax': OFF, |
76 | | - 'node/no-missing-import': OFF, |
77 | | - 'node/no-unpublished-import': OFF, |
78 | | - 'node/no-extraneous-import': OFF, |
79 | | - }, |
| 12 | + parser: '@typescript-eslint/parser', |
| 13 | + rules: {}, |
80 | 14 | overrides: [ |
81 | 15 | { |
82 | | - parser: '@typescript-eslint/parser', |
83 | | - files: ['*.ts', '*.tsx'], |
84 | | - plugins: ['@typescript-eslint/eslint-plugin'], |
85 | 16 | extends: [ |
| 17 | + 'airbnb-typescript/base', |
86 | 18 | 'plugin:@typescript-eslint/recommended', |
87 | | - 'plugin:import/typescript', |
| 19 | + 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
88 | 20 | ], |
89 | 21 | parserOptions: { |
90 | | - ecmaVersion: 2022, |
91 | | - project: 'tsconfig.json', |
| 22 | + parser: '@typescript-eslint/parser', |
| 23 | + project: './tsconfig.json', |
92 | 24 | tsconfigRootDir: __dirname, |
93 | | - sourceType: 'module', |
94 | 25 | }, |
95 | | - rules: { |
96 | | - '@typescript-eslint/no-empty-function': [ |
97 | | - ERROR, |
98 | | - { |
99 | | - allow: ['arrowFunctions'], |
100 | | - }, |
101 | | - ], |
102 | | - '@typescript-eslint/no-explicit-any': OFF, |
103 | | - '@typescript-eslint/no-unused-vars': [ |
104 | | - ERROR, |
105 | | - { |
106 | | - vars: 'local', |
107 | | - ignoreRestSiblings: false, |
108 | | - argsIgnorePattern: '^_', |
109 | | - }, |
110 | | - ], |
111 | | - '@typescript-eslint/ban-ts-comment': [ |
112 | | - 'error', |
113 | | - { |
114 | | - 'ts-expect-error': 'allow-with-description', |
115 | | - 'ts-ignore': true, |
116 | | - 'ts-nocheck': true, |
117 | | - 'ts-check': false, |
118 | | - minimumDescriptionLength: 5, |
119 | | - }, |
120 | | - ], |
121 | | - '@typescript-eslint/member-ordering': [ |
122 | | - ERROR, |
123 | | - { |
124 | | - default: [ |
125 | | - 'static-field', |
126 | | - 'static-get', |
127 | | - 'static-set', |
128 | | - 'static-method', |
129 | | - 'protected-decorated-field', |
130 | | - 'private-decorated-field', |
131 | | - 'public-decorated-field', |
132 | | - 'protected-instance-field', |
133 | | - 'private-instance-field', |
134 | | - 'public-instance-field', |
135 | | - 'constructor', |
136 | | - 'instance-field', |
137 | | - 'abstract-field', |
138 | | - 'instance-get', |
139 | | - 'abstract-get', |
140 | | - 'instance-set', |
141 | | - 'abstract-set', |
142 | | - 'instance-method', |
143 | | - 'protected-instance-method', |
144 | | - 'private-instance-method', |
145 | | - 'abstract-method', |
146 | | - ], |
147 | | - }, |
148 | | - ], |
149 | | - '@typescript-eslint/array-type': [ |
150 | | - ERROR, |
151 | | - { default: 'generic', readonly: 'generic' }, |
152 | | - ], |
153 | | - '@typescript-eslint/no-base-to-string': ERROR, |
154 | | - '@typescript-eslint/prefer-regexp-exec': ERROR, |
155 | | - '@typescript-eslint/consistent-generic-constructors': ERROR, |
156 | | - '@typescript-eslint/prefer-nullish-coalescing': ERROR, |
157 | | - '@typescript-eslint/prefer-optional-chain': ERROR, |
158 | | - '@typescript-eslint/no-unsafe-declaration-merging': OFF, |
159 | | - 'no-return-await': OFF, |
160 | | - '@typescript-eslint/return-await': [ERROR, 'always'], |
161 | | - }, |
162 | | - }, |
163 | | - { |
164 | | - files: ['*rc.js', '*.config.js'], |
| 26 | + files: ['*.ts', '*tsx'], |
165 | 27 | rules: {}, |
166 | 28 | }, |
167 | 29 | ], |
|
0 commit comments