@agilebot/eslint-config 0.3.2 → 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 -25
- package/package.json +7 -4
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,19 +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
|
-
"
|
826
|
+
plugins: [
|
827
|
+
"react",
|
828
|
+
"@eslint-react",
|
829
|
+
"react-hooks",
|
830
|
+
"jsx-a11y",
|
831
|
+
"@stylistic"
|
395
832
|
],
|
833
|
+
extends: ["plugin:jsx-a11y/recommended"],
|
396
834
|
rules: {
|
397
|
-
//
|
398
|
-
"react/jsx-no-
|
399
|
-
|
400
|
-
"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
|
+
// 以下是自定义规则
|
401
891
|
"react/jsx-handler-names": [
|
402
892
|
"error",
|
403
893
|
{
|
@@ -408,9 +898,6 @@ function react(opts) {
|
|
408
898
|
],
|
409
899
|
// useState必须以[example, setExample]命名
|
410
900
|
"react/hook-use-state": "error",
|
411
|
-
// 避免使用数组的 index 来作为 key 属性的值
|
412
|
-
"react/no-array-index-key": "error",
|
413
|
-
"react/self-closing-comp": "error",
|
414
901
|
// 组件命名符合帕斯卡
|
415
902
|
"react/jsx-pascal-case": [
|
416
903
|
"error",
|
@@ -418,8 +905,6 @@ function react(opts) {
|
|
418
905
|
allowNamespace: true
|
419
906
|
}
|
420
907
|
],
|
421
|
-
// 布尔属性如果为true,省略值
|
422
|
-
"react/jsx-boolean-value": "error",
|
423
908
|
// 已经有ts校验,此规则没有必要,会与带静态属性的Functional Component冲突
|
424
909
|
"react/prop-types": "off",
|
425
910
|
// <App prop={'Hello'} />没必要,使用<App prop="Hello" />
|
@@ -433,10 +918,8 @@ function react(opts) {
|
|
433
918
|
],
|
434
919
|
// 禁止声明未使用的props
|
435
920
|
"react/no-unused-prop-types": "error",
|
436
|
-
|
437
|
-
"
|
438
|
-
"@eslint-react/no-class-component": "error",
|
439
|
-
"@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "error",
|
921
|
+
"@eslint-react/no-useless-fragment": "error",
|
922
|
+
"@stylistic/jsx-self-closing-comp": "error",
|
440
923
|
"jsx-a11y/click-events-have-key-events": "off",
|
441
924
|
"jsx-a11y/no-static-element-interactions": "off",
|
442
925
|
"jsx-a11y/alt-text": "off"
|
@@ -450,6 +933,7 @@ function react(opts) {
|
|
450
933
|
}
|
451
934
|
|
452
935
|
// src/configs/vue.ts
|
936
|
+
init_cjs_shims();
|
453
937
|
function vue(opts) {
|
454
938
|
return {
|
455
939
|
extends: [
|
@@ -459,6 +943,7 @@ function vue(opts) {
|
|
459
943
|
}
|
460
944
|
|
461
945
|
// src/configs/jsdoc.ts
|
946
|
+
init_cjs_shims();
|
462
947
|
function jsdoc(opt) {
|
463
948
|
return {
|
464
949
|
plugins: ["jsdoc"],
|
@@ -479,6 +964,7 @@ function jsdoc(opt) {
|
|
479
964
|
}
|
480
965
|
|
481
966
|
// src/configs/lodash.ts
|
967
|
+
init_cjs_shims();
|
482
968
|
function lodash() {
|
483
969
|
return {
|
484
970
|
// lodash一些方法可能影响性能,如forEach等,优先使用js的原生方法
|
@@ -487,6 +973,7 @@ function lodash() {
|
|
487
973
|
}
|
488
974
|
|
489
975
|
// src/configs/comments.ts
|
976
|
+
init_cjs_shims();
|
490
977
|
function comments() {
|
491
978
|
return {
|
492
979
|
plugins: ["eslint-comments"],
|
@@ -511,6 +998,7 @@ function comments() {
|
|
511
998
|
}
|
512
999
|
|
513
1000
|
// src/configs/deprecation.ts
|
1001
|
+
init_cjs_shims();
|
514
1002
|
function deprecation() {
|
515
1003
|
return {
|
516
1004
|
plugins: ["deprecation"],
|
@@ -522,6 +1010,7 @@ function deprecation() {
|
|
522
1010
|
}
|
523
1011
|
|
524
1012
|
// src/configs/cspell.ts
|
1013
|
+
init_cjs_shims();
|
525
1014
|
function cspell(opts) {
|
526
1015
|
return {
|
527
1016
|
plugins: ["@cspell"],
|
@@ -541,6 +1030,7 @@ function cspell(opts) {
|
|
541
1030
|
}
|
542
1031
|
|
543
1032
|
// src/configs/agilebot.ts
|
1033
|
+
init_cjs_shims();
|
544
1034
|
function agilebot(opts) {
|
545
1035
|
return {
|
546
1036
|
extends: ["plugin:@agilebot/recommended"],
|
@@ -575,6 +1065,7 @@ function agilebot(opts) {
|
|
575
1065
|
}
|
576
1066
|
|
577
1067
|
// src/configs/prettier.ts
|
1068
|
+
init_cjs_shims();
|
578
1069
|
var import_recommended = __toESM(require("eslint-plugin-prettier/recommended"));
|
579
1070
|
function prettier() {
|
580
1071
|
return {
|
@@ -595,6 +1086,7 @@ function prettier() {
|
|
595
1086
|
}
|
596
1087
|
|
597
1088
|
// src/configs/godaddy.ts
|
1089
|
+
init_cjs_shims();
|
598
1090
|
function godaddy() {
|
599
1091
|
return {
|
600
1092
|
extends: ["godaddy"],
|
@@ -621,6 +1113,7 @@ function godaddy() {
|
|
621
1113
|
}
|
622
1114
|
|
623
1115
|
// src/factory/constants.ts
|
1116
|
+
init_cjs_shims();
|
624
1117
|
var defaultExtensions = [
|
625
1118
|
".js",
|
626
1119
|
".jsx",
|
@@ -644,7 +1137,8 @@ function factory(root, options) {
|
|
644
1137
|
jsdoc: true,
|
645
1138
|
prettier: true,
|
646
1139
|
lodash: true,
|
647
|
-
cspell: true
|
1140
|
+
cspell: true,
|
1141
|
+
import: true
|
648
1142
|
};
|
649
1143
|
options = __spreadValues(__spreadValues({}, defaultOptions), options);
|
650
1144
|
if (options == null ? void 0 : options.config) {
|
@@ -660,12 +1154,12 @@ function factory(root, options) {
|
|
660
1154
|
module: (_a = options == null ? void 0 : options.module) != null ? _a : false
|
661
1155
|
}),
|
662
1156
|
comments(),
|
663
|
-
|
1157
|
+
options.import ? imports({
|
664
1158
|
packageDir: root,
|
665
1159
|
devDependencies: options == null ? void 0 : options.devDependencies,
|
666
1160
|
monorepoScope: options == null ? void 0 : options.monorepoScope,
|
667
1161
|
coreModules: options == null ? void 0 : options.coreModules
|
668
|
-
}),
|
1162
|
+
}) : {},
|
669
1163
|
options.prettier ? prettier() : {}
|
670
1164
|
];
|
671
1165
|
if (options == null ? void 0 : options.godaddy) {
|
@@ -686,6 +1180,9 @@ function factory(root, options) {
|
|
686
1180
|
parserOptions: {
|
687
1181
|
parser: "@typescript-eslint/parser",
|
688
1182
|
tsconfigRootDir: root,
|
1183
|
+
ecmaFeatures: {
|
1184
|
+
jsx: true
|
1185
|
+
},
|
689
1186
|
extraFileExtensions: !(options == null ? void 0 : options.vue) ? void 0 : [".vue"]
|
690
1187
|
}
|
691
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"
|
@@ -20,11 +20,11 @@
|
|
20
20
|
"dependencies": {
|
21
21
|
"@cspell/eslint-plugin": "^8.7.0",
|
22
22
|
"@eslint-react/eslint-plugin": "^1.5.10",
|
23
|
+
"@rushstack/eslint-patch": "^1.10.2",
|
23
24
|
"@stylistic/eslint-plugin": "^1.7.0",
|
24
25
|
"@typescript-eslint/eslint-plugin": "~7.7.0",
|
25
26
|
"@typescript-eslint/parser": "~7.7.0",
|
26
27
|
"eslint-config-godaddy": "^6.0.0",
|
27
|
-
"eslint-config-love": "^47.0.0",
|
28
28
|
"eslint-config-prettier": "^9.1.0",
|
29
29
|
"eslint-import-resolver-typescript": "^3.6.1",
|
30
30
|
"eslint-plugin-deprecation": "^2.0.0",
|
@@ -45,11 +45,14 @@
|
|
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",
|