@agilebot/eslint-config 0.8.10 → 0.9.0
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/LICENSE +9 -9
- package/README.md +52 -52
- package/bin/eslint-agilebot +1 -1
- package/dist/cli.js +16 -22
- package/dist/{constants-ChB_LdP2.mjs → constants-D6y7pnqv.js} +0 -9
- package/dist/index.d.ts +4 -18
- package/dist/index.js +155 -182
- package/package.json +6 -7
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -92
- package/dist/constants-U8EdftFI.js +0 -150
- package/dist/index.d.mts +0 -125
- package/dist/index.mjs +0 -1169
package/dist/index.mjs
DELETED
@@ -1,1169 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.8.10
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
9
|
-
|
10
|
-
import { DEFAULT_GLOBS, DTS_GLOBS, IGNORE_GLOBS, JS_GLOBS, TS_GLOBS, VUE_GLOBS } from "./constants-ChB_LdP2.mjs";
|
11
|
-
import { findCacheDir, findRootDir, findTsconfigFiles, isInEditor } from "@agilebot/eslint-utils";
|
12
|
-
import path from "node:path";
|
13
|
-
import assert from "node:assert";
|
14
|
-
import { fileURLToPath } from "node:url";
|
15
|
-
import * as parserTs from "@typescript-eslint/parser";
|
16
|
-
import * as parserVue from "vue-eslint-parser";
|
17
|
-
import globals from "globals";
|
18
|
-
import pluginImport from "eslint-plugin-import-x";
|
19
|
-
import pluginNode from "eslint-plugin-n";
|
20
|
-
import pluginPromise from "eslint-plugin-promise";
|
21
|
-
import * as pluginTs$1 from "@typescript-eslint/eslint-plugin";
|
22
|
-
import pluginTs from "@typescript-eslint/eslint-plugin";
|
23
|
-
import pluginStylistic from "@stylistic/eslint-plugin";
|
24
|
-
import pluginPreferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
25
|
-
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
26
|
-
import pluginReactEdge from "eslint-plugin-react-edge";
|
27
|
-
import fs from "node:fs";
|
28
|
-
import pluginNoRelativeImportPaths from "eslint-plugin-no-relative-import-paths";
|
29
|
-
import pluginUnicorn from "eslint-plugin-unicorn";
|
30
|
-
import pluginReact from "eslint-plugin-react";
|
31
|
-
import pluginReactX from "@eslint-react/eslint-plugin";
|
32
|
-
import * as pluginReactHooks$1 from "eslint-plugin-react-hooks";
|
33
|
-
import * as pluginReactHooks from "eslint-plugin-react-hooks";
|
34
|
-
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
35
|
-
import pluginAgilebot from "@agilebot/eslint-plugin";
|
36
|
-
import pluginVue from "eslint-plugin-vue";
|
37
|
-
import pluginJsdoc from "eslint-plugin-jsdoc";
|
38
|
-
import pluginLodash from "eslint-plugin-you-dont-need-lodash-underscore";
|
39
|
-
import { fixupPluginRules } from "@eslint/compat";
|
40
|
-
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
41
|
-
import pluginCSpell from "@cspell/eslint-plugin";
|
42
|
-
import prettierRecommended from "eslint-plugin-prettier/recommended";
|
43
|
-
import pluginPrettier from "eslint-plugin-prettier";
|
44
|
-
import configGodaddy from "eslint-config-godaddy";
|
45
|
-
import js from "@eslint/js";
|
46
|
-
import pluginMocha from "eslint-plugin-mocha";
|
47
|
-
|
48
|
-
//#region src/configs/env.ts
|
49
|
-
function env() {
|
50
|
-
return {
|
51
|
-
name: "agilebot/env",
|
52
|
-
files: DEFAULT_GLOBS,
|
53
|
-
languageOptions: { globals: {
|
54
|
-
...globals.browser,
|
55
|
-
...globals.node,
|
56
|
-
...globals.es2015,
|
57
|
-
...globals.mocha,
|
58
|
-
...globals.jest,
|
59
|
-
...globals.jasmine
|
60
|
-
} }
|
61
|
-
};
|
62
|
-
}
|
63
|
-
|
64
|
-
//#endregion
|
65
|
-
//#region src/configs/standard.ts
|
66
|
-
function standard() {
|
67
|
-
const standardRules = {};
|
68
|
-
const originalStdRules = {
|
69
|
-
"class-methods-use-this": ["off"],
|
70
|
-
"dot-notation": ["off"],
|
71
|
-
"init-declarations": ["off"],
|
72
|
-
"max-params": ["off"],
|
73
|
-
"no-array-constructor": ["off"],
|
74
|
-
"no-dupe-class-members": ["off"],
|
75
|
-
"no-empty-function": ["off"],
|
76
|
-
"no-implied-eval": ["off"],
|
77
|
-
"no-loop-func": ["off"],
|
78
|
-
"no-magic-numbers": ["off"],
|
79
|
-
"no-unused-expressions": ["off"],
|
80
|
-
"no-unused-vars": ["off"],
|
81
|
-
"no-use-before-define": ["off"],
|
82
|
-
"no-useless-constructor": ["off"],
|
83
|
-
"prefer-destructuring": ["off"],
|
84
|
-
"prefer-promise-reject-errors": ["off"],
|
85
|
-
"accessor-pairs": ["error", {
|
86
|
-
"setWithoutGet": true,
|
87
|
-
"getWithoutSet": false,
|
88
|
-
"enforceForClassMembers": true
|
89
|
-
}],
|
90
|
-
"array-callback-return": ["error", {
|
91
|
-
"allowImplicit": false,
|
92
|
-
"allowVoid": false,
|
93
|
-
"checkForEach": false
|
94
|
-
}],
|
95
|
-
"constructor-super": ["error"],
|
96
|
-
"curly": ["error", "multi-line"],
|
97
|
-
"default-case-last": ["error"],
|
98
|
-
"eqeqeq": [
|
99
|
-
"error",
|
100
|
-
"always",
|
101
|
-
{ "null": "ignore" }
|
102
|
-
],
|
103
|
-
"new-cap": ["error", {
|
104
|
-
"newIsCap": true,
|
105
|
-
"capIsNew": false,
|
106
|
-
"properties": true
|
107
|
-
}],
|
108
|
-
"no-async-promise-executor": ["error"],
|
109
|
-
"no-caller": ["error"],
|
110
|
-
"no-case-declarations": ["error"],
|
111
|
-
"no-class-assign": ["error"],
|
112
|
-
"no-compare-neg-zero": ["error"],
|
113
|
-
"no-cond-assign": ["error"],
|
114
|
-
"no-const-assign": ["error"],
|
115
|
-
"no-constant-condition": ["error", { "checkLoops": false }],
|
116
|
-
"no-control-regex": ["error"],
|
117
|
-
"no-debugger": ["error"],
|
118
|
-
"no-delete-var": ["error"],
|
119
|
-
"no-dupe-args": ["error"],
|
120
|
-
"no-dupe-keys": ["error"],
|
121
|
-
"no-duplicate-case": ["error"],
|
122
|
-
"no-useless-backreference": ["error"],
|
123
|
-
"no-empty": ["error", { "allowEmptyCatch": true }],
|
124
|
-
"no-empty-character-class": ["error"],
|
125
|
-
"no-empty-pattern": ["error"],
|
126
|
-
"no-eval": ["error"],
|
127
|
-
"no-ex-assign": ["error"],
|
128
|
-
"no-extend-native": ["error"],
|
129
|
-
"no-extra-bind": ["error"],
|
130
|
-
"no-extra-boolean-cast": ["error"],
|
131
|
-
"no-fallthrough": ["error"],
|
132
|
-
"no-func-assign": ["error"],
|
133
|
-
"no-global-assign": ["error"],
|
134
|
-
"no-import-assign": ["error"],
|
135
|
-
"no-invalid-regexp": ["error"],
|
136
|
-
"no-irregular-whitespace": ["error"],
|
137
|
-
"no-iterator": ["error"],
|
138
|
-
"no-labels": ["error", {
|
139
|
-
"allowLoop": false,
|
140
|
-
"allowSwitch": false
|
141
|
-
}],
|
142
|
-
"no-lone-blocks": ["error"],
|
143
|
-
"no-loss-of-precision": ["error"],
|
144
|
-
"no-misleading-character-class": ["error"],
|
145
|
-
"no-prototype-builtins": ["error"],
|
146
|
-
"no-useless-catch": ["error"],
|
147
|
-
"no-multi-str": ["error"],
|
148
|
-
"no-new": ["error"],
|
149
|
-
"no-new-func": ["error"],
|
150
|
-
"no-new-native-nonconstructor": ["error"],
|
151
|
-
"no-new-wrappers": ["error"],
|
152
|
-
"no-obj-calls": ["error"],
|
153
|
-
"no-object-constructor": ["error"],
|
154
|
-
"no-octal": ["error"],
|
155
|
-
"no-octal-escape": ["error"],
|
156
|
-
"no-proto": ["error"],
|
157
|
-
"no-regex-spaces": ["error"],
|
158
|
-
"no-return-assign": ["error", "except-parens"],
|
159
|
-
"no-self-assign": ["error", { "props": true }],
|
160
|
-
"no-self-compare": ["error"],
|
161
|
-
"no-sequences": ["error"],
|
162
|
-
"no-shadow-restricted-names": ["error"],
|
163
|
-
"no-sparse-arrays": ["error"],
|
164
|
-
"no-template-curly-in-string": ["error"],
|
165
|
-
"no-this-before-super": ["error"],
|
166
|
-
"no-throw-literal": ["off"],
|
167
|
-
"no-unexpected-multiline": ["error"],
|
168
|
-
"no-unmodified-loop-condition": ["error"],
|
169
|
-
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
|
170
|
-
"no-unreachable": ["error"],
|
171
|
-
"no-unreachable-loop": ["error"],
|
172
|
-
"no-unsafe-finally": ["error"],
|
173
|
-
"no-unsafe-negation": ["error"],
|
174
|
-
"no-useless-call": ["error"],
|
175
|
-
"no-useless-computed-key": ["error"],
|
176
|
-
"no-useless-escape": ["error"],
|
177
|
-
"no-useless-rename": ["error"],
|
178
|
-
"no-useless-return": ["error"],
|
179
|
-
"no-var": ["error"],
|
180
|
-
"no-void": ["error", { "allowAsStatement": true }],
|
181
|
-
"no-with": ["error"],
|
182
|
-
"object-shorthand": ["warn", "properties"],
|
183
|
-
"one-var": ["error", { "initialized": "never" }],
|
184
|
-
"prefer-const": ["error", {
|
185
|
-
"destructuring": "all",
|
186
|
-
"ignoreReadBeforeAssign": false
|
187
|
-
}],
|
188
|
-
"prefer-regex-literals": ["error", { "disallowRedundantWrapping": true }],
|
189
|
-
"symbol-description": ["error"],
|
190
|
-
"unicode-bom": ["error", "never"],
|
191
|
-
"use-isnan": ["error", {
|
192
|
-
"enforceForSwitchCase": true,
|
193
|
-
"enforceForIndexOf": true
|
194
|
-
}],
|
195
|
-
"valid-typeof": ["error", { "requireStringLiterals": true }],
|
196
|
-
"yoda": ["error", "never"],
|
197
|
-
"import/export": ["error"],
|
198
|
-
"import/first": ["error"],
|
199
|
-
"import/no-absolute-path": ["error", {
|
200
|
-
"esmodule": true,
|
201
|
-
"commonjs": true,
|
202
|
-
"amd": false
|
203
|
-
}],
|
204
|
-
"import/no-duplicates": ["error"],
|
205
|
-
"import/no-named-default": ["error"],
|
206
|
-
"import/no-webpack-loader-syntax": ["error"],
|
207
|
-
"n/handle-callback-err": ["error", "^(err|error)$"],
|
208
|
-
"n/no-callback-literal": ["error"],
|
209
|
-
"n/no-deprecated-api": ["error"],
|
210
|
-
"n/no-exports-assign": ["error"],
|
211
|
-
"n/no-new-require": ["error"],
|
212
|
-
"n/no-path-concat": ["error"],
|
213
|
-
"n/process-exit-as-throw": ["error"],
|
214
|
-
"promise/param-names": ["error"],
|
215
|
-
"@typescript-eslint/adjacent-overload-signatures": ["error"],
|
216
|
-
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
|
217
|
-
"@typescript-eslint/await-thenable": ["error"],
|
218
|
-
"@typescript-eslint/ban-ts-comment": ["error", {
|
219
|
-
"ts-expect-error": "allow-with-description",
|
220
|
-
"ts-ignore": true,
|
221
|
-
"ts-nocheck": true,
|
222
|
-
"ts-check": false,
|
223
|
-
"minimumDescriptionLength": 3
|
224
|
-
}],
|
225
|
-
"@typescript-eslint/ban-tslint-comment": ["error"],
|
226
|
-
"@typescript-eslint/class-literal-property-style": ["error", "fields"],
|
227
|
-
"@typescript-eslint/class-methods-use-this": ["error", {
|
228
|
-
"exceptMethods": [],
|
229
|
-
"enforceForClassFields": true,
|
230
|
-
"ignoreOverrideMethods": false,
|
231
|
-
"ignoreClassesThatImplementAnInterface": false
|
232
|
-
}],
|
233
|
-
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
|
234
|
-
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
235
|
-
"@typescript-eslint/consistent-type-assertions": ["error", {
|
236
|
-
"assertionStyle": "as",
|
237
|
-
"objectLiteralTypeAssertions": "never"
|
238
|
-
}],
|
239
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
240
|
-
"@typescript-eslint/consistent-type-exports": ["error", { "fixMixedExportsWithInlineTypeSpecifier": true }],
|
241
|
-
"@typescript-eslint/consistent-type-imports": ["error", {
|
242
|
-
"prefer": "type-imports",
|
243
|
-
"disallowTypeAnnotations": true,
|
244
|
-
"fixStyle": "inline-type-imports"
|
245
|
-
}],
|
246
|
-
"@typescript-eslint/dot-notation": ["error", {
|
247
|
-
"allowIndexSignaturePropertyAccess": false,
|
248
|
-
"allowKeywords": true,
|
249
|
-
"allowPattern": "",
|
250
|
-
"allowPrivateClassPropertyAccess": false,
|
251
|
-
"allowProtectedClassPropertyAccess": false
|
252
|
-
}],
|
253
|
-
"@typescript-eslint/explicit-function-return-type": ["error", {
|
254
|
-
"allowExpressions": true,
|
255
|
-
"allowHigherOrderFunctions": true,
|
256
|
-
"allowTypedFunctionExpressions": true,
|
257
|
-
"allowDirectConstAssertionInArrowFunctions": true
|
258
|
-
}],
|
259
|
-
"@typescript-eslint/init-declarations": ["error", "always"],
|
260
|
-
"@typescript-eslint/max-params": ["error", { "max": 4 }],
|
261
|
-
"@typescript-eslint/method-signature-style": ["error"],
|
262
|
-
"@typescript-eslint/naming-convention": ["error", {
|
263
|
-
"selector": "variableLike",
|
264
|
-
"leadingUnderscore": "allow",
|
265
|
-
"trailingUnderscore": "allow",
|
266
|
-
"format": [
|
267
|
-
"camelCase",
|
268
|
-
"PascalCase",
|
269
|
-
"UPPER_CASE"
|
270
|
-
]
|
271
|
-
}],
|
272
|
-
"@typescript-eslint/no-array-constructor": ["error"],
|
273
|
-
"@typescript-eslint/no-array-delete": ["error"],
|
274
|
-
"@typescript-eslint/no-base-to-string": ["error"],
|
275
|
-
"@typescript-eslint/no-confusing-non-null-assertion": ["error"],
|
276
|
-
"@typescript-eslint/no-confusing-void-expression": ["error", {
|
277
|
-
"ignoreArrowShorthand": false,
|
278
|
-
"ignoreVoidOperator": false
|
279
|
-
}],
|
280
|
-
"@typescript-eslint/no-deprecated": ["warn"],
|
281
|
-
"@typescript-eslint/no-dupe-class-members": ["error"],
|
282
|
-
"@typescript-eslint/no-duplicate-enum-values": ["error"],
|
283
|
-
"@typescript-eslint/no-duplicate-type-constituents": ["error", {
|
284
|
-
"ignoreIntersections": false,
|
285
|
-
"ignoreUnions": false
|
286
|
-
}],
|
287
|
-
"@typescript-eslint/no-dynamic-delete": ["error"],
|
288
|
-
"@typescript-eslint/no-empty-function": ["error", { "allow": [] }],
|
289
|
-
"@typescript-eslint/no-empty-object-type": ["error", {
|
290
|
-
"allowInterfaces": "with-single-extends",
|
291
|
-
"allowObjectTypes": "never"
|
292
|
-
}],
|
293
|
-
"@typescript-eslint/no-explicit-any": ["error", {
|
294
|
-
"fixToUnknown": false,
|
295
|
-
"ignoreRestArgs": false
|
296
|
-
}],
|
297
|
-
"@typescript-eslint/no-extra-non-null-assertion": ["error"],
|
298
|
-
"@typescript-eslint/no-extraneous-class": ["error", { "allowWithDecorator": true }],
|
299
|
-
"@typescript-eslint/no-floating-promises": ["error"],
|
300
|
-
"@typescript-eslint/no-for-in-array": ["error"],
|
301
|
-
"@typescript-eslint/no-implied-eval": ["error"],
|
302
|
-
"@typescript-eslint/no-import-type-side-effects": ["error"],
|
303
|
-
"@typescript-eslint/no-inferrable-types": ["error", {
|
304
|
-
"ignoreParameters": false,
|
305
|
-
"ignoreProperties": false
|
306
|
-
}],
|
307
|
-
"@typescript-eslint/no-invalid-void-type": ["error"],
|
308
|
-
"@typescript-eslint/no-loop-func": ["error"],
|
309
|
-
"@typescript-eslint/no-magic-numbers": ["error", {
|
310
|
-
"ignore": [],
|
311
|
-
"ignoreArrayIndexes": false,
|
312
|
-
"ignoreDefaultValues": false,
|
313
|
-
"ignoreClassFieldInitialValues": false,
|
314
|
-
"enforceConst": false,
|
315
|
-
"detectObjects": true,
|
316
|
-
"ignoreEnums": true,
|
317
|
-
"ignoreNumericLiteralTypes": false,
|
318
|
-
"ignoreReadonlyClassProperties": true,
|
319
|
-
"ignoreTypeIndexes": false
|
320
|
-
}],
|
321
|
-
"@typescript-eslint/no-meaningless-void-operator": ["error", { "checkNever": true }],
|
322
|
-
"@typescript-eslint/no-misused-new": ["error"],
|
323
|
-
"@typescript-eslint/no-misused-promises": ["error"],
|
324
|
-
"@typescript-eslint/no-mixed-enums": ["error"],
|
325
|
-
"@typescript-eslint/no-namespace": ["error"],
|
326
|
-
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": ["error"],
|
327
|
-
"@typescript-eslint/no-non-null-asserted-optional-chain": ["error"],
|
328
|
-
"@typescript-eslint/no-non-null-assertion": ["error"],
|
329
|
-
"@typescript-eslint/no-redundant-type-constituents": ["error"],
|
330
|
-
"@typescript-eslint/no-require-imports": ["error", {
|
331
|
-
"allow": [],
|
332
|
-
"allowAsImport": false
|
333
|
-
}],
|
334
|
-
"@typescript-eslint/no-this-alias": ["error", { "allowDestructuring": true }],
|
335
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error"],
|
336
|
-
"@typescript-eslint/no-unnecessary-condition": ["error", { "allowConstantLoopConditions": true }],
|
337
|
-
"@typescript-eslint/no-unnecessary-parameter-property-assignment": ["error"],
|
338
|
-
"@typescript-eslint/no-unnecessary-qualifier": ["error"],
|
339
|
-
"@typescript-eslint/no-unnecessary-template-expression": ["error"],
|
340
|
-
"@typescript-eslint/no-unnecessary-type-arguments": ["error"],
|
341
|
-
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
|
342
|
-
"@typescript-eslint/no-unnecessary-type-constraint": ["error"],
|
343
|
-
"@typescript-eslint/no-unnecessary-type-parameters": ["error"],
|
344
|
-
"@typescript-eslint/no-unsafe-argument": ["error"],
|
345
|
-
"@typescript-eslint/no-unsafe-assignment": ["error"],
|
346
|
-
"@typescript-eslint/no-unsafe-call": ["error"],
|
347
|
-
"@typescript-eslint/no-unsafe-declaration-merging": ["error"],
|
348
|
-
"@typescript-eslint/no-unsafe-enum-comparison": ["error"],
|
349
|
-
"@typescript-eslint/no-unsafe-function-type": ["error"],
|
350
|
-
"@typescript-eslint/no-unsafe-member-access": ["error"],
|
351
|
-
"@typescript-eslint/no-unsafe-return": ["error"],
|
352
|
-
"@typescript-eslint/no-unsafe-unary-minus": ["error"],
|
353
|
-
"@typescript-eslint/no-unused-expressions": ["error", {
|
354
|
-
"allowShortCircuit": true,
|
355
|
-
"allowTernary": true,
|
356
|
-
"allowTaggedTemplates": true,
|
357
|
-
"enforceForJSX": false
|
358
|
-
}],
|
359
|
-
"@typescript-eslint/no-unused-vars": ["error", {
|
360
|
-
"args": "none",
|
361
|
-
"caughtErrors": "none",
|
362
|
-
"ignoreRestSiblings": true,
|
363
|
-
"vars": "all"
|
364
|
-
}],
|
365
|
-
"@typescript-eslint/no-use-before-define": ["error", {
|
366
|
-
"functions": false,
|
367
|
-
"classes": false,
|
368
|
-
"enums": false,
|
369
|
-
"variables": false,
|
370
|
-
"typedefs": false
|
371
|
-
}],
|
372
|
-
"@typescript-eslint/no-useless-constructor": ["error"],
|
373
|
-
"@typescript-eslint/no-useless-empty-export": ["error"],
|
374
|
-
"@typescript-eslint/no-wrapper-object-types": ["error"],
|
375
|
-
"@typescript-eslint/non-nullable-type-assertion-style": ["error"],
|
376
|
-
"@typescript-eslint/only-throw-error": ["error", {
|
377
|
-
"allowThrowingAny": false,
|
378
|
-
"allowThrowingUnknown": false
|
379
|
-
}],
|
380
|
-
"@typescript-eslint/prefer-as-const": ["error"],
|
381
|
-
"@typescript-eslint/prefer-destructuring": [
|
382
|
-
"error",
|
383
|
-
{
|
384
|
-
"array": true,
|
385
|
-
"object": true
|
386
|
-
},
|
387
|
-
{
|
388
|
-
"enforceForRenamedProperties": true,
|
389
|
-
"enforceForDeclarationWithTypeAnnotation": false
|
390
|
-
}
|
391
|
-
],
|
392
|
-
"@typescript-eslint/prefer-function-type": ["error"],
|
393
|
-
"@typescript-eslint/prefer-includes": ["error"],
|
394
|
-
"@typescript-eslint/prefer-nullish-coalescing": ["error", {
|
395
|
-
"ignoreConditionalTests": false,
|
396
|
-
"ignoreMixedLogicalExpressions": false
|
397
|
-
}],
|
398
|
-
"@typescript-eslint/prefer-optional-chain": ["error"],
|
399
|
-
"@typescript-eslint/prefer-promise-reject-errors": ["error"],
|
400
|
-
"@typescript-eslint/prefer-readonly": ["error"],
|
401
|
-
"@typescript-eslint/prefer-reduce-type-parameter": ["error"],
|
402
|
-
"@typescript-eslint/prefer-return-this-type": ["error"],
|
403
|
-
"@typescript-eslint/promise-function-async": ["error"],
|
404
|
-
"@typescript-eslint/require-array-sort-compare": ["error", { "ignoreStringArrays": true }],
|
405
|
-
"@typescript-eslint/restrict-plus-operands": ["error", { "skipCompoundAssignments": false }],
|
406
|
-
"@typescript-eslint/restrict-template-expressions": ["error", { "allowNumber": true }],
|
407
|
-
"@typescript-eslint/return-await": ["error", "always"],
|
408
|
-
"@typescript-eslint/strict-boolean-expressions": ["error", {
|
409
|
-
"allowString": false,
|
410
|
-
"allowNumber": false,
|
411
|
-
"allowNullableObject": false,
|
412
|
-
"allowNullableBoolean": false,
|
413
|
-
"allowNullableString": false,
|
414
|
-
"allowNullableNumber": false,
|
415
|
-
"allowAny": false
|
416
|
-
}],
|
417
|
-
"@typescript-eslint/triple-slash-reference": ["error", {
|
418
|
-
"lib": "never",
|
419
|
-
"path": "never",
|
420
|
-
"types": "never"
|
421
|
-
}],
|
422
|
-
"@typescript-eslint/unbound-method": ["error", { "ignoreStatic": false }]
|
423
|
-
};
|
424
|
-
const disabledRules = new Set(Object.values(standardDisabled()).flat());
|
425
|
-
Object.entries(originalStdRules).forEach(([key, value]) => {
|
426
|
-
if (disabledRules.has(key)) return;
|
427
|
-
if (key.startsWith("import/")) standardRules[`import-x/${key.slice(7)}`] = value;
|
428
|
-
else standardRules[key] = value;
|
429
|
-
});
|
430
|
-
return {
|
431
|
-
name: "agilebot/standard",
|
432
|
-
files: DEFAULT_GLOBS,
|
433
|
-
plugins: {
|
434
|
-
n: pluginNode,
|
435
|
-
"@typescript-eslint": pluginTs,
|
436
|
-
promise: pluginPromise,
|
437
|
-
"import-x": pluginImport
|
438
|
-
},
|
439
|
-
rules: {
|
440
|
-
...standardRules,
|
441
|
-
"no-alert": "error",
|
442
|
-
"no-warning-comments": ["warn", { terms: ["todo", "fixme"] }],
|
443
|
-
"n/no-sync": "error",
|
444
|
-
"n/prefer-promises/fs": "error",
|
445
|
-
"n/prefer-promises/dns": "error",
|
446
|
-
"n/no-path-concat": "error",
|
447
|
-
"promise/no-return-wrap": "error",
|
448
|
-
"promise/no-nesting": "error",
|
449
|
-
"promise/no-promise-in-callback": "error",
|
450
|
-
"promise/no-callback-in-promise": "error",
|
451
|
-
"promise/param-names": "error",
|
452
|
-
"promise/valid-params": "error",
|
453
|
-
"promise/no-multiple-resolved": "error",
|
454
|
-
"promise/no-return-in-finally": "error",
|
455
|
-
"promise/prefer-await-to-then": "warn",
|
456
|
-
"@typescript-eslint/max-params": ["error", { max: 5 }],
|
457
|
-
"@typescript-eslint/only-throw-error": ["error", {
|
458
|
-
allowThrowingAny: true,
|
459
|
-
allowThrowingUnknown: true
|
460
|
-
}],
|
461
|
-
"@typescript-eslint/no-loop-func": "warn",
|
462
|
-
"@typescript-eslint/prefer-nullish-coalescing": "off"
|
463
|
-
}
|
464
|
-
};
|
465
|
-
}
|
466
|
-
function standardDisabled() {
|
467
|
-
return {
|
468
|
-
uncategoized: [
|
469
|
-
"@typescript-eslint/no-extraneous-class",
|
470
|
-
"@typescript-eslint/consistent-type-assertions",
|
471
|
-
"@typescript-eslint/no-non-null-assertion"
|
472
|
-
],
|
473
|
-
"v9.0.0": ["@typescript-eslint/strict-boolean-expressions"],
|
474
|
-
"v10.0.0": ["@typescript-eslint/explicit-function-return-type"],
|
475
|
-
"v12.0.0": ["@typescript-eslint/restrict-template-expressions", "@typescript-eslint/space-before-function-paren"],
|
476
|
-
"v17.0.0": ["@typescript-eslint/no-invalid-void-type", "@typescript-eslint/method-signature-style"],
|
477
|
-
"v26.0.0": ["@typescript-eslint/no-confusing-void-expression"],
|
478
|
-
"v40.0.0": ["@typescript-eslint/unbound-method"],
|
479
|
-
"v42.0.0": ["@typescript-eslint/no-unsafe-argument"],
|
480
|
-
"v55.0.0": ["@typescript-eslint/class-methods-use-this"],
|
481
|
-
"v57.0.0": ["@typescript-eslint/init-declarations", "@typescript-eslint/no-empty-function"],
|
482
|
-
"v58.0.0": ["@typescript-eslint/no-explicit-any"],
|
483
|
-
"v64.0.0": ["@typescript-eslint/no-deprecated"],
|
484
|
-
"v65.0.0": ["@typescript-eslint/no-magic-numbers"],
|
485
|
-
"v70.0.0": ["@typescript-eslint/no-unnecessary-condition"],
|
486
|
-
"v75.0.0": ["@typescript-eslint/no-unnecessary-type-parameters"],
|
487
|
-
"v76.0.0": ["@typescript-eslint/no-unsafe-assignment"],
|
488
|
-
"v77.0.0": ["@typescript-eslint/no-unsafe-call"],
|
489
|
-
"v79.0.0": ["@typescript-eslint/no-unsafe-enum-comparison"],
|
490
|
-
"v80.0.0": ["@typescript-eslint/no-unsafe-member-access"],
|
491
|
-
"v81.0.0": ["@typescript-eslint/no-unsafe-return"],
|
492
|
-
"v82.0.0": ["@typescript-eslint/no-unsafe-unary-minus"],
|
493
|
-
"v89.0.0": ["@typescript-eslint/prefer-destructuring"]
|
494
|
-
};
|
495
|
-
}
|
496
|
-
|
497
|
-
//#endregion
|
498
|
-
//#region src/configs/ts.ts
|
499
|
-
function ts() {
|
500
|
-
return {
|
501
|
-
name: "agilebot/ts",
|
502
|
-
files: DEFAULT_GLOBS,
|
503
|
-
plugins: {
|
504
|
-
"@typescript-eslint": pluginTs$1,
|
505
|
-
"@stylistic": pluginStylistic,
|
506
|
-
"prefer-arrow-functions": pluginPreferArrowFunctions,
|
507
|
-
"unused-imports": pluginUnusedImports,
|
508
|
-
"react-edge": pluginReactEdge
|
509
|
-
},
|
510
|
-
rules: {
|
511
|
-
"@stylistic/quotes": [
|
512
|
-
"error",
|
513
|
-
"single",
|
514
|
-
{ avoidEscape: true }
|
515
|
-
],
|
516
|
-
"prefer-arrow-functions/prefer-arrow-functions": ["warn", {
|
517
|
-
allowNamedFunctions: true,
|
518
|
-
classPropertiesAllowed: false,
|
519
|
-
disallowPrototype: false,
|
520
|
-
returnStyle: "unchanged",
|
521
|
-
singleReturnOnly: false
|
522
|
-
}],
|
523
|
-
"@typescript-eslint/no-unused-vars": "off",
|
524
|
-
"unused-imports/no-unused-imports": isInEditor() ? "off" : "error",
|
525
|
-
"unused-imports/no-unused-vars": ["warn", {
|
526
|
-
args: "after-used",
|
527
|
-
argsIgnorePattern: "^_",
|
528
|
-
vars: "all",
|
529
|
-
varsIgnorePattern: "^_",
|
530
|
-
caughtErrors: "none",
|
531
|
-
caughtErrorsIgnorePattern: "^_",
|
532
|
-
destructuredArrayIgnorePattern: "^_",
|
533
|
-
ignoreRestSiblings: true
|
534
|
-
}],
|
535
|
-
"@typescript-eslint/consistent-type-definitions": "error",
|
536
|
-
"@typescript-eslint/naming-convention": [
|
537
|
-
"error",
|
538
|
-
{
|
539
|
-
selector: "function",
|
540
|
-
format: ["camelCase", "PascalCase"]
|
541
|
-
},
|
542
|
-
{
|
543
|
-
selector: "variable",
|
544
|
-
types: ["function"],
|
545
|
-
format: ["camelCase", "PascalCase"]
|
546
|
-
},
|
547
|
-
{
|
548
|
-
selector: "typeLike",
|
549
|
-
format: ["PascalCase"]
|
550
|
-
},
|
551
|
-
{
|
552
|
-
selector: "parameter",
|
553
|
-
format: ["camelCase"],
|
554
|
-
leadingUnderscore: "allow"
|
555
|
-
},
|
556
|
-
{
|
557
|
-
selector: "method",
|
558
|
-
format: ["camelCase"]
|
559
|
-
},
|
560
|
-
{
|
561
|
-
selector: "classProperty",
|
562
|
-
format: [
|
563
|
-
"camelCase",
|
564
|
-
"UPPER_CASE",
|
565
|
-
"PascalCase"
|
566
|
-
],
|
567
|
-
leadingUnderscore: "allow"
|
568
|
-
},
|
569
|
-
{
|
570
|
-
selector: "typeProperty",
|
571
|
-
format: ["camelCase"]
|
572
|
-
},
|
573
|
-
{
|
574
|
-
selector: "enum",
|
575
|
-
format: ["PascalCase"]
|
576
|
-
},
|
577
|
-
{
|
578
|
-
selector: "enumMember",
|
579
|
-
format: ["PascalCase", "UPPER_CASE"]
|
580
|
-
}
|
581
|
-
],
|
582
|
-
"@typescript-eslint/no-inferrable-types": "error",
|
583
|
-
"@typescript-eslint/require-await": "error",
|
584
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
585
|
-
"@typescript-eslint/array-type": ["error", { default: "array" }],
|
586
|
-
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
|
587
|
-
"@typescript-eslint/no-deprecated": "error",
|
588
|
-
"react-edge/var-naming": "error"
|
589
|
-
}
|
590
|
-
};
|
591
|
-
}
|
592
|
-
function tsOnly() {
|
593
|
-
return {
|
594
|
-
name: "agilebot/ts-only",
|
595
|
-
files: TS_GLOBS,
|
596
|
-
rules: {
|
597
|
-
"prefer-object-has-own": "error",
|
598
|
-
"@typescript-eslint/explicit-member-accessibility": "error"
|
599
|
-
}
|
600
|
-
};
|
601
|
-
}
|
602
|
-
function jsOnly() {
|
603
|
-
return {
|
604
|
-
name: "agilebot/js-only",
|
605
|
-
files: JS_GLOBS,
|
606
|
-
rules: { "@typescript-eslint/no-require-imports": "off" }
|
607
|
-
};
|
608
|
-
}
|
609
|
-
function dts() {
|
610
|
-
return {
|
611
|
-
name: "agilebot/dts",
|
612
|
-
files: DTS_GLOBS,
|
613
|
-
rules: {
|
614
|
-
"@typescript-eslint/consistent-type-imports": "off",
|
615
|
-
"@typescript-eslint/naming-convention": "off",
|
616
|
-
"@typescript-eslint/triple-slash-reference": "off"
|
617
|
-
}
|
618
|
-
};
|
619
|
-
}
|
620
|
-
|
621
|
-
//#endregion
|
622
|
-
//#region ../../node_modules/.pnpm/tsdown@0.12.9_typescript@5._2cdbf5dddd4c556331572eb14b496e10/node_modules/tsdown/esm-shims.js
|
623
|
-
const getFilename = () => fileURLToPath(import.meta.url);
|
624
|
-
const getDirname = () => path.dirname(getFilename());
|
625
|
-
const __dirname = /* @__PURE__ */ getDirname();
|
626
|
-
|
627
|
-
//#endregion
|
628
|
-
//#region src/configs/imports.ts
|
629
|
-
/**
|
630
|
-
* eslint-plugin-import 规则
|
631
|
-
* @param packageDir 子包路径
|
632
|
-
* @param opts 参数
|
633
|
-
*/
|
634
|
-
function imports(packageDir, opts) {
|
635
|
-
const rootDir = findRootDir(__dirname);
|
636
|
-
const pkgPath = path.join(packageDir, "package.json");
|
637
|
-
if (!fs.existsSync(pkgPath)) throw new Error(`package.json not found in ${packageDir}`);
|
638
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
639
|
-
const tmpPkg = {
|
640
|
-
name: `${pkg.name}/tmp`,
|
641
|
-
dependencies: { [pkg.name]: "*" }
|
642
|
-
};
|
643
|
-
const tmpPkgSafeName = tmpPkg.name.replace(/\//g, "__");
|
644
|
-
const cacheDir = findCacheDir(rootDir);
|
645
|
-
const tmpPkgDir = path.join(cacheDir, "tmp-pkg", tmpPkgSafeName);
|
646
|
-
if (!fs.existsSync(tmpPkgDir)) fs.mkdirSync(tmpPkgDir, { recursive: true });
|
647
|
-
const tmpPkgJson = JSON.stringify(tmpPkg, null, 2);
|
648
|
-
fs.writeFileSync(path.join(tmpPkgDir, "package.json"), tmpPkgJson);
|
649
|
-
const ignorePatterns = [String.raw`\?(react|raw|url|inline|worker|worker&inline|worker&url|sharedworker|sharedworker&inline|sharedworker&url)$`];
|
650
|
-
return {
|
651
|
-
name: "agilebot/imports",
|
652
|
-
files: DEFAULT_GLOBS,
|
653
|
-
plugins: {
|
654
|
-
"import-x": pluginImport,
|
655
|
-
"no-relative-import-paths": pluginNoRelativeImportPaths
|
656
|
-
},
|
657
|
-
rules: {
|
658
|
-
...pluginImport.configs.recommended.rules,
|
659
|
-
...pluginImport.configs.typescript.rules,
|
660
|
-
"import-x/no-unresolved": ["error", { ignore: ignorePatterns }],
|
661
|
-
"import-x/no-named-as-default-member": "off",
|
662
|
-
"import-x/no-named-as-default": "off",
|
663
|
-
"import-x/no-useless-path-segments": ["error", { noUselessIndex: true }],
|
664
|
-
"import-x/no-cycle": isInEditor() ? "off" : "error",
|
665
|
-
"import-x/newline-after-import": "error",
|
666
|
-
"import-x/first": "error",
|
667
|
-
"import-x/no-import-module-exports": "error",
|
668
|
-
"import-x/no-anonymous-default-export": ["error", {
|
669
|
-
allowArray: true,
|
670
|
-
allowObject: true
|
671
|
-
}],
|
672
|
-
"import-x/no-extraneous-dependencies": opts.allowExtraneousDependencies ? "off" : ["error", {
|
673
|
-
packageDir: [
|
674
|
-
packageDir,
|
675
|
-
tmpPkgDir,
|
676
|
-
rootDir
|
677
|
-
],
|
678
|
-
devDependencies: [
|
679
|
-
"test/**/*",
|
680
|
-
"tests/**/*",
|
681
|
-
"**/__tests__/**",
|
682
|
-
"**/*.test.{ts,tsx,js,jsx,cjs,mjs,mts,cts}",
|
683
|
-
"**/*.config.{ts,js,cjs,mjs,mts,cts}",
|
684
|
-
"**/.storybook/**",
|
685
|
-
"**/*.stories.{cts,ts,mtx,tsx,mtsx}",
|
686
|
-
"**/scripts/*.{cts,ts,mts}",
|
687
|
-
...opts.devDependencies ?? []
|
688
|
-
],
|
689
|
-
includeInternal: true
|
690
|
-
}],
|
691
|
-
"import-x/order": ["error", {
|
692
|
-
groups: [
|
693
|
-
"builtin",
|
694
|
-
"external",
|
695
|
-
"internal",
|
696
|
-
"parent",
|
697
|
-
"sibling",
|
698
|
-
"index",
|
699
|
-
"object"
|
700
|
-
],
|
701
|
-
pathGroups: [{
|
702
|
-
pattern: `${pkg.name}/**`,
|
703
|
-
group: "parent",
|
704
|
-
position: "after"
|
705
|
-
}],
|
706
|
-
"newlines-between": "always",
|
707
|
-
distinctGroup: false
|
708
|
-
}],
|
709
|
-
"import-x/no-duplicates": ["error", {
|
710
|
-
"prefer-inline": true,
|
711
|
-
considerQueryString: true
|
712
|
-
}],
|
713
|
-
"no-relative-import-paths/no-relative-import-paths": opts.allowRelativePaths ? "off" : ["warn", { allowSameFolder: true }]
|
714
|
-
},
|
715
|
-
settings: {
|
716
|
-
"import-x/parsers": { "@typescript-eslint/parser": [".ts", ".tsx"] },
|
717
|
-
"import-x/resolver": { typescript: { alwaysTryTypes: true } },
|
718
|
-
"import-x/internal-regex": opts.monorepoScope ? `^${opts.monorepoScope.replace(/\//g, "")}/` : void 0,
|
719
|
-
"import-x/core-modules": opts.coreModules ?? void 0,
|
720
|
-
"import-x/ignore": ignorePatterns
|
721
|
-
}
|
722
|
-
};
|
723
|
-
}
|
724
|
-
|
725
|
-
//#endregion
|
726
|
-
//#region src/configs/unicorn.ts
|
727
|
-
function unicorn(opts) {
|
728
|
-
return {
|
729
|
-
name: "agilebot/unicorn",
|
730
|
-
files: DEFAULT_GLOBS,
|
731
|
-
plugins: { unicorn: pluginUnicorn },
|
732
|
-
rules: {
|
733
|
-
...pluginUnicorn.configs["flat/recommended"].rules,
|
734
|
-
"unicorn/prefer-module": opts.module ? "error" : "off",
|
735
|
-
"unicorn/prefer-top-level-await": "off",
|
736
|
-
"unicorn/filename-case": "off",
|
737
|
-
"unicorn/import-style": "off",
|
738
|
-
"unicorn/prefer-at": "off",
|
739
|
-
"unicorn/prevent-abbreviations": "off",
|
740
|
-
"unicorn/prefer-date-now": "off",
|
741
|
-
"unicorn/no-process-exit": "off",
|
742
|
-
"unicorn/no-null": "off",
|
743
|
-
"unicorn/consistent-function-scoping": "off",
|
744
|
-
"unicorn/numeric-separators-style": "off",
|
745
|
-
"unicorn/prefer-optional-catch-binding": "off",
|
746
|
-
"unicorn/no-negated-condition": "off",
|
747
|
-
"unicorn/switch-case-braces": "off",
|
748
|
-
"unicorn/no-array-for-each": "off",
|
749
|
-
"unicorn/prefer-ternary": "off",
|
750
|
-
"unicorn/better-regex": "off",
|
751
|
-
"unicorn/error-message": "off",
|
752
|
-
"unicorn/no-object-as-default-parameter": "off",
|
753
|
-
"unicorn/no-array-push-push": "off",
|
754
|
-
"unicorn/no-useless-undefined": "off",
|
755
|
-
"unicorn/prefer-blob-reading-methods": "off",
|
756
|
-
"unicorn/catch-error-name": ["error", { name: "err" }],
|
757
|
-
"unicorn/prefer-global-this": "off"
|
758
|
-
}
|
759
|
-
};
|
760
|
-
}
|
761
|
-
|
762
|
-
//#endregion
|
763
|
-
//#region src/configs/react.ts
|
764
|
-
function react(opts) {
|
765
|
-
return {
|
766
|
-
name: "agilebot/react",
|
767
|
-
files: DEFAULT_GLOBS,
|
768
|
-
plugins: {
|
769
|
-
react: pluginReact,
|
770
|
-
"react-hooks": pluginReactHooks$1,
|
771
|
-
"jsx-a11y": pluginJsxA11y,
|
772
|
-
...pluginReactX.configs.recommended.plugins,
|
773
|
-
"@stylistic": pluginStylistic,
|
774
|
-
"@agilebot": pluginAgilebot,
|
775
|
-
"react-edge": pluginReactEdge
|
776
|
-
},
|
777
|
-
rules: {
|
778
|
-
...pluginJsxA11y.flatConfigs.recommended.rules,
|
779
|
-
"@eslint-react/no-direct-mutation-state": "error",
|
780
|
-
"@eslint-react/no-children-prop": "error",
|
781
|
-
"@eslint-react/no-children-to-array": "warn",
|
782
|
-
"@eslint-react/no-clone-element": "warn",
|
783
|
-
"@eslint-react/no-class-component": "error",
|
784
|
-
"@eslint-react/no-string-refs": "error",
|
785
|
-
"@eslint-react/no-missing-key": "error",
|
786
|
-
"@eslint-react/no-array-index-key": "warn",
|
787
|
-
"@eslint-react/no-duplicate-key": "error",
|
788
|
-
"@eslint-react/no-comment-textnodes": "error",
|
789
|
-
"@eslint-react/no-component-will-mount": "error",
|
790
|
-
"@eslint-react/no-component-will-receive-props": "error",
|
791
|
-
"@eslint-react/no-component-will-update": "error",
|
792
|
-
"@eslint-react/no-unsafe-component-will-mount": "warn",
|
793
|
-
"@eslint-react/no-unsafe-component-will-receive-props": "warn",
|
794
|
-
"@eslint-react/no-unsafe-component-will-update": "warn",
|
795
|
-
"@eslint-react/ensure-forward-ref-using-ref": "warn",
|
796
|
-
"@eslint-react/no-create-ref": "error",
|
797
|
-
"@eslint-react/no-nested-components": "warn",
|
798
|
-
"@eslint-react/no-redundant-should-component-update": "error",
|
799
|
-
"@eslint-react/no-set-state-in-component-did-mount": "warn",
|
800
|
-
"@eslint-react/no-set-state-in-component-did-update": "warn",
|
801
|
-
"@eslint-react/no-set-state-in-component-will-update": "warn",
|
802
|
-
"@eslint-react/prefer-shorthand-boolean": "error",
|
803
|
-
"@eslint-react/no-access-state-in-setstate": "error",
|
804
|
-
"@eslint-react/prefer-shorthand-fragment": "error",
|
805
|
-
"@eslint-react/no-missing-component-display-name": "error",
|
806
|
-
"@eslint-react/no-prop-types": "error",
|
807
|
-
"@eslint-react/no-useless-fragment": ["error", { allowExpressions: true }],
|
808
|
-
"@eslint-react/jsx-uses-vars": "error",
|
809
|
-
"@eslint-react/jsx-no-duplicate-props": "error",
|
810
|
-
"@eslint-react/dom/no-children-in-void-dom-elements": "error",
|
811
|
-
"@eslint-react/dom/no-unsafe-target-blank": "error",
|
812
|
-
"@eslint-react/dom/no-dangerously-set-innerhtml": "error",
|
813
|
-
"@eslint-react/dom/no-dangerously-set-innerhtml-with-children": "error",
|
814
|
-
"@eslint-react/dom/no-find-dom-node": "error",
|
815
|
-
"@eslint-react/dom/no-render-return-value": "error",
|
816
|
-
"@eslint-react/dom/no-unknown-property": "error",
|
817
|
-
"@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
818
|
-
"react-hooks/rules-of-hooks": "error",
|
819
|
-
"@eslint-react/naming-convention/component-name": "error",
|
820
|
-
"@eslint-react/naming-convention/context-name": "error",
|
821
|
-
"@eslint-react/naming-convention/use-state": "error",
|
822
|
-
"@eslint-react/web-api/no-leaked-interval": "warn",
|
823
|
-
"@eslint-react/web-api/no-leaked-timeout": "warn",
|
824
|
-
"@eslint-react/web-api/no-leaked-event-listener": "warn",
|
825
|
-
"@eslint-react/web-api/no-leaked-resize-observer": "warn",
|
826
|
-
"react/jsx-handler-names": ["error", {
|
827
|
-
eventHandlerPrefix: "handle",
|
828
|
-
eventHandlerPropPrefix: "on",
|
829
|
-
checkLocalVariables: true
|
830
|
-
}],
|
831
|
-
"@stylistic/jsx-self-closing-comp": "error",
|
832
|
-
"@stylistic/jsx-curly-brace-presence": ["error", {
|
833
|
-
props: "never",
|
834
|
-
children: "never",
|
835
|
-
propElementValues: "always"
|
836
|
-
}],
|
837
|
-
"jsx-a11y/click-events-have-key-events": "off",
|
838
|
-
"jsx-a11y/no-static-element-interactions": "off",
|
839
|
-
"jsx-a11y/alt-text": "off",
|
840
|
-
"react-edge/prefer-named-property-access": "error"
|
841
|
-
},
|
842
|
-
settings: { react: { version: typeof opts.version === "string" ? opts.version : "detect" } }
|
843
|
-
};
|
844
|
-
}
|
845
|
-
function reactJsOnly() {
|
846
|
-
return {
|
847
|
-
name: "agilebot/react-js-only",
|
848
|
-
files: JS_GLOBS,
|
849
|
-
rules: {
|
850
|
-
"react/jsx-no-duplicate-props": "error",
|
851
|
-
"react/jsx-no-undef": "error",
|
852
|
-
"react/jsx-uses-react": "error",
|
853
|
-
"react/no-unescaped-entities": "error",
|
854
|
-
"react/react-in-jsx-scope": "error",
|
855
|
-
"react/require-render-return": "error"
|
856
|
-
}
|
857
|
-
};
|
858
|
-
}
|
859
|
-
|
860
|
-
//#endregion
|
861
|
-
//#region src/configs/vue.ts
|
862
|
-
function vue(opts) {
|
863
|
-
return {
|
864
|
-
name: "agilebot/vue",
|
865
|
-
files: VUE_GLOBS,
|
866
|
-
plugins: { vue: pluginVue },
|
867
|
-
rules: { ...opts.version === 3 ? pluginVue.configs["strongly-recommended"].rules : pluginVue.configs["vue2-strongly-recommended"].rules }
|
868
|
-
};
|
869
|
-
}
|
870
|
-
|
871
|
-
//#endregion
|
872
|
-
//#region src/configs/jsdoc.ts
|
873
|
-
function jsdoc(opt) {
|
874
|
-
return {
|
875
|
-
name: "agilebot/jsdoc",
|
876
|
-
files: DEFAULT_GLOBS,
|
877
|
-
plugins: { jsdoc: pluginJsdoc },
|
878
|
-
rules: {
|
879
|
-
...opt.ts ? pluginJsdoc.configs["flat/recommended-typescript-error"].rules : pluginJsdoc.configs["flat/recommended-error"].rules,
|
880
|
-
"jsdoc/no-blank-block-descriptions": "error",
|
881
|
-
"jsdoc/no-blank-blocks": "error",
|
882
|
-
"jsdoc/require-asterisk-prefix": "error",
|
883
|
-
"jsdoc/check-tag-names": ["error", { typed: opt.ts }],
|
884
|
-
"jsdoc/require-returns": "off",
|
885
|
-
"jsdoc/require-returns-type": "off"
|
886
|
-
}
|
887
|
-
};
|
888
|
-
}
|
889
|
-
|
890
|
-
//#endregion
|
891
|
-
//#region src/configs/lodash.ts
|
892
|
-
function lodash() {
|
893
|
-
return {
|
894
|
-
name: "agilebot/lodash",
|
895
|
-
files: DEFAULT_GLOBS,
|
896
|
-
plugins: { "you-dont-need-lodash-underscore": fixupPluginRules(pluginLodash) },
|
897
|
-
rules: {
|
898
|
-
...pluginLodash.configs["all-warn"].rules,
|
899
|
-
"you-dont-need-lodash-underscore/throttle": "off"
|
900
|
-
}
|
901
|
-
};
|
902
|
-
}
|
903
|
-
|
904
|
-
//#endregion
|
905
|
-
//#region src/configs/comments.ts
|
906
|
-
function comments() {
|
907
|
-
return {
|
908
|
-
name: "agilebot/comments",
|
909
|
-
files: DEFAULT_GLOBS,
|
910
|
-
plugins: { "@eslint-community/eslint-comments": pluginComments },
|
911
|
-
rules: {
|
912
|
-
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
913
|
-
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
914
|
-
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
915
|
-
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
|
916
|
-
"@eslint-community/eslint-comments/require-description": ["error", { ignore: [
|
917
|
-
"eslint-env",
|
918
|
-
"exported",
|
919
|
-
"global",
|
920
|
-
"globals"
|
921
|
-
] }]
|
922
|
-
}
|
923
|
-
};
|
924
|
-
}
|
925
|
-
|
926
|
-
//#endregion
|
927
|
-
//#region src/configs/cspell.ts
|
928
|
-
function cspell(opts) {
|
929
|
-
return {
|
930
|
-
name: "agilebot/cspell",
|
931
|
-
files: DEFAULT_GLOBS,
|
932
|
-
plugins: { "@cspell": pluginCSpell },
|
933
|
-
rules: { "@cspell/spellchecker": ["warn", {
|
934
|
-
checkComments: false,
|
935
|
-
autoFix: false,
|
936
|
-
cspell: opts
|
937
|
-
}] }
|
938
|
-
};
|
939
|
-
}
|
940
|
-
|
941
|
-
//#endregion
|
942
|
-
//#region src/configs/agilebot.ts
|
943
|
-
function agilebot(opts) {
|
944
|
-
return {
|
945
|
-
name: "agilebot/agilebot",
|
946
|
-
files: DEFAULT_GLOBS,
|
947
|
-
plugins: {
|
948
|
-
"@agilebot": pluginAgilebot,
|
949
|
-
"react-hooks": pluginReactHooks
|
950
|
-
},
|
951
|
-
rules: {
|
952
|
-
...pluginAgilebot.configs.recommended.rules,
|
953
|
-
"react-hooks/exhaustive-deps": "off",
|
954
|
-
"@agilebot/react-better-exhaustive-deps": "warn"
|
955
|
-
},
|
956
|
-
settings: {
|
957
|
-
"agilebot/project-root": opts.root,
|
958
|
-
"agilebot/monorepo-scope": opts.monorepoScope ? opts.monorepoScope.replace(/\//g, "") : void 0,
|
959
|
-
"@agilebot/no-import-css": opts.tss ? "error" : "off",
|
960
|
-
"@agilebot/tss-class-naming": opts.tss ? "error" : "off",
|
961
|
-
"@agilebot/tss-no-color-name": opts.tss ? "warn" : "off",
|
962
|
-
"@agilebot/tss-no-color-value": opts.tss ? "error" : "off",
|
963
|
-
"@agilebot/tss-unused-classes": opts.tss ? "warn" : "off"
|
964
|
-
}
|
965
|
-
};
|
966
|
-
}
|
967
|
-
|
968
|
-
//#endregion
|
969
|
-
//#region ../prettier-config/dist/index.mjs
|
970
|
-
/**
|
971
|
-
|
972
|
-
* @license @agilebot/prettier-config v0.8.10
|
973
|
-
|
974
|
-
*
|
975
|
-
|
976
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
977
|
-
|
978
|
-
*
|
979
|
-
|
980
|
-
* This source code is licensed under the MIT license found in the
|
981
|
-
|
982
|
-
* LICENSE file in the root directory of this source tree.
|
983
|
-
|
984
|
-
*/
|
985
|
-
const config = {
|
986
|
-
tabWidth: 2,
|
987
|
-
singleQuote: true,
|
988
|
-
trailingComma: "none",
|
989
|
-
bracketSpacing: true,
|
990
|
-
bracketSameLine: true,
|
991
|
-
useTabs: false,
|
992
|
-
arrowParens: "avoid"
|
993
|
-
};
|
994
|
-
var src_default = config;
|
995
|
-
|
996
|
-
//#endregion
|
997
|
-
//#region src/configs/prettier.ts
|
998
|
-
function prettier(opts) {
|
999
|
-
return {
|
1000
|
-
name: "agilebot/prettier",
|
1001
|
-
files: DEFAULT_GLOBS,
|
1002
|
-
plugins: { prettier: pluginPrettier },
|
1003
|
-
rules: {
|
1004
|
-
...prettierRecommended.rules,
|
1005
|
-
curly: "error",
|
1006
|
-
"arrow-body-style": "off",
|
1007
|
-
"prettier/prettier": [
|
1008
|
-
"error",
|
1009
|
-
{
|
1010
|
-
endOfLine: "auto",
|
1011
|
-
...src_default,
|
1012
|
-
...opts
|
1013
|
-
},
|
1014
|
-
{ usePrettierrc: !opts }
|
1015
|
-
]
|
1016
|
-
}
|
1017
|
-
};
|
1018
|
-
}
|
1019
|
-
|
1020
|
-
//#endregion
|
1021
|
-
//#region src/configs/godaddy.ts
|
1022
|
-
function godaddy() {
|
1023
|
-
return {
|
1024
|
-
name: "agilebot/godaddy",
|
1025
|
-
files: DEFAULT_GLOBS,
|
1026
|
-
languageOptions: { parserOptions: {
|
1027
|
-
ecmaVersion: 2022,
|
1028
|
-
sourceType: "module"
|
1029
|
-
} },
|
1030
|
-
plugins: { mocha: pluginMocha },
|
1031
|
-
rules: {
|
1032
|
-
...js.configs.recommended.rules,
|
1033
|
-
...configGodaddy.rules,
|
1034
|
-
"quote-props": "off",
|
1035
|
-
"linebreak-style": "off",
|
1036
|
-
complexity: "off",
|
1037
|
-
"max-statements": "off",
|
1038
|
-
"id-length": "off",
|
1039
|
-
"default-case": "off",
|
1040
|
-
"valid-jsdoc": "off",
|
1041
|
-
"generator-star-spacing": "off",
|
1042
|
-
"max-params": "off",
|
1043
|
-
"max-depth": "off",
|
1044
|
-
"max-len": "off",
|
1045
|
-
indent: "off",
|
1046
|
-
"no-undefined": "off",
|
1047
|
-
"no-process-env": "off",
|
1048
|
-
"no-sync": "off",
|
1049
|
-
"no-continue": "off",
|
1050
|
-
"no-case-declarations": "off",
|
1051
|
-
"callback-return": "off",
|
1052
|
-
"unicorn/prefer-string-slice": "off",
|
1053
|
-
"unicorn/prefer-string-replace-all": "off",
|
1054
|
-
"new-cap": "off"
|
1055
|
-
}
|
1056
|
-
};
|
1057
|
-
}
|
1058
|
-
|
1059
|
-
//#endregion
|
1060
|
-
//#region src/factory/index.ts
|
1061
|
-
function factory(root, options) {
|
1062
|
-
assert.ok(root, "root option is required");
|
1063
|
-
let rootDir;
|
1064
|
-
if (typeof root === "string") rootDir = root;
|
1065
|
-
else if (root?.url) rootDir = path.dirname(fileURLToPath(root.url));
|
1066
|
-
else throw new Error("root must be a string or ImportMeta");
|
1067
|
-
const tsconfigFiles = findTsconfigFiles(rootDir, { absolute: true });
|
1068
|
-
const defaultOptions = {
|
1069
|
-
jsdoc: true,
|
1070
|
-
prettier: true,
|
1071
|
-
lodash: true,
|
1072
|
-
cspell: {},
|
1073
|
-
import: true
|
1074
|
-
};
|
1075
|
-
options = {
|
1076
|
-
...defaultOptions,
|
1077
|
-
...options
|
1078
|
-
};
|
1079
|
-
if (options.config) assert.ok(Object.keys(options.config).every((key) => key === "rules" || key === "settings"), "config option must only contain rules and settings");
|
1080
|
-
const commonConfigs = [unicorn({ module: options.module ?? false }), comments()];
|
1081
|
-
if (options.import) commonConfigs.push(imports(rootDir, typeof options.import === "object" ? options.import : {}));
|
1082
|
-
if (options.prettier) commonConfigs.push(prettier(typeof options.prettier === "object" ? options.prettier : void 0));
|
1083
|
-
const config$1 = [];
|
1084
|
-
if (options.godaddy) {
|
1085
|
-
config$1.push({
|
1086
|
-
name: "agilebot/parser",
|
1087
|
-
files: DEFAULT_GLOBS,
|
1088
|
-
languageOptions: {
|
1089
|
-
parser: options.godaddy === "typescript" ? parserTs : void 0,
|
1090
|
-
parserOptions: { project: tsconfigFiles.length > 0 ? tsconfigFiles : true }
|
1091
|
-
}
|
1092
|
-
});
|
1093
|
-
config$1.push(env());
|
1094
|
-
if (options.jsdoc) config$1.push(jsdoc({ ts: false }));
|
1095
|
-
config$1.push(...commonConfigs);
|
1096
|
-
config$1.push(godaddy());
|
1097
|
-
} else {
|
1098
|
-
config$1.push({
|
1099
|
-
name: "agilebot/parser",
|
1100
|
-
files: DEFAULT_GLOBS,
|
1101
|
-
languageOptions: {
|
1102
|
-
parser: !options.vue ? parserTs : parserVue,
|
1103
|
-
parserOptions: {
|
1104
|
-
parser: parserTs,
|
1105
|
-
tsconfigRootDir: root,
|
1106
|
-
projectService: true,
|
1107
|
-
project: tsconfigFiles.length > 0 ? tsconfigFiles : true,
|
1108
|
-
ecmaFeatures: { jsx: true },
|
1109
|
-
sourceType: options.module ? "module" : void 0,
|
1110
|
-
extraFileExtensions: !options.vue ? void 0 : [".vue"]
|
1111
|
-
}
|
1112
|
-
}
|
1113
|
-
});
|
1114
|
-
config$1.push(env());
|
1115
|
-
config$1.push(standard());
|
1116
|
-
config$1.push(ts());
|
1117
|
-
config$1.push(jsOnly());
|
1118
|
-
config$1.push(dts());
|
1119
|
-
config$1.push(tsOnly());
|
1120
|
-
if (options.react) {
|
1121
|
-
config$1.push(react({ version: options.react }));
|
1122
|
-
config$1.push(reactJsOnly());
|
1123
|
-
}
|
1124
|
-
if (options.vue) config$1.push(vue({ version: options.vue }));
|
1125
|
-
if (options.lodash) config$1.push(lodash());
|
1126
|
-
if (options.cspell) config$1.push(cspell(options.cspell));
|
1127
|
-
if (options.jsdoc) {
|
1128
|
-
config$1.push({
|
1129
|
-
...jsdoc({ ts: true }),
|
1130
|
-
files: TS_GLOBS
|
1131
|
-
});
|
1132
|
-
config$1.push({
|
1133
|
-
...jsdoc({ ts: false }),
|
1134
|
-
files: JS_GLOBS
|
1135
|
-
});
|
1136
|
-
}
|
1137
|
-
config$1.push(...commonConfigs);
|
1138
|
-
config$1.push(agilebot({
|
1139
|
-
root: rootDir,
|
1140
|
-
monorepoScope: typeof options.import === "object" ? options.import?.monorepoScope : void 0,
|
1141
|
-
tss: options.tss
|
1142
|
-
}));
|
1143
|
-
}
|
1144
|
-
if (options.config) config$1.push({
|
1145
|
-
name: "agilebot/custom",
|
1146
|
-
files: DEFAULT_GLOBS,
|
1147
|
-
...options.config
|
1148
|
-
});
|
1149
|
-
config$1.push({
|
1150
|
-
name: "agilebot/ignores",
|
1151
|
-
ignores: [...IGNORE_GLOBS, ...options.ignores ?? []]
|
1152
|
-
});
|
1153
|
-
const allPlugins = {};
|
1154
|
-
config$1.forEach((configItem) => {
|
1155
|
-
if (configItem.plugins) {
|
1156
|
-
Object.assign(allPlugins, configItem.plugins);
|
1157
|
-
delete configItem.plugins;
|
1158
|
-
}
|
1159
|
-
});
|
1160
|
-
config$1.unshift({
|
1161
|
-
name: "agilebot/plugins",
|
1162
|
-
files: DEFAULT_GLOBS,
|
1163
|
-
plugins: allPlugins
|
1164
|
-
});
|
1165
|
-
return config$1;
|
1166
|
-
}
|
1167
|
-
|
1168
|
-
//#endregion
|
1169
|
-
export { factory as agilebot };
|