@agilebot/eslint-config 0.8.0 → 0.8.2

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