@tinkoff/eslint-config 5.0.1 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +92 -96
- package/app.js +2 -6
- package/errors/index.js +16 -13
- package/index.js +24 -14
- package/internal/base.js +89 -78
- package/internal/import.js +40 -29
- package/internal/prettier.js +16 -3
- package/internal/promise.js +11 -8
- package/internal/sort-class-members.js +57 -54
- package/internal/test-files.js +14 -16
- package/internal/typescript.js +170 -157
- package/jest.js +18 -17
- package/lib.js +11 -10
- package/package.json +26 -14
- package/test/import/import-happy.test.js +15 -11
- package/test/import/import-unhappy.test.js +15 -11
- package/test/index.test.js +26 -26
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [5.2.1](https://github.com/tramvaijs/linters/compare/v5.2.0...v5.2.1) (2026-04-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @tinkoff/eslint-config
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [5.2.0](https://github.com/tramvaijs/linters/compare/v5.1.0...v5.2.0) (2026-03-04)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **eslint-config:** support mjs extension for resolver ([311578e](https://github.com/tramvaijs/linters/commit/311578e57a578cb942fc2f88135850620ae0e591))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
### [5.0.1](https://github.com/tramvaijs/linters/compare/v5.0.0...v5.0.1) (2025-01-09)
|
|
7
24
|
|
|
8
25
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# @tinkoff/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ESLint config includes rules for JS and TS codebase. Better to use with framework-oriented packages `@tinkoff/eslint-config-react` or `@tinkoff/eslint-config-angular`.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
ESLint >= 9 is required.
|
|
4
8
|
|
|
5
9
|
## Usage
|
|
6
10
|
|
|
@@ -10,62 +14,60 @@ Install from npm
|
|
|
10
14
|
npm i --save-dev @tinkoff/eslint-config
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
necessary additional configs. Package include eslint and prettier dependencies, so you should remove eslint, prettier from your project package.json because those packages are transitive dependencies.
|
|
17
|
+
Create `eslint.config.js` at the project root. Package includes eslint and prettier as dependencies, so you should remove them from your project `package.json`.
|
|
15
18
|
|
|
16
19
|
### Base configurations
|
|
17
20
|
|
|
18
21
|
#### For application
|
|
19
22
|
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
```js
|
|
24
|
+
import appConfig from '@tinkoff/eslint-config/app';
|
|
25
|
+
|
|
26
|
+
export default [...appConfig];
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
#### For library
|
|
27
30
|
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
```js
|
|
32
|
+
import libConfig from '@tinkoff/eslint-config/lib';
|
|
33
|
+
|
|
34
|
+
export default [...libConfig];
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
### Additional configurations
|
|
35
38
|
|
|
36
|
-
####
|
|
39
|
+
#### With Jest
|
|
37
40
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
```js
|
|
42
|
+
import appConfig from '@tinkoff/eslint-config/app';
|
|
43
|
+
import jestConfig from '@tinkoff/eslint-config/jest';
|
|
44
|
+
|
|
45
|
+
export default [...appConfig, ...jestConfig];
|
|
42
46
|
```
|
|
43
47
|
|
|
44
48
|
## Configurations overview
|
|
45
49
|
|
|
46
|
-
Main configurations
|
|
50
|
+
Main configurations include common rules:
|
|
47
51
|
|
|
48
|
-
- `@tinkoff/eslint-config/app`
|
|
49
|
-
- `@tinkoff/eslint-config/lib`
|
|
52
|
+
- `@tinkoff/eslint-config/app` — common rules and specific rules for applications
|
|
53
|
+
- `@tinkoff/eslint-config/lib` — common rules and specific rules for libraries
|
|
50
54
|
|
|
51
|
-
Additional configurations
|
|
52
|
-
configurations
|
|
55
|
+
Additional configurations. These configs **do not** include common eslint rules and must be included alongside main configurations:
|
|
53
56
|
|
|
54
|
-
- `@tinkoff/eslint-config/jest`
|
|
57
|
+
- `@tinkoff/eslint-config/jest` — rules for linting Jest test suites
|
|
55
58
|
|
|
56
59
|
## Internal used plugins
|
|
57
60
|
|
|
58
61
|
`@tinkoff/eslint-config/app` and `@tinkoff/eslint-config/lib` include:
|
|
59
62
|
|
|
60
|
-
- `eslint-config-airbnb`
|
|
61
|
-
-
|
|
62
|
-
- `eslint-plugin-import`
|
|
63
|
-
- `eslint-plugin-promise`
|
|
64
|
-
- `eslint-plugin-jest`
|
|
65
|
-
- `@typescript-eslint/eslint-plugin`
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
report differences as eslint issues
|
|
63
|
+
- `eslint-config-airbnb-extended` — updated version of common and popular configuration `eslint-config-airbnb`
|
|
64
|
+
- `@eslint-community/eslint-plugin-eslint-comments` — validate `eslint` comments
|
|
65
|
+
- `eslint-plugin-import` — validate proper imports
|
|
66
|
+
- `eslint-plugin-promise` — enforce best practices for promises
|
|
67
|
+
- `eslint-plugin-jest` — validate jest tests
|
|
68
|
+
- `@typescript-eslint/eslint-plugin` — lint TypeScript files, adopt many eslint rules to TS code, and provide specific TS rules
|
|
69
|
+
- `eslint-plugin-prettier` — disable code formatting using eslint tools and transfer all the logic to prettier,
|
|
70
|
+
and report differences as eslint issues
|
|
69
71
|
|
|
70
72
|
## Troubleshooting
|
|
71
73
|
|
|
@@ -80,86 +82,80 @@ then reinstall dependencies.
|
|
|
80
82
|
|
|
81
83
|
#### In root config
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
2. Set parserOptions.project for typescript files
|
|
85
|
+
Create `eslint.config.js` at the workspace root:
|
|
85
86
|
|
|
86
|
-
```
|
|
87
|
-
|
|
87
|
+
```js
|
|
88
|
+
import appConfig from '@tinkoff/eslint-config';
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"files": ["*.ts", "*.tsx"],
|
|
96
|
-
"parserOptions": {
|
|
97
|
-
"project": ["./tsconfig.base.json"]
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
90
|
+
export default [
|
|
91
|
+
...appConfig,
|
|
92
|
+
{
|
|
93
|
+
ignores: ['**/*'],
|
|
94
|
+
},
|
|
95
|
+
];
|
|
102
96
|
```
|
|
103
97
|
|
|
104
98
|
#### In apps and non-buildable/non-publishable libs
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
```json
|
|
109
|
-
{
|
|
110
|
-
"extends": ["../../.eslintrc.json", "@tinkoff/eslint-config/app"],
|
|
111
|
-
"ignorePatterns": ["!**/*"]
|
|
112
|
-
...optionally some other configs
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
#### In buildable/publishable libs
|
|
100
|
+
Create `eslint.config.js` in the project directory:
|
|
117
101
|
|
|
118
|
-
|
|
102
|
+
```js
|
|
103
|
+
import rootConfig from '../../eslint.config';
|
|
104
|
+
import appConfig from '@tinkoff/eslint-config/app';
|
|
119
105
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
106
|
+
export default [
|
|
107
|
+
...rootConfig,
|
|
108
|
+
...appConfig,
|
|
109
|
+
{
|
|
110
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
111
|
+
languageOptions: {
|
|
112
|
+
parserOptions: {
|
|
113
|
+
project: ['./tsconfig.json'],
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
];
|
|
126
118
|
```
|
|
127
119
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Nx means usage `.eslintrc.json` for configure ESLint. Just provide it! In `.eslintrc.json` add extension of actual root config file:
|
|
120
|
+
#### In buildable/publishable libs
|
|
131
121
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
```js
|
|
123
|
+
import rootConfig from '../../eslint.config';
|
|
124
|
+
import libConfig from '@tinkoff/eslint-config/lib';
|
|
125
|
+
|
|
126
|
+
export default [
|
|
127
|
+
...rootConfig,
|
|
128
|
+
...libConfig,
|
|
129
|
+
{
|
|
130
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
131
|
+
languageOptions: {
|
|
132
|
+
parserOptions: {
|
|
133
|
+
project: ['./tsconfig.json'],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
];
|
|
136
138
|
```
|
|
137
139
|
|
|
138
|
-
|
|
140
|
+
### Disable false-positive detections from `import/no-unresolved`
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
- You can use [better config formats](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-file-formats) and nx generators
|
|
142
|
+
Override the rule in the project's `eslint.config.js`:
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
```js
|
|
145
|
+
import appConfig from '@tinkoff/eslint-config/app';
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
'error',
|
|
157
|
-
{
|
|
158
|
-
ignore: ['^@tinkoff/'],
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
147
|
+
export default [
|
|
148
|
+
...appConfig,
|
|
149
|
+
{
|
|
150
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
151
|
+
rules: {
|
|
152
|
+
'import/no-unresolved': [
|
|
153
|
+
'error',
|
|
154
|
+
{
|
|
155
|
+
ignore: ['^@tinkoff/'],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
162
158
|
},
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
},
|
|
160
|
+
];
|
|
165
161
|
```
|
package/app.js
CHANGED
package/errors/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
10
|
-
'no-await-in-loop': 'off',
|
|
11
|
-
},
|
|
1
|
+
import { rules } from 'eslint-config-airbnb-extended/legacy';
|
|
2
|
+
import typescriptParser from '@typescript-eslint/parser';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
|
|
7
|
+
languageOptions: {
|
|
8
|
+
parser: typescriptParser,
|
|
12
9
|
},
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
rules: {
|
|
11
|
+
...rules.base.errors.rules,
|
|
12
|
+
// Overrides
|
|
13
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
14
|
+
'no-await-in-loop': 'off',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
];
|
package/index.js
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'./internal/prettier',
|
|
10
|
-
],
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import base from './internal/base.js';
|
|
3
|
+
import sortClassMembers from './internal/sort-class-members.js';
|
|
4
|
+
import importConfig from './internal/import.js';
|
|
5
|
+
import promise from './internal/promise.js';
|
|
6
|
+
import testFiles from './internal/test-files.js';
|
|
7
|
+
import typescript from './internal/typescript.js';
|
|
8
|
+
import prettier from './internal/prettier.js';
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export default [
|
|
11
|
+
...base,
|
|
12
|
+
...sortClassMembers,
|
|
13
|
+
...importConfig,
|
|
14
|
+
...promise,
|
|
15
|
+
...testFiles,
|
|
16
|
+
...typescript,
|
|
17
|
+
...prettier,
|
|
18
|
+
{
|
|
19
|
+
languageOptions: {
|
|
20
|
+
globals: {
|
|
21
|
+
...globals.browser,
|
|
22
|
+
...globals.node,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
15
25
|
},
|
|
16
|
-
|
|
26
|
+
];
|
package/internal/base.js
CHANGED
|
@@ -1,83 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
'../errors/index.js',
|
|
6
|
-
],
|
|
1
|
+
import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments';
|
|
2
|
+
import babelParser from '@babel/eslint-parser';
|
|
3
|
+
import { configs } from 'eslint-config-airbnb-extended/legacy';
|
|
4
|
+
import errorsConfig from '../errors/index.js';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
plugins: ['@babel'],
|
|
15
|
-
|
|
16
|
-
parserOptions: {
|
|
17
|
-
ecmaFeatures: {
|
|
18
|
-
legacyDecorators: true,
|
|
6
|
+
export default [
|
|
7
|
+
...configs.base.recommended,
|
|
8
|
+
...errorsConfig,
|
|
9
|
+
{
|
|
10
|
+
plugins: {
|
|
11
|
+
'eslint-comments': eslintCommentsPlugin,
|
|
19
12
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
allowShortCircuit: true,
|
|
28
|
-
allowTernary: true,
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parser: babelParser,
|
|
15
|
+
parserOptions: {
|
|
16
|
+
ecmaFeatures: {
|
|
17
|
+
legacyDecorators: true,
|
|
18
|
+
},
|
|
19
|
+
requireConfigFile: false,
|
|
29
20
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'
|
|
33
|
-
|
|
34
|
-
functions: false,
|
|
35
|
-
classes: false,
|
|
36
|
-
variables: true,
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
'func-name-matching': 'off',
|
|
40
|
-
'global-require': 'off',
|
|
41
|
-
'class-methods-use-this': 'off',
|
|
42
|
-
'no-continue': 'off',
|
|
43
|
-
'no-restricted-syntax': 'off',
|
|
44
|
-
'guard-for-in': 'off',
|
|
45
|
-
'default-case': 'off',
|
|
46
|
-
'no-plusplus': 'off',
|
|
47
|
-
'func-names': 'off',
|
|
48
|
-
'consistent-return': 'warn',
|
|
49
|
-
'vars-on-top': 'warn',
|
|
50
|
-
'no-var': 'warn',
|
|
51
|
-
camelcase: [
|
|
52
|
-
'warn',
|
|
53
|
-
{
|
|
54
|
-
allow: ['^UNSAFE_'],
|
|
55
|
-
ignoreDestructuring: false,
|
|
56
|
-
properties: 'never',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
'func-style': [
|
|
60
|
-
'error',
|
|
61
|
-
'declaration',
|
|
62
|
-
{
|
|
63
|
-
allowArrowFunctions: true,
|
|
21
|
+
},
|
|
22
|
+
settings: {
|
|
23
|
+
'import/parser': {
|
|
24
|
+
'@babel/eslint-parser': ['.js', '.jsx', '.ts', '.tsx'],
|
|
64
25
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'eslint-comments/disable-enable-pair': 'error',
|
|
29
|
+
'eslint-comments/no-aggregating-enable': 'error',
|
|
30
|
+
'eslint-comments/no-duplicate-disable': 'error',
|
|
31
|
+
'eslint-comments/no-unlimited-disable': 'error',
|
|
32
|
+
'eslint-comments/no-unused-enable': 'error',
|
|
33
|
+
|
|
34
|
+
'no-unused-expressions': [
|
|
35
|
+
'error',
|
|
36
|
+
{
|
|
37
|
+
allowShortCircuit: true,
|
|
38
|
+
allowTernary: true,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
'no-use-before-define': [
|
|
42
|
+
'error',
|
|
43
|
+
{
|
|
44
|
+
functions: false,
|
|
45
|
+
classes: false,
|
|
46
|
+
variables: true,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
'func-name-matching': 'off',
|
|
50
|
+
'global-require': 'off',
|
|
51
|
+
'class-methods-use-this': 'off',
|
|
52
|
+
'no-continue': 'off',
|
|
53
|
+
'no-restricted-syntax': 'off',
|
|
54
|
+
'guard-for-in': 'off',
|
|
55
|
+
'default-case': 'off',
|
|
56
|
+
'no-plusplus': 'off',
|
|
57
|
+
'func-names': 'off',
|
|
58
|
+
'consistent-return': 'warn',
|
|
59
|
+
'vars-on-top': 'warn',
|
|
60
|
+
'no-var': 'warn',
|
|
61
|
+
camelcase: [
|
|
62
|
+
'warn',
|
|
63
|
+
{
|
|
64
|
+
allow: ['^UNSAFE_'],
|
|
65
|
+
ignoreDestructuring: false,
|
|
66
|
+
properties: 'never',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
'func-style': [
|
|
70
|
+
'error',
|
|
71
|
+
'declaration',
|
|
72
|
+
{
|
|
73
|
+
allowArrowFunctions: true,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
'max-depth': 'off',
|
|
77
|
+
'max-params': 'off',
|
|
78
|
+
'max-classes-per-file': ['error', 4],
|
|
79
|
+
complexity: ['error', 25],
|
|
80
|
+
'max-statements': ['error', 25],
|
|
81
|
+
'no-underscore-dangle': 'off',
|
|
82
|
+
'no-return-assign': ['error', 'except-parens'],
|
|
83
|
+
'lines-between-class-members': [
|
|
84
|
+
'error',
|
|
85
|
+
'always',
|
|
86
|
+
{ exceptAfterSingleLine: true },
|
|
87
|
+
],
|
|
88
|
+
'spaced-comment': ['error', 'always', { exceptions: ['*'] }],
|
|
89
|
+
'max-nested-callbacks': ['error', 4],
|
|
90
|
+
'no-bitwise': 'warn',
|
|
91
|
+
'no-useless-escape': 'warn',
|
|
92
|
+
},
|
|
82
93
|
},
|
|
83
|
-
|
|
94
|
+
];
|
package/internal/import.js
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
plugins: ['import'],
|
|
1
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
typescript: {},
|
|
10
|
-
webpack: {},
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
plugins: {
|
|
6
|
+
import: importPlugin,
|
|
11
7
|
},
|
|
12
|
-
},
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'error',
|
|
22
|
-
'always',
|
|
23
|
-
{
|
|
24
|
-
js: 'never',
|
|
25
|
-
jsx: 'never',
|
|
26
|
-
ts: 'never',
|
|
27
|
-
tsx: 'never',
|
|
9
|
+
settings: {
|
|
10
|
+
'import/resolver': {
|
|
11
|
+
node: {
|
|
12
|
+
extensions: ['.js', '.mjs', '.cjs', '.ts'],
|
|
13
|
+
},
|
|
14
|
+
typescript: {},
|
|
15
|
+
webpack: {},
|
|
28
16
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
rules: {
|
|
20
|
+
'import/no-commonjs': 'off',
|
|
21
|
+
'import/unambiguous': 'off',
|
|
22
|
+
'import/prefer-default-export': 'off', // default imports is evil
|
|
23
|
+
'import/no-deprecated': 'warn',
|
|
24
|
+
'import/default': 'error', // enable default import validation
|
|
25
|
+
'import/extensions': [
|
|
26
|
+
'error',
|
|
27
|
+
'always',
|
|
28
|
+
{
|
|
29
|
+
js: 'never',
|
|
30
|
+
mjs: 'never',
|
|
31
|
+
cjs: 'never',
|
|
32
|
+
jsx: 'never',
|
|
33
|
+
ts: 'never',
|
|
34
|
+
tsx: 'never',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
'import/order': [
|
|
38
|
+
'warn',
|
|
39
|
+
{ groups: [['builtin', 'external', 'internal']] },
|
|
40
|
+
],
|
|
41
|
+
'import/no-extraneous-dependencies': 'off', // need fine tuning
|
|
42
|
+
'import/no-cycle': 'error',
|
|
43
|
+
},
|
|
33
44
|
},
|
|
34
|
-
|
|
45
|
+
];
|
package/internal/prettier.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
2
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
plugins: {
|
|
7
|
+
prettier: prettierPlugin,
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
...prettierConfig.rules,
|
|
11
|
+
'prettier/prettier': 'error',
|
|
12
|
+
'arrow-body-style': 'off',
|
|
13
|
+
'prefer-arrow-callback': 'off',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
];
|
package/internal/promise.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
extends: ['plugin:promise/recommended'],
|
|
1
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export default [
|
|
4
|
+
promisePlugin.configs['flat/recommended'],
|
|
5
|
+
{
|
|
6
|
+
rules: {
|
|
7
|
+
'promise/always-return': 'off',
|
|
8
|
+
'promise/no-callback-in-promise': 'off',
|
|
9
|
+
'promise/catch-or-return': 'warn',
|
|
10
|
+
'promise/param-names': 'warn',
|
|
11
|
+
},
|
|
9
12
|
},
|
|
10
|
-
|
|
13
|
+
];
|