@agilebot/eslint-config 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +58 -13
- package/dist/index.js +522 -24
- package/package.json +8 -5
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
@@ -1,33 +1,78 @@
|
|
1
1
|
import { Linter } from 'eslint';
|
2
2
|
|
3
3
|
interface FactoryOptions {
|
4
|
-
/**
|
4
|
+
/**
|
5
|
+
* ESLint configuration
|
6
|
+
* @default undefined
|
7
|
+
*/
|
5
8
|
config?: Pick<Linter.Config, 'rules' | 'settings'>;
|
6
|
-
/**
|
9
|
+
/**
|
10
|
+
* List of development dependencies
|
11
|
+
* @default undefined
|
12
|
+
*/
|
7
13
|
devDependencies?: string[];
|
8
|
-
/**
|
14
|
+
/**
|
15
|
+
* List of core modules
|
16
|
+
* @default undefined
|
17
|
+
*/
|
9
18
|
coreModules?: string[];
|
10
|
-
/**
|
19
|
+
/**
|
20
|
+
* List of words to include in cspell
|
21
|
+
* @default undefined
|
22
|
+
*/
|
11
23
|
cspellWords?: string[];
|
12
|
-
/**
|
24
|
+
/**
|
25
|
+
* Monorepo scope
|
26
|
+
* @default undefined
|
27
|
+
*/
|
13
28
|
monorepoScope?: string;
|
14
|
-
/**
|
29
|
+
/**
|
30
|
+
* Flag indicating whether to enable React configurations
|
31
|
+
* @default undefined
|
32
|
+
*/
|
15
33
|
react?: boolean | string;
|
16
|
-
/**
|
34
|
+
/**
|
35
|
+
* Version of Vue.js (optional)
|
36
|
+
* @default undefined
|
37
|
+
*/
|
17
38
|
vue?: number;
|
18
|
-
/**
|
39
|
+
/**
|
40
|
+
* Flag indicating whether ES modules are used
|
41
|
+
* @default undefined
|
42
|
+
*/
|
19
43
|
module?: boolean;
|
20
|
-
/**
|
44
|
+
/**
|
45
|
+
* Flag indicating whether to enable GoDaddy configurations
|
46
|
+
* @default undefined
|
47
|
+
*/
|
21
48
|
godaddy?: boolean;
|
22
|
-
/**
|
49
|
+
/**
|
50
|
+
* Flag indicating whether to enable JSDoc configurations
|
51
|
+
* @default true
|
52
|
+
*/
|
23
53
|
jsdoc?: boolean;
|
24
|
-
/**
|
54
|
+
/**
|
55
|
+
* Flag indicating whether to enable Prettier configurations
|
56
|
+
* @default true
|
57
|
+
*/
|
25
58
|
prettier?: boolean;
|
26
|
-
/**
|
59
|
+
/**
|
60
|
+
* Flag indicating whether to enable Lodash configurations
|
61
|
+
* @default true
|
62
|
+
*/
|
27
63
|
lodash?: boolean;
|
28
|
-
/**
|
64
|
+
/**
|
65
|
+
* Flag indicating whether to enable CSpell configurations
|
66
|
+
* @default true
|
67
|
+
*/
|
29
68
|
cspell?: boolean;
|
69
|
+
/**
|
70
|
+
* Flag indicating whether to enable imports configurations
|
71
|
+
* @default true
|
72
|
+
*/
|
73
|
+
import?: boolean;
|
30
74
|
}
|
75
|
+
|
31
76
|
declare function factory(root: string, options?: FactoryOptions): Linter.BaseConfig;
|
32
77
|
|
33
78
|
export { factory as agilebot };
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-config v0.3.
|
2
|
+
* @license @agilebot/eslint-config v0.3.3
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -31,6 +31,12 @@ var __spreadValues = (a, b) => {
|
|
31
31
|
return a;
|
32
32
|
};
|
33
33
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
34
|
+
var __esm = (fn, res) => function __init() {
|
35
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
36
|
+
};
|
37
|
+
var __commonJS = (cb, mod) => function __require() {
|
38
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
39
|
+
};
|
34
40
|
var __export = (target, all) => {
|
35
41
|
for (var name in all)
|
36
42
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -53,18 +59,443 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
53
59
|
));
|
54
60
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
55
61
|
|
62
|
+
// ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_ts-node@10.9.2_@types+node@20.11.28_typescript@5.4.5__typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
|
63
|
+
var init_cjs_shims = __esm({
|
64
|
+
"../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_ts-node@10.9.2_@types+node@20.11.28_typescript@5.4.5__typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
|
65
|
+
"use strict";
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
// ../../node_modules/.pnpm/eslint-config-love@47.0.0_@typescript-eslint+eslint-plugin@7.7.1_@typescript-eslint+parser@7._nvsvomvnm2mebs7lqn5uaqsxna/node_modules/eslint-config-love/lib/index.js
|
70
|
+
var require_lib = __commonJS({
|
71
|
+
"../../node_modules/.pnpm/eslint-config-love@47.0.0_@typescript-eslint+eslint-plugin@7.7.1_@typescript-eslint+parser@7._nvsvomvnm2mebs7lqn5uaqsxna/node_modules/eslint-config-love/lib/index.js"(exports2, module2) {
|
72
|
+
"use strict";
|
73
|
+
init_cjs_shims();
|
74
|
+
var eslint_1 = require("eslint");
|
75
|
+
var rules = {
|
76
|
+
"@typescript-eslint/adjacent-overload-signatures": ["error"],
|
77
|
+
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
|
78
|
+
"@typescript-eslint/await-thenable": ["error"],
|
79
|
+
"@typescript-eslint/ban-ts-comment": ["error", {
|
80
|
+
"ts-expect-error": "allow-with-description",
|
81
|
+
"ts-ignore": true,
|
82
|
+
"ts-nocheck": true,
|
83
|
+
"ts-check": false,
|
84
|
+
minimumDescriptionLength: 3
|
85
|
+
}],
|
86
|
+
"@typescript-eslint/ban-tslint-comment": ["error"],
|
87
|
+
"@typescript-eslint/ban-types": ["error", {
|
88
|
+
extendDefaults: false,
|
89
|
+
types: {
|
90
|
+
String: {
|
91
|
+
message: "Use string instead",
|
92
|
+
fixWith: "string"
|
93
|
+
},
|
94
|
+
Boolean: {
|
95
|
+
message: "Use boolean instead",
|
96
|
+
fixWith: "boolean"
|
97
|
+
},
|
98
|
+
Number: {
|
99
|
+
message: "Use number instead",
|
100
|
+
fixWith: "number"
|
101
|
+
},
|
102
|
+
Symbol: {
|
103
|
+
message: "Use symbol instead",
|
104
|
+
fixWith: "symbol"
|
105
|
+
},
|
106
|
+
BigInt: {
|
107
|
+
message: "Use bigint instead",
|
108
|
+
fixWith: "bigint"
|
109
|
+
},
|
110
|
+
Function: {
|
111
|
+
message: [
|
112
|
+
"The `Function` type accepts any function-like value.",
|
113
|
+
"It provides no type safety when calling the function, which can be a common source of bugs.",
|
114
|
+
"It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.",
|
115
|
+
"If you are expecting the function to accept certain arguments, you should explicitly define the function shape."
|
116
|
+
].join("\n")
|
117
|
+
},
|
118
|
+
// object typing
|
119
|
+
Object: {
|
120
|
+
message: [
|
121
|
+
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
|
122
|
+
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
|
123
|
+
'- If you want a type meaning "any value", you probably want `unknown` instead.'
|
124
|
+
].join("\n")
|
125
|
+
},
|
126
|
+
"{}": {
|
127
|
+
message: [
|
128
|
+
'`{}` actually means "any non-nullish value".',
|
129
|
+
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
|
130
|
+
'- If you want a type meaning "any value", you probably want `unknown` instead.'
|
131
|
+
].join("\n")
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}],
|
135
|
+
"@typescript-eslint/block-spacing": ["error", "always"],
|
136
|
+
"@typescript-eslint/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
137
|
+
"@typescript-eslint/class-literal-property-style": ["error", "fields"],
|
138
|
+
"@typescript-eslint/comma-dangle": ["error", {
|
139
|
+
arrays: "never",
|
140
|
+
objects: "never",
|
141
|
+
imports: "never",
|
142
|
+
exports: "never",
|
143
|
+
functions: "never",
|
144
|
+
enums: "ignore",
|
145
|
+
generics: "ignore",
|
146
|
+
tuples: "ignore"
|
147
|
+
}],
|
148
|
+
"@typescript-eslint/comma-spacing": ["error", { before: false, after: true }],
|
149
|
+
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
|
150
|
+
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
151
|
+
"@typescript-eslint/consistent-type-assertions": [
|
152
|
+
"error",
|
153
|
+
{
|
154
|
+
assertionStyle: "as",
|
155
|
+
objectLiteralTypeAssertions: "never"
|
156
|
+
}
|
157
|
+
],
|
158
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
159
|
+
"@typescript-eslint/consistent-type-exports": ["error", {
|
160
|
+
fixMixedExportsWithInlineTypeSpecifier: true
|
161
|
+
}],
|
162
|
+
"@typescript-eslint/consistent-type-imports": ["error", {
|
163
|
+
prefer: "type-imports",
|
164
|
+
disallowTypeAnnotations: true,
|
165
|
+
fixStyle: "inline-type-imports"
|
166
|
+
}],
|
167
|
+
"@typescript-eslint/dot-notation": [
|
168
|
+
"error",
|
169
|
+
{
|
170
|
+
allowIndexSignaturePropertyAccess: false,
|
171
|
+
allowKeywords: true,
|
172
|
+
allowPattern: "",
|
173
|
+
allowPrivateClassPropertyAccess: false,
|
174
|
+
allowProtectedClassPropertyAccess: false
|
175
|
+
}
|
176
|
+
],
|
177
|
+
"@typescript-eslint/explicit-function-return-type": ["error", {
|
178
|
+
allowExpressions: true,
|
179
|
+
allowHigherOrderFunctions: true,
|
180
|
+
allowTypedFunctionExpressions: true,
|
181
|
+
allowDirectConstAssertionInArrowFunctions: true
|
182
|
+
}],
|
183
|
+
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
184
|
+
"@typescript-eslint/indent": ["error", 2, {
|
185
|
+
SwitchCase: 1,
|
186
|
+
VariableDeclarator: 1,
|
187
|
+
outerIIFEBody: 1,
|
188
|
+
MemberExpression: 1,
|
189
|
+
FunctionDeclaration: { parameters: 1, body: 1 },
|
190
|
+
FunctionExpression: { parameters: 1, body: 1 },
|
191
|
+
CallExpression: { arguments: 1 },
|
192
|
+
ArrayExpression: 1,
|
193
|
+
ObjectExpression: 1,
|
194
|
+
ImportDeclaration: 1,
|
195
|
+
flatTernaryExpressions: false,
|
196
|
+
ignoreComments: false,
|
197
|
+
ignoredNodes: [
|
198
|
+
"TemplateLiteral *",
|
199
|
+
"JSXElement",
|
200
|
+
"JSXElement > *",
|
201
|
+
"JSXAttribute",
|
202
|
+
"JSXIdentifier",
|
203
|
+
"JSXNamespacedName",
|
204
|
+
"JSXMemberExpression",
|
205
|
+
"JSXSpreadAttribute",
|
206
|
+
"JSXExpressionContainer",
|
207
|
+
"JSXOpeningElement",
|
208
|
+
"JSXClosingElement",
|
209
|
+
"JSXFragment",
|
210
|
+
"JSXOpeningFragment",
|
211
|
+
"JSXClosingFragment",
|
212
|
+
"JSXText",
|
213
|
+
"JSXEmptyExpression",
|
214
|
+
"JSXSpreadChild"
|
215
|
+
],
|
216
|
+
offsetTernaryExpressions: true
|
217
|
+
}],
|
218
|
+
"@typescript-eslint/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
219
|
+
"@typescript-eslint/keyword-spacing": ["error", { before: true, after: true }],
|
220
|
+
"@typescript-eslint/lines-between-class-members": ["error", "always", { exceptAfterOverload: true, exceptAfterSingleLine: true }],
|
221
|
+
"@typescript-eslint/member-delimiter-style": [
|
222
|
+
"error",
|
223
|
+
{
|
224
|
+
multiline: { delimiter: "none" },
|
225
|
+
singleline: { delimiter: "comma", requireLast: false }
|
226
|
+
}
|
227
|
+
],
|
228
|
+
"@typescript-eslint/method-signature-style": ["error"],
|
229
|
+
"@typescript-eslint/naming-convention": ["error", {
|
230
|
+
selector: "variableLike",
|
231
|
+
leadingUnderscore: "allow",
|
232
|
+
trailingUnderscore: "allow",
|
233
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"]
|
234
|
+
}],
|
235
|
+
"@typescript-eslint/no-array-constructor": ["error"],
|
236
|
+
"@typescript-eslint/no-base-to-string": ["error"],
|
237
|
+
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: false, ignoreVoidOperator: false }],
|
238
|
+
"@typescript-eslint/no-dupe-class-members": ["error"],
|
239
|
+
"@typescript-eslint/no-dynamic-delete": ["error"],
|
240
|
+
"@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }],
|
241
|
+
"@typescript-eslint/no-extra-non-null-assertion": ["error"],
|
242
|
+
"@typescript-eslint/no-extra-parens": ["error", "functions"],
|
243
|
+
"@typescript-eslint/no-extraneous-class": ["error", { allowWithDecorator: true }],
|
244
|
+
"@typescript-eslint/no-floating-promises": ["error"],
|
245
|
+
"@typescript-eslint/no-for-in-array": ["error"],
|
246
|
+
"@typescript-eslint/no-implied-eval": ["error"],
|
247
|
+
"@typescript-eslint/no-invalid-void-type": ["error"],
|
248
|
+
"@typescript-eslint/no-loss-of-precision": ["error"],
|
249
|
+
"@typescript-eslint/no-misused-new": ["error"],
|
250
|
+
"@typescript-eslint/no-misused-promises": ["error"],
|
251
|
+
"@typescript-eslint/no-namespace": ["error"],
|
252
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": ["error"],
|
253
|
+
"@typescript-eslint/no-non-null-assertion": ["error"],
|
254
|
+
"@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
|
255
|
+
"@typescript-eslint/no-this-alias": ["error", { allowDestructuring: true }],
|
256
|
+
"@typescript-eslint/no-throw-literal": ["error"],
|
257
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error"],
|
258
|
+
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
|
259
|
+
"@typescript-eslint/no-unnecessary-type-constraint": ["error"],
|
260
|
+
"@typescript-eslint/no-unsafe-argument": ["error"],
|
261
|
+
"@typescript-eslint/no-unused-expressions": ["error", {
|
262
|
+
allowShortCircuit: true,
|
263
|
+
allowTernary: true,
|
264
|
+
allowTaggedTemplates: true,
|
265
|
+
enforceForJSX: false
|
266
|
+
}],
|
267
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
268
|
+
args: "none",
|
269
|
+
caughtErrors: "none",
|
270
|
+
ignoreRestSiblings: true,
|
271
|
+
vars: "all"
|
272
|
+
}],
|
273
|
+
"@typescript-eslint/no-use-before-define": ["error", {
|
274
|
+
functions: false,
|
275
|
+
classes: false,
|
276
|
+
enums: false,
|
277
|
+
variables: false,
|
278
|
+
typedefs: false
|
279
|
+
}],
|
280
|
+
"@typescript-eslint/no-useless-constructor": ["error"],
|
281
|
+
"@typescript-eslint/no-var-requires": ["error"],
|
282
|
+
"@typescript-eslint/non-nullable-type-assertion-style": ["error"],
|
283
|
+
"@typescript-eslint/object-curly-spacing": ["error", "always"],
|
284
|
+
"@typescript-eslint/prefer-function-type": ["error"],
|
285
|
+
"@typescript-eslint/prefer-includes": ["error"],
|
286
|
+
"@typescript-eslint/prefer-nullish-coalescing": ["error", { ignoreConditionalTests: false, ignoreMixedLogicalExpressions: false }],
|
287
|
+
"@typescript-eslint/prefer-optional-chain": ["error"],
|
288
|
+
"@typescript-eslint/prefer-promise-reject-errors": ["error"],
|
289
|
+
"@typescript-eslint/prefer-readonly": ["error"],
|
290
|
+
"@typescript-eslint/prefer-reduce-type-parameter": ["error"],
|
291
|
+
"@typescript-eslint/prefer-return-this-type": ["error"],
|
292
|
+
"@typescript-eslint/prefer-ts-expect-error": ["error"],
|
293
|
+
"@typescript-eslint/promise-function-async": ["error"],
|
294
|
+
"@typescript-eslint/quotes": ["error", "single", { avoidEscape: true, allowTemplateLiterals: false }],
|
295
|
+
"@typescript-eslint/require-array-sort-compare": ["error", { ignoreStringArrays: true }],
|
296
|
+
"@typescript-eslint/restrict-plus-operands": ["error", { skipCompoundAssignments: false }],
|
297
|
+
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
298
|
+
"@typescript-eslint/return-await": ["error", "always"],
|
299
|
+
"@typescript-eslint/semi": ["error", "never"],
|
300
|
+
"@typescript-eslint/space-before-blocks": ["error", "always"],
|
301
|
+
"@typescript-eslint/space-before-function-paren": ["error", "always"],
|
302
|
+
"@typescript-eslint/space-infix-ops": ["error"],
|
303
|
+
"@typescript-eslint/strict-boolean-expressions": ["error", {
|
304
|
+
allowString: false,
|
305
|
+
allowNumber: false,
|
306
|
+
allowNullableObject: false,
|
307
|
+
allowNullableBoolean: false,
|
308
|
+
allowNullableString: false,
|
309
|
+
allowNullableNumber: false,
|
310
|
+
allowAny: false
|
311
|
+
}],
|
312
|
+
"@typescript-eslint/triple-slash-reference": ["error", { lib: "never", path: "never", types: "never" }],
|
313
|
+
"@typescript-eslint/type-annotation-spacing": ["error"],
|
314
|
+
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: false }],
|
315
|
+
"accessor-pairs": ["error", { setWithoutGet: true, getWithoutSet: false, enforceForClassMembers: true }],
|
316
|
+
"array-bracket-spacing": ["error", "never"],
|
317
|
+
"array-callback-return": ["error", {
|
318
|
+
allowImplicit: false,
|
319
|
+
allowVoid: false,
|
320
|
+
checkForEach: false
|
321
|
+
}],
|
322
|
+
"arrow-spacing": ["error", { before: true, after: true }],
|
323
|
+
"comma-style": ["error", "last"],
|
324
|
+
"computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
325
|
+
"constructor-super": ["error"],
|
326
|
+
curly: ["error", "multi-line"],
|
327
|
+
"default-case-last": ["error"],
|
328
|
+
"dot-location": ["error", "property"],
|
329
|
+
"eol-last": ["error"],
|
330
|
+
eqeqeq: ["error", "always", { null: "ignore" }],
|
331
|
+
"generator-star-spacing": ["error", { before: true, after: true }],
|
332
|
+
"multiline-ternary": ["error", "always-multiline"],
|
333
|
+
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
334
|
+
"new-parens": ["error"],
|
335
|
+
"no-async-promise-executor": ["error"],
|
336
|
+
"no-caller": ["error"],
|
337
|
+
"no-case-declarations": ["error"],
|
338
|
+
"no-class-assign": ["error"],
|
339
|
+
"no-compare-neg-zero": ["error"],
|
340
|
+
"no-cond-assign": ["error"],
|
341
|
+
"no-const-assign": ["error"],
|
342
|
+
"no-constant-condition": ["error", { checkLoops: false }],
|
343
|
+
"no-control-regex": ["error"],
|
344
|
+
"no-debugger": ["error"],
|
345
|
+
"no-delete-var": ["error"],
|
346
|
+
"no-dupe-args": ["error"],
|
347
|
+
"no-dupe-keys": ["error"],
|
348
|
+
"no-duplicate-case": ["error"],
|
349
|
+
"no-useless-backreference": ["error"],
|
350
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
351
|
+
"no-empty-character-class": ["error"],
|
352
|
+
"no-empty-pattern": ["error"],
|
353
|
+
"no-eval": ["error"],
|
354
|
+
"no-ex-assign": ["error"],
|
355
|
+
"no-extend-native": ["error"],
|
356
|
+
"no-extra-bind": ["error"],
|
357
|
+
"no-extra-boolean-cast": ["error"],
|
358
|
+
"no-fallthrough": ["error"],
|
359
|
+
"no-floating-decimal": ["error"],
|
360
|
+
"no-func-assign": ["error"],
|
361
|
+
"no-global-assign": ["error"],
|
362
|
+
"no-import-assign": ["error"],
|
363
|
+
"no-invalid-regexp": ["error"],
|
364
|
+
"no-irregular-whitespace": ["error"],
|
365
|
+
"no-iterator": ["error"],
|
366
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
367
|
+
"no-lone-blocks": ["error"],
|
368
|
+
"no-misleading-character-class": ["error"],
|
369
|
+
"no-prototype-builtins": ["error"],
|
370
|
+
"no-useless-catch": ["error"],
|
371
|
+
"no-mixed-operators": ["error", {
|
372
|
+
groups: [
|
373
|
+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
374
|
+
["&&", "||"],
|
375
|
+
["in", "instanceof"]
|
376
|
+
],
|
377
|
+
allowSamePrecedence: true
|
378
|
+
}],
|
379
|
+
"no-mixed-spaces-and-tabs": ["error"],
|
380
|
+
"no-multi-spaces": ["error"],
|
381
|
+
"no-multi-str": ["error"],
|
382
|
+
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
383
|
+
"no-new": ["error"],
|
384
|
+
"no-new-func": ["error"],
|
385
|
+
"no-new-object": ["error"],
|
386
|
+
"no-new-symbol": ["error"],
|
387
|
+
"no-new-wrappers": ["error"],
|
388
|
+
"no-obj-calls": ["error"],
|
389
|
+
"no-octal": ["error"],
|
390
|
+
"no-octal-escape": ["error"],
|
391
|
+
"no-proto": ["error"],
|
392
|
+
"no-regex-spaces": ["error"],
|
393
|
+
"no-return-assign": ["error", "except-parens"],
|
394
|
+
"no-self-assign": ["error", { props: true }],
|
395
|
+
"no-self-compare": ["error"],
|
396
|
+
"no-sequences": ["error"],
|
397
|
+
"no-shadow-restricted-names": ["error"],
|
398
|
+
"no-sparse-arrays": ["error"],
|
399
|
+
"no-tabs": ["error"],
|
400
|
+
"no-template-curly-in-string": ["error"],
|
401
|
+
"no-this-before-super": ["error"],
|
402
|
+
"no-trailing-spaces": ["error"],
|
403
|
+
"no-undef-init": ["error"],
|
404
|
+
"no-unexpected-multiline": ["error"],
|
405
|
+
"no-unmodified-loop-condition": ["error"],
|
406
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
407
|
+
"no-unreachable": ["error"],
|
408
|
+
"no-unreachable-loop": ["error"],
|
409
|
+
"no-unsafe-finally": ["error"],
|
410
|
+
"no-unsafe-negation": ["error"],
|
411
|
+
"no-useless-call": ["error"],
|
412
|
+
"no-useless-computed-key": ["error"],
|
413
|
+
"no-useless-escape": ["error"],
|
414
|
+
"no-useless-rename": ["error"],
|
415
|
+
"no-useless-return": ["error"],
|
416
|
+
"no-var": ["warn"],
|
417
|
+
"no-void": ["error", { allowAsStatement: true }],
|
418
|
+
"no-whitespace-before-property": ["error"],
|
419
|
+
"no-with": ["error"],
|
420
|
+
"object-curly-newline": ["error", { multiline: true, consistent: true }],
|
421
|
+
"object-property-newline": ["error", { allowMultiplePropertiesPerLine: true, allowAllPropertiesOnSameLine: false }],
|
422
|
+
"object-shorthand": ["warn", "properties"],
|
423
|
+
"one-var": ["error", { initialized: "never" }],
|
424
|
+
"operator-linebreak": ["error", "after", { overrides: { "?": "before", ":": "before", "|>": "before" } }],
|
425
|
+
"padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
|
426
|
+
"prefer-const": ["error", { destructuring: "all", ignoreReadBeforeAssign: false }],
|
427
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
428
|
+
"quote-props": ["error", "as-needed"],
|
429
|
+
"rest-spread-spacing": ["error", "never"],
|
430
|
+
"semi-spacing": ["error", { before: false, after: true }],
|
431
|
+
"space-in-parens": ["error", "never"],
|
432
|
+
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
433
|
+
"spaced-comment": ["error", "always", {
|
434
|
+
line: { markers: ["*package", "!", "/", ",", "="] },
|
435
|
+
block: { balanced: true, markers: ["*package", "!", ",", ":", "::", "flow-include"], exceptions: ["*"] }
|
436
|
+
}],
|
437
|
+
"symbol-description": ["error"],
|
438
|
+
"template-curly-spacing": ["error", "never"],
|
439
|
+
"template-tag-spacing": ["error", "never"],
|
440
|
+
"unicode-bom": ["error", "never"],
|
441
|
+
"use-isnan": ["error", {
|
442
|
+
enforceForSwitchCase: true,
|
443
|
+
enforceForIndexOf: true
|
444
|
+
}],
|
445
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
446
|
+
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
447
|
+
"yield-star-spacing": ["error", "both"],
|
448
|
+
yoda: ["error", "never"],
|
449
|
+
"import/export": ["error"],
|
450
|
+
"import/first": ["error"],
|
451
|
+
"import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
|
452
|
+
"import/no-duplicates": ["error"],
|
453
|
+
"import/no-named-default": ["error"],
|
454
|
+
"import/no-webpack-loader-syntax": ["error"],
|
455
|
+
"n/handle-callback-err": ["error", "^(err|error)$"],
|
456
|
+
"n/no-callback-literal": ["error"],
|
457
|
+
"n/no-deprecated-api": ["error"],
|
458
|
+
"n/no-exports-assign": ["error"],
|
459
|
+
"n/no-new-require": ["error"],
|
460
|
+
"n/no-path-concat": ["error"],
|
461
|
+
"n/process-exit-as-throw": ["error"],
|
462
|
+
"promise/param-names": ["error"]
|
463
|
+
};
|
464
|
+
var eslintRuleNames = [...new eslint_1.Linter().getRules().keys()];
|
465
|
+
var namesOfEslintRulesForWhichWeAreUsingTsEquivalents = eslintRuleNames.filter((name) => Object.hasOwn(rules, `@typescript-eslint/${name}`));
|
466
|
+
var config = {
|
467
|
+
plugins: [
|
468
|
+
"@typescript-eslint",
|
469
|
+
"import",
|
470
|
+
"n",
|
471
|
+
"promise"
|
472
|
+
],
|
473
|
+
parser: "@typescript-eslint/parser",
|
474
|
+
parserOptions: {
|
475
|
+
project: true
|
476
|
+
},
|
477
|
+
rules: __spreadValues(__spreadValues({}, Object.fromEntries(namesOfEslintRulesForWhichWeAreUsingTsEquivalents.map((name) => [name, ["off"]]))), rules)
|
478
|
+
};
|
479
|
+
module2.exports = config;
|
480
|
+
}
|
481
|
+
});
|
482
|
+
|
56
483
|
// src/index.ts
|
57
484
|
var src_exports = {};
|
58
485
|
__export(src_exports, {
|
59
486
|
agilebot: () => factory
|
60
487
|
});
|
61
488
|
module.exports = __toCommonJS(src_exports);
|
489
|
+
init_cjs_shims();
|
490
|
+
var import_eslint_bulk_suppressions = require("@rushstack/eslint-patch/eslint-bulk-suppressions");
|
62
491
|
|
63
492
|
// src/factory/index.ts
|
493
|
+
init_cjs_shims();
|
64
494
|
var import_node_assert = __toESM(require("assert"));
|
65
495
|
var import_eslint_utils3 = require("@agilebot/eslint-utils");
|
66
496
|
|
67
497
|
// src/configs/env.ts
|
498
|
+
init_cjs_shims();
|
68
499
|
function env() {
|
69
500
|
return {
|
70
501
|
env: {
|
@@ -79,7 +510,8 @@ function env() {
|
|
79
510
|
}
|
80
511
|
|
81
512
|
// src/configs/standard.ts
|
82
|
-
|
513
|
+
init_cjs_shims();
|
514
|
+
var import_eslint_config_love = __toESM(require_lib());
|
83
515
|
function standard() {
|
84
516
|
const standardRules = {};
|
85
517
|
Object.entries(import_eslint_config_love.default.rules).forEach(([key, value]) => {
|
@@ -133,6 +565,7 @@ function standard() {
|
|
133
565
|
}
|
134
566
|
|
135
567
|
// src/configs/ts.ts
|
568
|
+
init_cjs_shims();
|
136
569
|
var import_eslint_utils = require("@agilebot/eslint-utils");
|
137
570
|
function ts() {
|
138
571
|
return {
|
@@ -235,11 +668,12 @@ function ts() {
|
|
235
668
|
};
|
236
669
|
}
|
237
670
|
|
238
|
-
// src/configs/
|
671
|
+
// src/configs/imports.ts
|
672
|
+
init_cjs_shims();
|
239
673
|
var import_node_path = __toESM(require("path"));
|
240
674
|
var import_node_fs = __toESM(require("fs"));
|
241
675
|
var import_eslint_utils2 = require("@agilebot/eslint-utils");
|
242
|
-
function
|
676
|
+
function imports(opts) {
|
243
677
|
var _a, _b;
|
244
678
|
const rootDir = (0, import_eslint_utils2.findRootDir)(__dirname);
|
245
679
|
const pkgPath = import_node_path.default.join(opts.packageDir, "package.json");
|
@@ -347,6 +781,7 @@ function eslintImport(opts) {
|
|
347
781
|
}
|
348
782
|
|
349
783
|
// src/configs/unicorn.ts
|
784
|
+
init_cjs_shims();
|
350
785
|
function unicorn(opts) {
|
351
786
|
return {
|
352
787
|
plugins: ["unicorn"],
|
@@ -385,20 +820,74 @@ function unicorn(opts) {
|
|
385
820
|
}
|
386
821
|
|
387
822
|
// src/configs/react.ts
|
823
|
+
init_cjs_shims();
|
388
824
|
function react(opts) {
|
389
825
|
return {
|
390
|
-
plugins: [
|
391
|
-
|
392
|
-
"
|
393
|
-
"
|
394
|
-
"
|
395
|
-
"
|
826
|
+
plugins: [
|
827
|
+
"react",
|
828
|
+
"@eslint-react",
|
829
|
+
"react-hooks",
|
830
|
+
"jsx-a11y",
|
831
|
+
"@stylistic"
|
396
832
|
],
|
833
|
+
extends: ["plugin:jsx-a11y/recommended"],
|
397
834
|
rules: {
|
398
|
-
//
|
399
|
-
"react/jsx-no-
|
400
|
-
|
401
|
-
"react/jsx-
|
835
|
+
// recommended rules from eslint-plugin-react
|
836
|
+
"react/jsx-no-duplicate-props": "error",
|
837
|
+
"react/jsx-no-undef": "error",
|
838
|
+
"react/jsx-uses-react": "error",
|
839
|
+
"react/jsx-uses-vars": "error",
|
840
|
+
"react/no-is-mounted": "error",
|
841
|
+
"react/no-unescaped-entities": "error",
|
842
|
+
"react/no-unknown-property": "error",
|
843
|
+
"react/react-in-jsx-scope": "error",
|
844
|
+
"react/require-render-return": "error",
|
845
|
+
// recommended rules from @eslint-react
|
846
|
+
"@eslint-react/no-direct-mutation-state": "error",
|
847
|
+
"@eslint-react/no-children-count": "warn",
|
848
|
+
"@eslint-react/no-children-for-each": "warn",
|
849
|
+
"@eslint-react/no-children-map": "warn",
|
850
|
+
"@eslint-react/no-children-only": "warn",
|
851
|
+
"@eslint-react/no-children-prop": "error",
|
852
|
+
"@eslint-react/no-children-to-array": "warn",
|
853
|
+
"@eslint-react/no-clone-element": "warn",
|
854
|
+
"@eslint-react/no-class-component": "error",
|
855
|
+
"@eslint-react/no-string-refs": "error",
|
856
|
+
"@eslint-react/no-missing-key": "error",
|
857
|
+
"@eslint-react/no-array-index-key": "warn",
|
858
|
+
"@eslint-react/no-duplicate-key": "error",
|
859
|
+
"@eslint-react/no-comment-textnodes": "error",
|
860
|
+
"@eslint-react/no-component-will-mount": "error",
|
861
|
+
"@eslint-react/no-component-will-receive-props": "error",
|
862
|
+
"@eslint-react/no-component-will-update": "error",
|
863
|
+
"@eslint-react/no-unsafe-component-will-mount": "warn",
|
864
|
+
"@eslint-react/no-unsafe-component-will-receive-props": "warn",
|
865
|
+
"@eslint-react/no-unsafe-component-will-update": "warn",
|
866
|
+
// '@eslint-react/no-unstable-context-value': 'error',
|
867
|
+
// '@eslint-react/no-unstable-default-props': 'error',
|
868
|
+
"@eslint-react/ensure-forward-ref-using-ref": "warn",
|
869
|
+
"@eslint-react/no-create-ref": "error",
|
870
|
+
"@eslint-react/no-nested-components": "warn",
|
871
|
+
"@eslint-react/no-redundant-should-component-update": "error",
|
872
|
+
"@eslint-react/no-set-state-in-component-did-mount": "warn",
|
873
|
+
"@eslint-react/no-set-state-in-component-did-update": "warn",
|
874
|
+
"@eslint-react/no-set-state-in-component-will-update": "warn",
|
875
|
+
"@eslint-react/prefer-shorthand-boolean": "error",
|
876
|
+
"@eslint-react/no-access-state-in-setstate": "error",
|
877
|
+
"@eslint-react/prefer-shorthand-fragment": "error",
|
878
|
+
"@eslint-react/no-missing-component-display-name": "error",
|
879
|
+
// recommended rules from @eslint-react/dom
|
880
|
+
"@eslint-react/dom/no-children-in-void-dom-elements": "error",
|
881
|
+
"@eslint-react/dom/no-unsafe-target-blank": "error",
|
882
|
+
"@eslint-react/dom/no-dangerously-set-innerhtml": "error",
|
883
|
+
"@eslint-react/dom/no-dangerously-set-innerhtml-with-children": "error",
|
884
|
+
"@eslint-react/dom/no-find-dom-node": "error",
|
885
|
+
"@eslint-react/dom/no-render-return-value": "error",
|
886
|
+
// recommended rules from @eslint-react/hooks-extra
|
887
|
+
"@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
888
|
+
// recommended rules react-hooks
|
889
|
+
"react-hooks/rules-of-hooks": "error",
|
890
|
+
// 以下是自定义规则
|
402
891
|
"react/jsx-handler-names": [
|
403
892
|
"error",
|
404
893
|
{
|
@@ -409,9 +898,6 @@ function react(opts) {
|
|
409
898
|
],
|
410
899
|
// useState必须以[example, setExample]命名
|
411
900
|
"react/hook-use-state": "error",
|
412
|
-
// 避免使用数组的 index 来作为 key 属性的值
|
413
|
-
"react/no-array-index-key": "error",
|
414
|
-
"react/self-closing-comp": "error",
|
415
901
|
// 组件命名符合帕斯卡
|
416
902
|
"react/jsx-pascal-case": [
|
417
903
|
"error",
|
@@ -419,8 +905,6 @@ function react(opts) {
|
|
419
905
|
allowNamespace: true
|
420
906
|
}
|
421
907
|
],
|
422
|
-
// 布尔属性如果为true,省略值
|
423
|
-
"react/jsx-boolean-value": "error",
|
424
908
|
// 已经有ts校验,此规则没有必要,会与带静态属性的Functional Component冲突
|
425
909
|
"react/prop-types": "off",
|
426
910
|
// <App prop={'Hello'} />没必要,使用<App prop="Hello" />
|
@@ -434,8 +918,8 @@ function react(opts) {
|
|
434
918
|
],
|
435
919
|
// 禁止声明未使用的props
|
436
920
|
"react/no-unused-prop-types": "error",
|
437
|
-
|
438
|
-
"
|
921
|
+
"@eslint-react/no-useless-fragment": "error",
|
922
|
+
"@stylistic/jsx-self-closing-comp": "error",
|
439
923
|
"jsx-a11y/click-events-have-key-events": "off",
|
440
924
|
"jsx-a11y/no-static-element-interactions": "off",
|
441
925
|
"jsx-a11y/alt-text": "off"
|
@@ -449,6 +933,7 @@ function react(opts) {
|
|
449
933
|
}
|
450
934
|
|
451
935
|
// src/configs/vue.ts
|
936
|
+
init_cjs_shims();
|
452
937
|
function vue(opts) {
|
453
938
|
return {
|
454
939
|
extends: [
|
@@ -458,6 +943,7 @@ function vue(opts) {
|
|
458
943
|
}
|
459
944
|
|
460
945
|
// src/configs/jsdoc.ts
|
946
|
+
init_cjs_shims();
|
461
947
|
function jsdoc(opt) {
|
462
948
|
return {
|
463
949
|
plugins: ["jsdoc"],
|
@@ -478,6 +964,7 @@ function jsdoc(opt) {
|
|
478
964
|
}
|
479
965
|
|
480
966
|
// src/configs/lodash.ts
|
967
|
+
init_cjs_shims();
|
481
968
|
function lodash() {
|
482
969
|
return {
|
483
970
|
// lodash一些方法可能影响性能,如forEach等,优先使用js的原生方法
|
@@ -486,6 +973,7 @@ function lodash() {
|
|
486
973
|
}
|
487
974
|
|
488
975
|
// src/configs/comments.ts
|
976
|
+
init_cjs_shims();
|
489
977
|
function comments() {
|
490
978
|
return {
|
491
979
|
plugins: ["eslint-comments"],
|
@@ -510,6 +998,7 @@ function comments() {
|
|
510
998
|
}
|
511
999
|
|
512
1000
|
// src/configs/deprecation.ts
|
1001
|
+
init_cjs_shims();
|
513
1002
|
function deprecation() {
|
514
1003
|
return {
|
515
1004
|
plugins: ["deprecation"],
|
@@ -521,6 +1010,7 @@ function deprecation() {
|
|
521
1010
|
}
|
522
1011
|
|
523
1012
|
// src/configs/cspell.ts
|
1013
|
+
init_cjs_shims();
|
524
1014
|
function cspell(opts) {
|
525
1015
|
return {
|
526
1016
|
plugins: ["@cspell"],
|
@@ -540,6 +1030,7 @@ function cspell(opts) {
|
|
540
1030
|
}
|
541
1031
|
|
542
1032
|
// src/configs/agilebot.ts
|
1033
|
+
init_cjs_shims();
|
543
1034
|
function agilebot(opts) {
|
544
1035
|
return {
|
545
1036
|
extends: ["plugin:@agilebot/recommended"],
|
@@ -574,6 +1065,7 @@ function agilebot(opts) {
|
|
574
1065
|
}
|
575
1066
|
|
576
1067
|
// src/configs/prettier.ts
|
1068
|
+
init_cjs_shims();
|
577
1069
|
var import_recommended = __toESM(require("eslint-plugin-prettier/recommended"));
|
578
1070
|
function prettier() {
|
579
1071
|
return {
|
@@ -594,6 +1086,7 @@ function prettier() {
|
|
594
1086
|
}
|
595
1087
|
|
596
1088
|
// src/configs/godaddy.ts
|
1089
|
+
init_cjs_shims();
|
597
1090
|
function godaddy() {
|
598
1091
|
return {
|
599
1092
|
extends: ["godaddy"],
|
@@ -620,6 +1113,7 @@ function godaddy() {
|
|
620
1113
|
}
|
621
1114
|
|
622
1115
|
// src/factory/constants.ts
|
1116
|
+
init_cjs_shims();
|
623
1117
|
var defaultExtensions = [
|
624
1118
|
".js",
|
625
1119
|
".jsx",
|
@@ -643,7 +1137,8 @@ function factory(root, options) {
|
|
643
1137
|
jsdoc: true,
|
644
1138
|
prettier: true,
|
645
1139
|
lodash: true,
|
646
|
-
cspell: true
|
1140
|
+
cspell: true,
|
1141
|
+
import: true
|
647
1142
|
};
|
648
1143
|
options = __spreadValues(__spreadValues({}, defaultOptions), options);
|
649
1144
|
if (options == null ? void 0 : options.config) {
|
@@ -659,12 +1154,12 @@ function factory(root, options) {
|
|
659
1154
|
module: (_a = options == null ? void 0 : options.module) != null ? _a : false
|
660
1155
|
}),
|
661
1156
|
comments(),
|
662
|
-
|
1157
|
+
options.import ? imports({
|
663
1158
|
packageDir: root,
|
664
1159
|
devDependencies: options == null ? void 0 : options.devDependencies,
|
665
1160
|
monorepoScope: options == null ? void 0 : options.monorepoScope,
|
666
1161
|
coreModules: options == null ? void 0 : options.coreModules
|
667
|
-
}),
|
1162
|
+
}) : {},
|
668
1163
|
options.prettier ? prettier() : {}
|
669
1164
|
];
|
670
1165
|
if (options == null ? void 0 : options.godaddy) {
|
@@ -685,6 +1180,9 @@ function factory(root, options) {
|
|
685
1180
|
parserOptions: {
|
686
1181
|
parser: "@typescript-eslint/parser",
|
687
1182
|
tsconfigRootDir: root,
|
1183
|
+
ecmaFeatures: {
|
1184
|
+
jsx: true
|
1185
|
+
},
|
688
1186
|
extraFileExtensions: !(options == null ? void 0 : options.vue) ? void 0 : [".vue"]
|
689
1187
|
}
|
690
1188
|
}, (0, import_eslint_utils3.mergeESLintConfig)(
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-config",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.3",
|
4
4
|
"description": "Agilebot's ESLint config",
|
5
5
|
"bin": {
|
6
6
|
"eslint-agilebot": "bin/eslint-agilebot"
|
@@ -19,11 +19,12 @@
|
|
19
19
|
"homepage": "https://github.com/sh-agilebot/frontend-toolkit/tree/master/packages/eslint-config#readme",
|
20
20
|
"dependencies": {
|
21
21
|
"@cspell/eslint-plugin": "^8.7.0",
|
22
|
+
"@eslint-react/eslint-plugin": "^1.5.10",
|
23
|
+
"@rushstack/eslint-patch": "^1.10.2",
|
22
24
|
"@stylistic/eslint-plugin": "^1.7.0",
|
23
25
|
"@typescript-eslint/eslint-plugin": "~7.7.0",
|
24
26
|
"@typescript-eslint/parser": "~7.7.0",
|
25
27
|
"eslint-config-godaddy": "^6.0.0",
|
26
|
-
"eslint-config-love": "^47.0.0",
|
27
28
|
"eslint-config-prettier": "^9.1.0",
|
28
29
|
"eslint-import-resolver-typescript": "^3.6.1",
|
29
30
|
"eslint-plugin-deprecation": "^2.0.0",
|
@@ -39,17 +40,19 @@
|
|
39
40
|
"eslint-plugin-promise": "^6.0.0",
|
40
41
|
"eslint-plugin-react": "^7.34.1",
|
41
42
|
"eslint-plugin-react-hooks": "^4.6.0",
|
42
|
-
"eslint-plugin-react-prefer-function-component": "^3.3.0",
|
43
43
|
"eslint-plugin-unicorn": "^52.0.0",
|
44
44
|
"eslint-plugin-unused-imports": "^3.2.0",
|
45
45
|
"eslint-plugin-vue": "^9.25.0",
|
46
46
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
47
47
|
"vue-eslint-parser": "^9.4.2",
|
48
|
-
"@agilebot/eslint-utils": "0.3.
|
48
|
+
"@agilebot/eslint-utils": "0.3.3"
|
49
|
+
},
|
50
|
+
"devDependencies": {
|
51
|
+
"eslint-config-love": "^47.0.0"
|
49
52
|
},
|
50
53
|
"peerDependencies": {
|
51
54
|
"eslint": "^7.0.0 || ^8.0.0",
|
52
|
-
"@agilebot/eslint-plugin": "0.3.
|
55
|
+
"@agilebot/eslint-plugin": "0.3.3"
|
53
56
|
},
|
54
57
|
"files": [
|
55
58
|
"bin",
|