@ololoepepe/eslint-config-typescript 0.0.11 → 0.1.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 +76 -0
- package/README.md +158 -1
- package/package.json +33 -13
- package/src/index.js +80 -308
- package/src/node.js +27 -0
- package/src/plugins/eslint-comments.js +16 -0
- package/src/plugins/import-x.js +107 -0
- package/src/plugins/n.js +48 -0
- package/src/plugins/perfectionist.js +8 -2
- package/src/plugins/promise.js +25 -0
- package/src/plugins/react-hooks.js +32 -0
- package/src/plugins/react.js +91 -0
- package/src/plugins/regexp.js +86 -0
- package/src/plugins/stylistic.js +177 -0
- package/src/plugins/typescript/index.js +1 -1
- package/src/plugins/unicorn.js +329 -0
- package/src/react.js +48 -0
- package/src/rules/core.js +126 -0
- package/src/rules/jsx-stylistic.js +62 -0
- package/src/rules/no.js +3 -35
- package/src/plugins/import.js +0 -108
package/src/index.js
CHANGED
|
@@ -1,316 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access --
|
|
2
|
+
The ESLint plugins and parser registered in this wiring file are untyped
|
|
3
|
+
third-party modules, so the typed-linting rules treat them as `any`. Suppress
|
|
4
|
+
the unsafe-access reports for the whole file. */
|
|
5
|
+
import eslintComments from '@eslint-community/eslint-plugin-eslint-comments';
|
|
6
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
7
|
+
import importX from 'eslint-plugin-import-x';
|
|
8
|
+
import perfectionist from 'eslint-plugin-perfectionist';
|
|
9
|
+
import promise from 'eslint-plugin-promise';
|
|
10
|
+
import regexp from 'eslint-plugin-regexp';
|
|
11
|
+
import sortKeysShorthand from 'eslint-plugin-sort-keys-shorthand';
|
|
12
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
13
|
+
import globals from 'globals';
|
|
14
|
+
import tseslint from 'typescript-eslint';
|
|
15
|
+
|
|
16
|
+
import pluginEslintComments from '#src/plugins/eslint-comments.js';
|
|
17
|
+
import pluginImportX from '#src/plugins/import-x.js';
|
|
2
18
|
import pluginPerfectionist from '#src/plugins/perfectionist.js';
|
|
19
|
+
import pluginPromise from '#src/plugins/promise.js';
|
|
20
|
+
import pluginRegexp from '#src/plugins/regexp.js';
|
|
3
21
|
import pluginSortKeysShorthand from '#src/plugins/sort-keys-shorthand.js';
|
|
22
|
+
import pluginStylistic from '#src/plugins/stylistic.js';
|
|
4
23
|
import pluginTypescript from '#src/plugins/typescript/index.js';
|
|
24
|
+
import pluginUnicorn from '#src/plugins/unicorn.js';
|
|
25
|
+
import rulesCore from '#src/rules/core.js';
|
|
5
26
|
import rulesNo from '#src/rules/no.js';
|
|
6
27
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const plugins = [
|
|
25
|
-
'@typescript-eslint',
|
|
26
|
-
'import',
|
|
27
|
-
'perfectionist',
|
|
28
|
-
'sort-keys-shorthand'
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
32
|
-
export const rules = {
|
|
33
|
-
'accessor-pairs': ['warn', {
|
|
34
|
-
enforceForClassMembers: true,
|
|
35
|
-
getWithoutSet: false,
|
|
36
|
-
setWithoutGet: true
|
|
37
|
-
}],
|
|
38
|
-
'array-bracket-newline': ['error', 'consistent'],
|
|
39
|
-
'array-bracket-spacing': ['error', 'never', {
|
|
40
|
-
arraysInArrays: false,
|
|
41
|
-
objectsInArrays: false,
|
|
42
|
-
singleValue: false
|
|
43
|
-
}],
|
|
44
|
-
'array-callback-return': ['error', {
|
|
45
|
-
allowImplicit: false,
|
|
46
|
-
checkForEach: false
|
|
47
|
-
}],
|
|
48
|
-
'array-element-newline': ['error', 'consistent'],
|
|
49
|
-
'arrow-body-style': ['error', 'as-needed'],
|
|
50
|
-
'arrow-parens': ['error', 'as-needed', {
|
|
51
|
-
requireForBlockBody: false
|
|
52
|
-
}],
|
|
53
|
-
'arrow-spacing': ['error', {
|
|
54
|
-
after: true,
|
|
55
|
-
before: true
|
|
56
|
-
}],
|
|
57
|
-
'block-scoped-var': 'error',
|
|
58
|
-
'block-spacing': ['error', 'always'],
|
|
59
|
-
'brace-style': ['error', '1tbs', {
|
|
60
|
-
allowSingleLine: false
|
|
61
|
-
}],
|
|
62
|
-
camelcase: ['error', {
|
|
63
|
-
ignoreDestructuring: false,
|
|
64
|
-
ignoreGlobals: true,
|
|
65
|
-
ignoreImports: false,
|
|
66
|
-
properties: 'never'
|
|
67
|
-
}],
|
|
68
|
-
'capitalized-comments': ['error', 'always', {
|
|
69
|
-
ignoreConsecutiveComments: true,
|
|
70
|
-
ignoreInlineComments: false,
|
|
71
|
-
ignorePattern: 'webpackChunkName'
|
|
72
|
-
}],
|
|
73
|
-
'class-methods-use-this': 'off',
|
|
74
|
-
'comma-dangle': ['error', 'never'],
|
|
75
|
-
'comma-spacing': ['error', {
|
|
76
|
-
after: true,
|
|
77
|
-
before: false
|
|
78
|
-
}],
|
|
79
|
-
'comma-style': ['error', 'last'],
|
|
80
|
-
complexity: ['warn', 20],
|
|
81
|
-
'computed-property-spacing': ['error', 'never', {
|
|
82
|
-
enforceForClassMembers: true
|
|
83
|
-
}],
|
|
84
|
-
'consistent-return': 'off',
|
|
85
|
-
'consistent-this': ['error', 'self'],
|
|
86
|
-
'constructor-super': 'error',
|
|
87
|
-
curly: ['error', 'all'],
|
|
88
|
-
'default-case': 'off',
|
|
89
|
-
'default-case-last': 'error',
|
|
90
|
-
'default-param-last': 'error',
|
|
91
|
-
'dot-location': ['error', 'property'],
|
|
92
|
-
'dot-notation': 'off', // NOTE: See TypeScript rule extending this one
|
|
93
|
-
'eol-last': ['error', 'always'],
|
|
94
|
-
eqeqeq: ['error', 'always'],
|
|
95
|
-
'for-direction': 'error',
|
|
96
|
-
'func-call-spacing': ['error', 'never'],
|
|
97
|
-
'func-name-matching': ['warn', 'always'],
|
|
98
|
-
'func-names': ['error', 'never', {
|
|
99
|
-
generators: 'never'
|
|
100
|
-
}],
|
|
101
|
-
'func-style': ['error', 'declaration', {
|
|
102
|
-
allowArrowFunctions: true
|
|
103
|
-
}],
|
|
104
|
-
'function-call-argument-newline': ['error', 'consistent'],
|
|
105
|
-
'function-paren-newline': ['error', 'multiline-arguments'],
|
|
106
|
-
'generator-star-spacing': ['error', {
|
|
107
|
-
after: true,
|
|
108
|
-
before: true
|
|
109
|
-
}],
|
|
110
|
-
'getter-return': ['error', {
|
|
111
|
-
allowImplicit: false
|
|
112
|
-
}],
|
|
113
|
-
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
114
|
-
'guard-for-in': 'error',
|
|
115
|
-
'id-denylist': 'off',
|
|
116
|
-
'id-length': 'off',
|
|
117
|
-
'id-match': 'off',
|
|
118
|
-
'implicit-arrow-linebreak': ['error', 'beside'],
|
|
119
|
-
indent: ['error', 2],
|
|
120
|
-
'init-declarations': 'off', // NOTE: See TypeScript rule extending this one
|
|
121
|
-
'jsx-quotes': ['error', 'prefer-double'],
|
|
122
|
-
'key-spacing': ['error', {
|
|
123
|
-
afterColon: true,
|
|
124
|
-
beforeColon: false
|
|
125
|
-
}],
|
|
126
|
-
'keyword-spacing': ['error', {
|
|
127
|
-
after: true,
|
|
128
|
-
before: true
|
|
129
|
-
}],
|
|
130
|
-
'line-comment-position': 'off',
|
|
131
|
-
'linebreak-style': ['error', 'unix'],
|
|
132
|
-
'lines-around-comment': 'off',
|
|
133
|
-
'lines-between-class-members': ['error', 'always', {
|
|
134
|
-
exceptAfterSingleLine: true
|
|
135
|
-
}],
|
|
136
|
-
'logical-assignment-operators': ['error', 'always', {
|
|
137
|
-
enforceForIfStatements: false
|
|
138
|
-
}],
|
|
139
|
-
'max-classes-per-file': 'off',
|
|
140
|
-
'max-depth': ['warn', 5],
|
|
141
|
-
'max-len': ['error', {
|
|
142
|
-
code: 120,
|
|
143
|
-
comments: 120,
|
|
144
|
-
ignoreComments: false,
|
|
145
|
-
ignoreRegExpLiterals: false,
|
|
146
|
-
ignoreStrings: false,
|
|
147
|
-
ignoreTemplateLiterals: false,
|
|
148
|
-
ignoreTrailingComments: false,
|
|
149
|
-
ignoreUrls: false,
|
|
150
|
-
tabWidth: 2
|
|
151
|
-
}],
|
|
152
|
-
'max-lines': ['warn', {
|
|
153
|
-
max: 500,
|
|
154
|
-
skipBlankLines: true,
|
|
155
|
-
skipComments: true
|
|
156
|
-
}],
|
|
157
|
-
'max-lines-per-function': ['warn', {
|
|
158
|
-
IIFEs: true,
|
|
159
|
-
max: 100,
|
|
160
|
-
skipBlankLines: true,
|
|
161
|
-
skipComments: true
|
|
162
|
-
}],
|
|
163
|
-
'max-nested-callbacks': ['warn', 5],
|
|
164
|
-
'max-params': 'off', // NOTE: See TypeScript rule extending this one
|
|
165
|
-
'max-statements': 'off',
|
|
166
|
-
'max-statements-per-line': ['error', {
|
|
167
|
-
max: 1
|
|
168
|
-
}],
|
|
169
|
-
'multiline-comment-style': 'off',
|
|
170
|
-
'multiline-ternary': 'off',
|
|
171
|
-
'new-cap': ['error', {
|
|
172
|
-
capIsNew: true,
|
|
173
|
-
newIsCap: true,
|
|
174
|
-
properties: true
|
|
175
|
-
}],
|
|
176
|
-
'new-parens': ['error', 'always'],
|
|
177
|
-
'newline-per-chained-call': ['error', {
|
|
178
|
-
ignoreChainWithDepth: 3
|
|
179
|
-
}],
|
|
180
|
-
'nonblock-statement-body-position': 'off',
|
|
181
|
-
'object-curly-newline': 'off',
|
|
182
|
-
'object-curly-spacing': ['error', 'never', {
|
|
183
|
-
arraysInObjects: false,
|
|
184
|
-
objectsInObjects: false
|
|
185
|
-
}],
|
|
186
|
-
'object-property-newline': 'off', // Reconsider
|
|
187
|
-
'object-shorthand': ['error', 'always', {
|
|
188
|
-
avoidExplicitReturnArrows: false,
|
|
189
|
-
avoidQuotes: true,
|
|
190
|
-
ignoreConstructors: false
|
|
191
|
-
}],
|
|
192
|
-
'one-var': ['error', 'never'],
|
|
193
|
-
'one-var-declaration-per-line': 'off',
|
|
194
|
-
'operator-assignment': ['error', 'always'],
|
|
195
|
-
'operator-linebreak': ['error', 'after'],
|
|
196
|
-
'padded-blocks': ['error', 'never', {
|
|
197
|
-
allowSingleLineBlocks: false
|
|
198
|
-
}],
|
|
199
|
-
'padding-line-between-statements': ['error', {
|
|
200
|
-
blankLine: 'always',
|
|
201
|
-
next: '*',
|
|
202
|
-
prev: 'multiline-block-like'
|
|
203
|
-
}],
|
|
204
|
-
'prefer-arrow-callback': ['error', {
|
|
205
|
-
allowNamedFunctions: false,
|
|
206
|
-
allowUnboundThis: true
|
|
207
|
-
}],
|
|
208
|
-
'prefer-const': ['error', {
|
|
209
|
-
destructuring: 'all',
|
|
210
|
-
ignoreReadBeforeAssign: true
|
|
211
|
-
}],
|
|
212
|
-
'prefer-destructuring': 'off', // NOTE: See TypeScript rule extending this one
|
|
213
|
-
'prefer-exponentiation-operator': 'error',
|
|
214
|
-
'prefer-named-capture-group': 'warn',
|
|
215
|
-
'prefer-numeric-literals': 'error',
|
|
216
|
-
'prefer-object-has-own': 'off',
|
|
217
|
-
'prefer-object-spread': 'error',
|
|
218
|
-
'prefer-promise-reject-errors': 'off', // NOTE: See TypeScript rule extending this one
|
|
219
|
-
'prefer-regex-literals': ['error', {
|
|
220
|
-
disallowRedundantWrapping: true
|
|
221
|
-
}],
|
|
222
|
-
'prefer-rest-params': 'error',
|
|
223
|
-
'prefer-spread': 'error',
|
|
224
|
-
'prefer-template': 'error',
|
|
225
|
-
'quote-props': ['error', 'as-needed', {
|
|
226
|
-
keywords: false,
|
|
227
|
-
numbers: true,
|
|
228
|
-
unnecessary: true
|
|
229
|
-
}],
|
|
230
|
-
quotes: ['error', 'single', {
|
|
231
|
-
allowTemplateLiterals: false,
|
|
232
|
-
avoidEscape: true
|
|
233
|
-
}],
|
|
234
|
-
radix: ['error', 'as-needed'],
|
|
235
|
-
'require-atomic-updates': 'error',
|
|
236
|
-
'require-await': 'off', // NOTE: See TypeScript rule extending this one
|
|
237
|
-
'require-unicode-regexp': 'error',
|
|
238
|
-
'require-yield': 'off',
|
|
239
|
-
'rest-spread-spacing': ['error', 'never'],
|
|
240
|
-
semi: ['error', 'always', {
|
|
241
|
-
omitLastInOneLineBlock: false
|
|
242
|
-
}],
|
|
243
|
-
'semi-spacing': ['error', {
|
|
244
|
-
after: true,
|
|
245
|
-
before: false
|
|
246
|
-
}],
|
|
247
|
-
'semi-style': ['error', 'last'],
|
|
248
|
-
'sort-imports': 'off',
|
|
249
|
-
'sort-keys': 'off',
|
|
250
|
-
'sort-vars': ['error', {
|
|
251
|
-
ignoreCase: true
|
|
252
|
-
}],
|
|
253
|
-
'space-before-blocks': ['error', 'always'],
|
|
254
|
-
'space-before-function-paren': ['error', {
|
|
255
|
-
anonymous: 'always',
|
|
256
|
-
asyncArrow: 'always',
|
|
257
|
-
named: 'never'
|
|
258
|
-
}],
|
|
259
|
-
'space-in-parens': ['error', 'never'],
|
|
260
|
-
'space-infix-ops': ['error', {
|
|
261
|
-
int32Hint: false
|
|
262
|
-
}],
|
|
263
|
-
'space-unary-ops': ['error', {
|
|
264
|
-
nonwords: false,
|
|
265
|
-
words: true
|
|
266
|
-
}],
|
|
267
|
-
'spaced-comment': ['error', 'always', {
|
|
268
|
-
block: {
|
|
269
|
-
balanced: true,
|
|
270
|
-
exceptions: ['-', '+', '*'],
|
|
271
|
-
markers: ['!', '*']
|
|
28
|
+
export default [{
|
|
29
|
+
files: [
|
|
30
|
+
'**/*.ts',
|
|
31
|
+
'**/*.tsx',
|
|
32
|
+
'**/*.cts',
|
|
33
|
+
'**/*.mts',
|
|
34
|
+
'**/*.js',
|
|
35
|
+
'**/*.jsx',
|
|
36
|
+
'**/*.cjs',
|
|
37
|
+
'**/*.mjs'
|
|
38
|
+
],
|
|
39
|
+
languageOptions: {
|
|
40
|
+
ecmaVersion: 'latest',
|
|
41
|
+
globals: {
|
|
42
|
+
...globals.es2021
|
|
272
43
|
},
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
'
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
44
|
+
parser: tseslint.parser,
|
|
45
|
+
parserOptions: {
|
|
46
|
+
ecmaFeatures: {
|
|
47
|
+
jsx: true
|
|
48
|
+
},
|
|
49
|
+
projectService: true
|
|
50
|
+
},
|
|
51
|
+
sourceType: 'module'
|
|
52
|
+
},
|
|
53
|
+
linterOptions: {
|
|
54
|
+
reportUnusedDisableDirectives: 'error'
|
|
55
|
+
},
|
|
56
|
+
name: '@ololoepepe/eslint-config-typescript',
|
|
57
|
+
plugins: {
|
|
58
|
+
perfectionist,
|
|
59
|
+
promise,
|
|
60
|
+
regexp,
|
|
61
|
+
unicorn,
|
|
62
|
+
'@eslint-community/eslint-comments': eslintComments,
|
|
63
|
+
'@stylistic': stylistic,
|
|
64
|
+
'@typescript-eslint': tseslint.plugin,
|
|
65
|
+
'import-x': importX,
|
|
66
|
+
'sort-keys-shorthand': sortKeysShorthand
|
|
67
|
+
},
|
|
68
|
+
rules: {
|
|
69
|
+
...rulesCore,
|
|
70
|
+
...rulesNo,
|
|
71
|
+
...pluginEslintComments.rules,
|
|
72
|
+
...pluginStylistic.rules,
|
|
73
|
+
...pluginTypescript.rules,
|
|
74
|
+
...pluginImportX.rules,
|
|
75
|
+
...pluginPerfectionist.rules,
|
|
76
|
+
...pluginPromise.rules,
|
|
77
|
+
...pluginRegexp.rules,
|
|
78
|
+
...pluginSortKeysShorthand.rules,
|
|
79
|
+
...pluginUnicorn.rules
|
|
80
|
+
},
|
|
81
|
+
settings: {
|
|
82
|
+
'import-x/resolver': {
|
|
83
|
+
typescript: {
|
|
84
|
+
project: './tsconfig.json'
|
|
85
|
+
}
|
|
314
86
|
}
|
|
315
87
|
}
|
|
316
|
-
};
|
|
88
|
+
}];
|
package/src/node.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access --
|
|
2
|
+
The ESLint plugin and globals registered in this wiring file are untyped
|
|
3
|
+
third-party modules, so the typed-linting rules treat them as `any`. Suppress
|
|
4
|
+
the unsafe-access reports for the whole file. */
|
|
5
|
+
import n from 'eslint-plugin-n';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
|
|
8
|
+
import base from '#src/index.js';
|
|
9
|
+
import pluginN from '#src/plugins/n.js';
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
...base,
|
|
13
|
+
{
|
|
14
|
+
languageOptions: {
|
|
15
|
+
globals: {
|
|
16
|
+
...globals.node
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
name: '@ololoepepe/eslint-config-typescript/node',
|
|
20
|
+
plugins: {
|
|
21
|
+
n
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
...pluginN.rules
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
rules: {
|
|
3
|
+
'@eslint-community/eslint-comments/disable-enable-pair': ['error', {
|
|
4
|
+
allowWholeFile: true
|
|
5
|
+
}],
|
|
6
|
+
'@eslint-community/eslint-comments/no-aggregating-enable': 'error',
|
|
7
|
+
'@eslint-community/eslint-comments/no-duplicate-disable': 'error',
|
|
8
|
+
'@eslint-community/eslint-comments/no-restricted-disable': 'off',
|
|
9
|
+
'@eslint-community/eslint-comments/no-unlimited-disable': 'error',
|
|
10
|
+
// NOTE: `no-unused-disable` is deprecated; `linterOptions.reportUnusedDisableDirectives`
|
|
11
|
+
// (set to 'error' in src/index.js) is the owner for unused disable directives.
|
|
12
|
+
'@eslint-community/eslint-comments/no-unused-enable': 'error',
|
|
13
|
+
'@eslint-community/eslint-comments/no-use': 'off',
|
|
14
|
+
'@eslint-community/eslint-comments/require-description': 'error'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
rules: {
|
|
3
|
+
'import-x/consistent-type-specifier-style': 'off', // TODO: Reconsider if use TS/Flow
|
|
4
|
+
'import-x/default': 'error',
|
|
5
|
+
'import-x/dynamic-import-chunkname': ['error'],
|
|
6
|
+
'import-x/export': 'error',
|
|
7
|
+
'import-x/exports-last': 'off',
|
|
8
|
+
'import-x/extensions': 'off',
|
|
9
|
+
'import-x/first': ['error', 'absolute-first'],
|
|
10
|
+
'import-x/group-exports': 'off',
|
|
11
|
+
'import-x/max-dependencies': 'off',
|
|
12
|
+
'import-x/named': 'error',
|
|
13
|
+
'import-x/namespace': ['error', {
|
|
14
|
+
allowComputed: false
|
|
15
|
+
}],
|
|
16
|
+
'import-x/newline-after-import': ['error', {
|
|
17
|
+
considerComments: false,
|
|
18
|
+
count: 1
|
|
19
|
+
}],
|
|
20
|
+
'import-x/no-absolute-path': ['error', {
|
|
21
|
+
amd: true,
|
|
22
|
+
commonjs: true,
|
|
23
|
+
esmodule: true
|
|
24
|
+
}],
|
|
25
|
+
'import-x/no-amd': 'off',
|
|
26
|
+
'import-x/no-anonymous-default-export': 'off',
|
|
27
|
+
'import-x/no-commonjs': 'off',
|
|
28
|
+
'import-x/no-cycle': ['error', {
|
|
29
|
+
amd: true,
|
|
30
|
+
commonjs: true,
|
|
31
|
+
esmodule: true, // TODO
|
|
32
|
+
ignoreExternal: true
|
|
33
|
+
}],
|
|
34
|
+
'import-x/no-default-export': 'off',
|
|
35
|
+
'import-x/no-deprecated': 'warn',
|
|
36
|
+
'import-x/no-duplicates': ['error', {
|
|
37
|
+
considerQueryString: true
|
|
38
|
+
}],
|
|
39
|
+
'import-x/no-dynamic-require': 'off', // TODO
|
|
40
|
+
'import-x/no-empty-named-blocks': 'error',
|
|
41
|
+
'import-x/no-extraneous-dependencies': 'error',
|
|
42
|
+
'import-x/no-import-module-exports': 'off',
|
|
43
|
+
'import-x/no-internal-modules': 'off',
|
|
44
|
+
'import-x/no-mutable-exports': 'error',
|
|
45
|
+
'import-x/no-named-as-default': 'warn',
|
|
46
|
+
'import-x/no-named-as-default-member': 'error',
|
|
47
|
+
'import-x/no-named-default': 'off',
|
|
48
|
+
'import-x/no-named-export': 'off',
|
|
49
|
+
'import-x/no-namespace': 'off',
|
|
50
|
+
'import-x/no-nodejs-modules': 'off',
|
|
51
|
+
'import-x/no-relative-packages': 'off',
|
|
52
|
+
'import-x/no-relative-parent-imports': 'warn',
|
|
53
|
+
'import-x/no-restricted-paths': 'off',
|
|
54
|
+
'import-x/no-self-import': 'error',
|
|
55
|
+
'import-x/no-unassigned-import': 'off',
|
|
56
|
+
'import-x/no-unresolved': ['error', {
|
|
57
|
+
ignore: ['^#']
|
|
58
|
+
}],
|
|
59
|
+
'import-x/no-unused-modules': 'off', // TODO: Reconsider
|
|
60
|
+
'import-x/no-useless-path-segments': ['error', {
|
|
61
|
+
commonjs: true,
|
|
62
|
+
noUselessIndex: false
|
|
63
|
+
}],
|
|
64
|
+
'import-x/no-webpack-loader-syntax': 'error',
|
|
65
|
+
'import-x/order': ['error', {
|
|
66
|
+
alphabetize: {
|
|
67
|
+
caseInsensitive: true,
|
|
68
|
+
order: 'asc',
|
|
69
|
+
orderImportKind: 'ignore'
|
|
70
|
+
},
|
|
71
|
+
distinctGroup: true,
|
|
72
|
+
groups: ['builtin', 'external', 'type', 'internal', 'parent', 'sibling', 'index', 'object', 'unknown'],
|
|
73
|
+
'newlines-between': 'always-and-inside-groups',
|
|
74
|
+
pathGroups: [{
|
|
75
|
+
group: 'internal',
|
|
76
|
+
pattern: '#src/**'
|
|
77
|
+
}, {
|
|
78
|
+
group: 'parent',
|
|
79
|
+
pattern: '../**/styles.js',
|
|
80
|
+
position: 'after'
|
|
81
|
+
}, {
|
|
82
|
+
group: 'parent',
|
|
83
|
+
pattern: '../**/styles.css',
|
|
84
|
+
position: 'after'
|
|
85
|
+
}, {
|
|
86
|
+
group: 'parent',
|
|
87
|
+
pattern: '../**/styles.less',
|
|
88
|
+
position: 'after'
|
|
89
|
+
}, {
|
|
90
|
+
group: 'sibling',
|
|
91
|
+
pattern: './**/styles.js',
|
|
92
|
+
position: 'after'
|
|
93
|
+
}, {
|
|
94
|
+
group: 'sibling',
|
|
95
|
+
pattern: './**/styles.css',
|
|
96
|
+
position: 'after'
|
|
97
|
+
}, {
|
|
98
|
+
group: 'sibling',
|
|
99
|
+
pattern: './**/styles.less',
|
|
100
|
+
position: 'after'
|
|
101
|
+
}],
|
|
102
|
+
warnOnUnassignedImports: false
|
|
103
|
+
}],
|
|
104
|
+
'import-x/prefer-default-export': 'off',
|
|
105
|
+
'import-x/unambiguous': 'off' // TODO: Reconsider
|
|
106
|
+
}
|
|
107
|
+
};
|
package/src/plugins/n.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
rules: {
|
|
3
|
+
'n/callback-return': 'off',
|
|
4
|
+
'n/exports-style': 'off',
|
|
5
|
+
'n/file-extension-in-import': 'off', // Owned by import-x (import-x/extensions) — single owner for import paths.
|
|
6
|
+
'n/global-require': 'off',
|
|
7
|
+
'n/handle-callback-err': ['error', '^(err|error)$'],
|
|
8
|
+
'n/hashbang': 'error',
|
|
9
|
+
'n/no-callback-literal': 'error',
|
|
10
|
+
'n/no-deprecated-api': 'error',
|
|
11
|
+
'n/no-exports-assign': 'error',
|
|
12
|
+
'n/no-extraneous-import': 'off', // Owned by import-x/no-extraneous-dependencies.
|
|
13
|
+
'n/no-extraneous-require': 'off', // Owned by import-x/no-extraneous-dependencies.
|
|
14
|
+
'n/no-missing-import': 'off', // Owned by import-x/no-unresolved (+ TS resolver).
|
|
15
|
+
'n/no-missing-require': 'off', // Owned by import-x/no-unresolved (+ TS resolver).
|
|
16
|
+
'n/no-mixed-requires': 'off',
|
|
17
|
+
'n/no-new-require': 'error',
|
|
18
|
+
'n/no-path-concat': 'error',
|
|
19
|
+
'n/no-process-env': 'off',
|
|
20
|
+
'n/no-process-exit': 'warn',
|
|
21
|
+
'n/no-restricted-import': 'off',
|
|
22
|
+
'n/no-restricted-require': 'off',
|
|
23
|
+
'n/no-sync': 'off',
|
|
24
|
+
'n/no-top-level-await': 'off',
|
|
25
|
+
'n/no-unpublished-bin': 'error',
|
|
26
|
+
'n/no-unpublished-import': 'error',
|
|
27
|
+
'n/no-unpublished-require': 'error',
|
|
28
|
+
'n/no-unsupported-features/es-builtins': 'error',
|
|
29
|
+
// Downlevel syntax is owned by the TypeScript compiler (tsconfig `target`),
|
|
30
|
+
// not by static syntax inspection; this rule misfires on TS source and would
|
|
31
|
+
// need an `engines.node`/`version` baseline this package does not declare.
|
|
32
|
+
'n/no-unsupported-features/es-syntax': 'off',
|
|
33
|
+
'n/no-unsupported-features/node-builtins': 'error',
|
|
34
|
+
'n/prefer-global/buffer': 'error',
|
|
35
|
+
'n/prefer-global/console': 'error',
|
|
36
|
+
'n/prefer-global/crypto': 'error',
|
|
37
|
+
'n/prefer-global/process': 'error',
|
|
38
|
+
'n/prefer-global/text-decoder': 'error',
|
|
39
|
+
'n/prefer-global/text-encoder': 'error',
|
|
40
|
+
'n/prefer-global/timers': 'error',
|
|
41
|
+
'n/prefer-global/url': 'error',
|
|
42
|
+
'n/prefer-global/url-search-params': 'error',
|
|
43
|
+
'n/prefer-node-protocol': 'error',
|
|
44
|
+
'n/prefer-promises/dns': 'error',
|
|
45
|
+
'n/prefer-promises/fs': 'error',
|
|
46
|
+
'n/process-exit-as-throw': 'error'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -20,14 +20,20 @@ export default {
|
|
|
20
20
|
'perfectionist/sort-exports': ['error', SORT_OPTIONS],
|
|
21
21
|
'perfectionist/sort-heritage-clauses': ['error', SORT_OPTIONS],
|
|
22
22
|
'perfectionist/sort-import-attributes': ['error', SORT_OPTIONS],
|
|
23
|
-
|
|
23
|
+
// Import-statement ordering is owned by `import-x/order` (configured with
|
|
24
|
+
// project path groups); the two disagree on type-import placement and group
|
|
25
|
+
// spacing, so keep this off to avoid an unresolvable conflict. Named-specifier
|
|
26
|
+
// sorting (`sort-named-imports`) is a separate concern and stays on.
|
|
27
|
+
'perfectionist/sort-imports': 'off',
|
|
24
28
|
'perfectionist/sort-interfaces': ['error', SORT_OPTIONS],
|
|
25
29
|
'perfectionist/sort-intersection-types': ['error', SORT_OPTIONS],
|
|
26
30
|
'perfectionist/sort-maps': ['error', SORT_OPTIONS],
|
|
27
31
|
'perfectionist/sort-named-exports': ['error', SORT_OPTIONS],
|
|
28
32
|
'perfectionist/sort-named-imports': ['error', SORT_OPTIONS],
|
|
29
33
|
'perfectionist/sort-object-types': ['error', SORT_OPTIONS],
|
|
30
|
-
|
|
34
|
+
// Object-literal key order is owned by `sort-keys-shorthand` (shorthand-first);
|
|
35
|
+
// keep this off to avoid a conflicting second sorter on the same concern.
|
|
36
|
+
'perfectionist/sort-objects': 'off',
|
|
31
37
|
'perfectionist/sort-sets': ['error', SORT_OPTIONS],
|
|
32
38
|
'perfectionist/sort-union-types': ['error', SORT_OPTIONS]
|
|
33
39
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
rules: {
|
|
3
|
+
'promise/always-return': ['error', {
|
|
4
|
+
ignoreLastCallback: true
|
|
5
|
+
}],
|
|
6
|
+
'promise/avoid-new': 'off',
|
|
7
|
+
'promise/catch-or-return': 'error',
|
|
8
|
+
'promise/no-callback-in-promise': 'warn',
|
|
9
|
+
'promise/no-multiple-resolved': 'error',
|
|
10
|
+
'promise/no-native': 'off',
|
|
11
|
+
'promise/no-nesting': 'warn',
|
|
12
|
+
'promise/no-new-statics': 'error',
|
|
13
|
+
'promise/no-promise-in-callback': 'warn',
|
|
14
|
+
'promise/no-return-in-finally': 'error',
|
|
15
|
+
'promise/no-return-wrap': 'error',
|
|
16
|
+
'promise/param-names': 'error',
|
|
17
|
+
'promise/prefer-await-to-callbacks': 'off',
|
|
18
|
+
'promise/prefer-await-to-then': ['error', {
|
|
19
|
+
strict: true
|
|
20
|
+
}],
|
|
21
|
+
'promise/prefer-catch': 'error',
|
|
22
|
+
'promise/spec-only': 'error',
|
|
23
|
+
'promise/valid-params': 'error'
|
|
24
|
+
}
|
|
25
|
+
};
|