@agilebot/eslint-config 0.8.1 → 0.8.3

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,5 +1,5 @@
1
1
  /**
2
- * @license @agilebot/eslint-config v0.8.1
2
+ * @license @agilebot/eslint-config v0.8.3
3
3
  *
4
4
  * Copyright (c) Agilebot, Inc. and its affiliates.
5
5
  *
@@ -7,1076 +7,1142 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
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 }] };
48
-
49
- // src/factory/index.ts
50
- var import_node_assert = __toESM(require("assert"));
51
- var import_node_url = require("url");
52
- var import_node_path2 = __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-Bk8Ms2lP.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_plugin_react_edge = __toESM(require("eslint-plugin-react-edge"));
242
- var import_eslint_utils = require("@agilebot/eslint-utils");
494
+ //#endregion
495
+ //#region src/configs/ts.ts
243
496
  function ts() {
244
- return {
245
- name: "agilebot/ts",
246
- files: DEFAULT_GLOBS,
247
- plugins: {
248
- "@typescript-eslint": pluginTs2,
249
- "@stylistic": import_eslint_plugin2.default,
250
- "prefer-arrow-functions": import_eslint_plugin_prefer_arrow_functions.default,
251
- "unused-imports": import_eslint_plugin_unused_imports.default,
252
- "react-edge": import_eslint_plugin_react_edge.default
253
- },
254
- rules: {
255
- // 如果没用模板字符串,避免使用反引号
256
- "@stylistic/quotes": ["error", "single", { avoidEscape: true }],
257
- "prefer-arrow-functions/prefer-arrow-functions": [
258
- "warn",
259
- {
260
- allowNamedFunctions: true,
261
- classPropertiesAllowed: false,
262
- disallowPrototype: false,
263
- returnStyle: "unchanged",
264
- singleReturnOnly: false
265
- }
266
- ],
267
- "@typescript-eslint/no-unused-vars": "off",
268
- "unused-imports/no-unused-imports": (0, import_eslint_utils.isInEditor)() ? "off" : "error",
269
- "unused-imports/no-unused-vars": [
270
- "warn",
271
- {
272
- args: "after-used",
273
- argsIgnorePattern: "^_",
274
- vars: "all",
275
- varsIgnorePattern: "^_",
276
- caughtErrors: "none",
277
- caughtErrorsIgnorePattern: "^_",
278
- destructuredArrayIgnorePattern: "^_",
279
- ignoreRestSiblings: true
280
- }
281
- ],
282
- // 优先使用interface而不是type
283
- "@typescript-eslint/consistent-type-definitions": "error",
284
- "@typescript-eslint/naming-convention": [
285
- "error",
286
- // variable规则在@agilebot/var-naming中定义
287
- {
288
- selector: "function",
289
- format: ["camelCase", "PascalCase"]
290
- },
291
- {
292
- selector: "variable",
293
- types: ["function"],
294
- format: ["camelCase", "PascalCase"]
295
- },
296
- {
297
- selector: "typeLike",
298
- format: ["PascalCase"]
299
- },
300
- {
301
- selector: "parameter",
302
- format: ["camelCase"],
303
- leadingUnderscore: "allow"
304
- },
305
- {
306
- selector: "method",
307
- format: ["camelCase"]
308
- },
309
- {
310
- selector: "classProperty",
311
- format: ["camelCase", "UPPER_CASE", "PascalCase"],
312
- leadingUnderscore: "allow"
313
- },
314
- {
315
- selector: "typeProperty",
316
- format: ["camelCase"]
317
- },
318
- {
319
- selector: "enum",
320
- format: ["PascalCase"]
321
- },
322
- {
323
- selector: "enumMember",
324
- format: ["PascalCase", "UPPER_CASE"]
325
- }
326
- ],
327
- // 禁止没有必要的初始化
328
- "@typescript-eslint/no-inferrable-types": "error",
329
- // 函数中未使用await,函数签名不要加async
330
- "@typescript-eslint/require-await": "error",
331
- // 没有必要的类型as
332
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
333
- // 数组用T[]而不是Array<T>
334
- "@typescript-eslint/array-type": ["error", { default: "array" }],
335
- // Promise必须加await或void
336
- "@typescript-eslint/no-misused-promises": [
337
- "error",
338
- {
339
- checksVoidReturn: false
340
- }
341
- ],
342
- "@typescript-eslint/no-deprecated": "error",
343
- "react-edge/var-naming": "error"
344
- }
345
- };
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
+ };
346
588
  }
347
589
  function tsOnly() {
348
- return {
349
- name: "agilebot/ts-only",
350
- files: TS_GLOBS,
351
- rules: {
352
- "prefer-object-has-own": "error",
353
- "@typescript-eslint/explicit-member-accessibility": "error"
354
- }
355
- };
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
+ };
356
598
  }
357
599
  function jsOnly() {
358
- return {
359
- name: "agilebot/js-only",
360
- files: JS_GLOBS,
361
- rules: {
362
- "@typescript-eslint/no-require-imports": "off"
363
- }
364
- };
600
+ return {
601
+ name: "agilebot/js-only",
602
+ files: require_constants.JS_GLOBS,
603
+ rules: { "@typescript-eslint/no-require-imports": "off" }
604
+ };
365
605
  }
366
606
  function dts() {
367
- return {
368
- name: "agilebot/dts",
369
- files: DTS_GLOBS,
370
- rules: {
371
- // .d.ts中支持导入ts文件中的类型
372
- "@typescript-eslint/consistent-type-imports": "off",
373
- // .d.ts中忽略属性命名规则
374
- "@typescript-eslint/naming-convention": "off",
375
- // .d.ts中忽略三斜线引用
376
- "@typescript-eslint/triple-slash-reference": "off"
377
- }
378
- };
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
+ };
379
616
  }
380
617
 
381
- // src/configs/imports.ts
382
- var import_node_path = __toESM(require("path"));
383
- var import_node_fs = __toESM(require("fs"));
384
- var import_eslint_plugin_import_x2 = __toESM(require("eslint-plugin-import-x"));
385
- var import_eslint_plugin_no_relative_import_paths = __toESM(require("eslint-plugin-no-relative-import-paths"));
386
- 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
+ */
387
625
  function imports(packageDir, opts) {
388
- const rootDir = (0, import_eslint_utils2.findRootDir)(__dirname);
389
- const pkgPath = import_node_path.default.join(packageDir, "package.json");
390
- if (!import_node_fs.default.existsSync(pkgPath)) {
391
- throw new Error(`package.json not found in ${packageDir}`);
392
- }
393
- const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf8"));
394
- const tmpPkg = {
395
- name: `${pkg.name}/tmp`,
396
- dependencies: {
397
- [pkg.name]: "*"
398
- }
399
- };
400
- const tmpPkgSafeName = tmpPkg.name.replace(/\//g, "__");
401
- const cacheDir = (0, import_eslint_utils2.findCacheDir)(rootDir);
402
- const tmpPkgDir = import_node_path.default.join(cacheDir, "tmp-pkg", tmpPkgSafeName);
403
- if (!import_node_fs.default.existsSync(tmpPkgDir)) {
404
- import_node_fs.default.mkdirSync(tmpPkgDir, { recursive: true });
405
- }
406
- const tmpPkgJson = JSON.stringify(tmpPkg, null, 2);
407
- import_node_fs.default.writeFileSync(import_node_path.default.join(tmpPkgDir, "package.json"), tmpPkgJson);
408
- return {
409
- name: "agilebot/imports",
410
- files: DEFAULT_GLOBS,
411
- plugins: {
412
- "import-x": import_eslint_plugin_import_x2.default,
413
- "no-relative-import-paths": import_eslint_plugin_no_relative_import_paths.default
414
- },
415
- rules: {
416
- ...import_eslint_plugin_import_x2.default.configs.recommended.rules,
417
- ...import_eslint_plugin_import_x2.default.configs.typescript.rules,
418
- "import-x/no-unresolved": [
419
- "error",
420
- {
421
- ignore: [
422
- String.raw`\?(react|raw|url|inline|worker|worker&inline|worker&url|sharedworker|sharedworker&inline|sharedworker&url)$`
423
- ]
424
- }
425
- ],
426
- "import-x/no-named-as-default-member": "off",
427
- "import-x/no-named-as-default": "off",
428
- "import-x/no-useless-path-segments": [
429
- "error",
430
- {
431
- noUselessIndex: true
432
- }
433
- ],
434
- "import-x/no-cycle": (0, import_eslint_utils2.isInEditor)() ? "off" : "error",
435
- "import-x/newline-after-import": "error",
436
- "import-x/first": "error",
437
- "import-x/no-import-module-exports": "error",
438
- "import-x/no-anonymous-default-export": [
439
- "error",
440
- {
441
- allowArray: true,
442
- allowObject: true
443
- }
444
- ],
445
- "import-x/no-extraneous-dependencies": opts.allowExtraneousDependencies ? "off" : [
446
- "error",
447
- {
448
- packageDir: [packageDir, tmpPkgDir, rootDir],
449
- devDependencies: [
450
- "test/**/*",
451
- "tests/**/*",
452
- "**/__tests__/**",
453
- "**/*.test.{ts,tsx,js,jsx,cjs,mjs,mts,cts}",
454
- "**/*.config.{ts,js,cjs,mjs,mts,cts}",
455
- "**/.storybook/**",
456
- "**/*.stories.{ts,tsx}",
457
- "**/scripts/*.{ts,mts}",
458
- ...opts.devDependencies ?? []
459
- ],
460
- includeInternal: true
461
- }
462
- ],
463
- "import-x/order": [
464
- "error",
465
- {
466
- groups: [
467
- "builtin",
468
- "external",
469
- "internal",
470
- "parent",
471
- "sibling",
472
- "index",
473
- "object"
474
- ],
475
- pathGroups: [
476
- {
477
- pattern: `${pkg.name}/**`,
478
- group: "parent",
479
- position: "after"
480
- }
481
- ],
482
- "newlines-between": "always",
483
- distinctGroup: false
484
- }
485
- ],
486
- "no-relative-import-paths/no-relative-import-paths": opts.allowRelativePaths ? "off" : ["warn", { allowSameFolder: true }]
487
- },
488
- settings: {
489
- "import-x/parsers": {
490
- "@typescript-eslint/parser": [".ts", ".tsx"]
491
- },
492
- "import-x/resolver": opts.resolver === "oxc" ? {
493
- oxc: true
494
- } : {
495
- typescript: {
496
- alwaysTryTypes: true
497
- }
498
- },
499
- "import-x/internal-regex": opts.monorepoScope ? `^${opts.monorepoScope.replace(/\//g, "")}/` : void 0,
500
- "import-x/core-modules": opts.coreModules ?? void 0
501
- }
502
- };
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": { 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
+ };
503
708
  }
504
709
 
505
- // src/configs/unicorn.ts
506
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"));
710
+ //#endregion
711
+ //#region src/configs/unicorn.ts
507
712
  function unicorn(opts) {
508
- return {
509
- name: "agilebot/unicorn",
510
- files: DEFAULT_GLOBS,
511
- plugins: {
512
- unicorn: import_eslint_plugin_unicorn.default
513
- },
514
- rules: {
515
- ...import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules,
516
- "unicorn/prefer-module": opts.module ? "error" : "off",
517
- "unicorn/prefer-top-level-await": "off",
518
- "unicorn/filename-case": "off",
519
- "unicorn/import-style": "off",
520
- "unicorn/prefer-at": "off",
521
- "unicorn/prevent-abbreviations": "off",
522
- "unicorn/prefer-date-now": "off",
523
- "unicorn/no-process-exit": "off",
524
- "unicorn/no-null": "off",
525
- "unicorn/consistent-function-scoping": "off",
526
- "unicorn/numeric-separators-style": "off",
527
- "unicorn/prefer-optional-catch-binding": "off",
528
- "unicorn/no-negated-condition": "off",
529
- "unicorn/switch-case-braces": "off",
530
- "unicorn/no-array-for-each": "off",
531
- "unicorn/prefer-ternary": "off",
532
- "unicorn/better-regex": "off",
533
- "unicorn/error-message": "off",
534
- "unicorn/no-object-as-default-parameter": "off",
535
- "unicorn/no-array-push-push": "off",
536
- "unicorn/no-useless-undefined": "off",
537
- "unicorn/prefer-blob-reading-methods": "off",
538
- "unicorn/catch-error-name": [
539
- "error",
540
- {
541
- name: "err"
542
- }
543
- ],
544
- "unicorn/prefer-global-this": "off"
545
- }
546
- };
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
+ };
547
745
  }
548
746
 
549
- // src/configs/react.ts
550
- var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"));
551
- var import_eslint_plugin3 = __toESM(require("@eslint-react/eslint-plugin"));
552
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"));
553
- var import_eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"));
554
- var import_eslint_plugin4 = __toESM(require("@stylistic/eslint-plugin"));
555
- var import_eslint_plugin_react_edge2 = __toESM(require("eslint-plugin-react-edge"));
556
- var import_eslint_plugin5 = __toESM(require("@agilebot/eslint-plugin"));
747
+ //#endregion
748
+ //#region src/configs/react.ts
557
749
  function react(opts) {
558
- return {
559
- name: "agilebot/react",
560
- files: DEFAULT_GLOBS,
561
- plugins: {
562
- react: import_eslint_plugin_react.default,
563
- "react-hooks": import_eslint_plugin_react_hooks.default,
564
- "jsx-a11y": import_eslint_plugin_jsx_a11y.default,
565
- ...import_eslint_plugin3.default.configs.recommended.plugins,
566
- "@stylistic": import_eslint_plugin4.default,
567
- "@agilebot": import_eslint_plugin5.default,
568
- "react-edge": import_eslint_plugin_react_edge2.default
569
- },
570
- rules: {
571
- ...import_eslint_plugin_jsx_a11y.default.flatConfigs.recommended.rules,
572
- // recommended rules from @eslint-react
573
- "@eslint-react/no-direct-mutation-state": "error",
574
- // Children API
575
- // '@eslint-react/no-children-count': 'warn',
576
- // '@eslint-react/no-children-for-each': 'warn',
577
- // '@eslint-react/no-children-map': 'warn',
578
- // '@eslint-react/no-children-only': 'warn',
579
- "@eslint-react/no-children-prop": "error",
580
- "@eslint-react/no-children-to-array": "warn",
581
- "@eslint-react/no-clone-element": "warn",
582
- "@eslint-react/no-class-component": "error",
583
- "@eslint-react/no-string-refs": "error",
584
- "@eslint-react/no-missing-key": "error",
585
- "@eslint-react/no-array-index-key": "warn",
586
- "@eslint-react/no-duplicate-key": "error",
587
- "@eslint-react/no-comment-textnodes": "error",
588
- "@eslint-react/no-component-will-mount": "error",
589
- "@eslint-react/no-component-will-receive-props": "error",
590
- "@eslint-react/no-component-will-update": "error",
591
- "@eslint-react/no-unsafe-component-will-mount": "warn",
592
- "@eslint-react/no-unsafe-component-will-receive-props": "warn",
593
- "@eslint-react/no-unsafe-component-will-update": "warn",
594
- // '@eslint-react/no-unstable-context-value': 'error',
595
- // '@eslint-react/no-unstable-default-props': 'error',
596
- "@eslint-react/ensure-forward-ref-using-ref": "warn",
597
- "@eslint-react/no-create-ref": "error",
598
- "@eslint-react/no-nested-components": "warn",
599
- "@eslint-react/no-redundant-should-component-update": "error",
600
- "@eslint-react/no-set-state-in-component-did-mount": "warn",
601
- "@eslint-react/no-set-state-in-component-did-update": "warn",
602
- "@eslint-react/no-set-state-in-component-will-update": "warn",
603
- "@eslint-react/prefer-shorthand-boolean": "error",
604
- "@eslint-react/no-access-state-in-setstate": "error",
605
- "@eslint-react/prefer-shorthand-fragment": "error",
606
- "@eslint-react/no-missing-component-display-name": "error",
607
- "@eslint-react/no-prop-types": "error",
608
- "@eslint-react/no-useless-fragment": [
609
- "error",
610
- { allowExpressions: true }
611
- ],
612
- "@eslint-react/jsx-uses-vars": "error",
613
- "@eslint-react/jsx-no-duplicate-props": "error",
614
- // recommended rules from @eslint-react/dom
615
- "@eslint-react/dom/no-children-in-void-dom-elements": "error",
616
- "@eslint-react/dom/no-unsafe-target-blank": "error",
617
- "@eslint-react/dom/no-dangerously-set-innerhtml": "error",
618
- "@eslint-react/dom/no-dangerously-set-innerhtml-with-children": "error",
619
- "@eslint-react/dom/no-find-dom-node": "error",
620
- "@eslint-react/dom/no-render-return-value": "error",
621
- "@eslint-react/dom/no-unknown-property": "error",
622
- // recommended rules from @eslint-react/hooks-extra
623
- "@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
624
- // recommended rules react-hooks
625
- "react-hooks/rules-of-hooks": "error",
626
- // recommended rules from @eslint-react/naming-convention
627
- "@eslint-react/naming-convention/component-name": "error",
628
- "@eslint-react/naming-convention/context-name": "error",
629
- "@eslint-react/naming-convention/use-state": "error",
630
- // recommended rules from @eslint-react/web-api
631
- "@eslint-react/web-api/no-leaked-interval": "warn",
632
- "@eslint-react/web-api/no-leaked-timeout": "warn",
633
- "@eslint-react/web-api/no-leaked-event-listener": "warn",
634
- "@eslint-react/web-api/no-leaked-resize-observer": "warn",
635
- // 以下是自定义规则
636
- "react/jsx-handler-names": [
637
- "error",
638
- {
639
- eventHandlerPrefix: "handle",
640
- eventHandlerPropPrefix: "on",
641
- checkLocalVariables: true
642
- }
643
- ],
644
- // Stylistic rules are not supported by @eslint-react. Use dprint or @stylistic instead.
645
- "@stylistic/jsx-self-closing-comp": "error",
646
- // <App prop={'Hello'} />没必要,使用<App prop="Hello" />
647
- "@stylistic/jsx-curly-brace-presence": [
648
- "error",
649
- {
650
- props: "never",
651
- children: "never",
652
- propElementValues: "always"
653
- }
654
- ],
655
- "jsx-a11y/click-events-have-key-events": "off",
656
- "jsx-a11y/no-static-element-interactions": "off",
657
- "jsx-a11y/alt-text": "off",
658
- "react-edge/prefer-named-property-access": "error"
659
- },
660
- settings: {
661
- react: {
662
- version: typeof opts.version === "string" ? opts.version : "detect"
663
- }
664
- }
665
- };
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
+ };
666
829
  }
667
830
  function reactJsOnly() {
668
- return {
669
- name: "agilebot/react-js-only",
670
- files: JS_GLOBS,
671
- rules: {
672
- // The following can be enforced by TypeScript, no need to implement them
673
- "react/jsx-no-duplicate-props": "error",
674
- "react/jsx-no-undef": "error",
675
- "react/jsx-uses-react": "error",
676
- "react/no-unescaped-entities": "error",
677
- "react/react-in-jsx-scope": "error",
678
- "react/require-render-return": "error"
679
- }
680
- };
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
+ };
681
843
  }
682
844
 
683
- // src/configs/vue.ts
684
- var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"));
845
+ //#endregion
846
+ //#region src/configs/vue.ts
685
847
  function vue(opts) {
686
- return {
687
- name: "agilebot/vue",
688
- files: VUE_GLOBS,
689
- plugins: {
690
- vue: import_eslint_plugin_vue.default
691
- },
692
- rules: {
693
- ...opts.version === 3 ? import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules : import_eslint_plugin_vue.default.configs["strongly-recommended"].rules
694
- }
695
- };
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
+ };
696
854
  }
697
855
 
698
- // src/configs/jsdoc.ts
699
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"));
856
+ //#endregion
857
+ //#region src/configs/jsdoc.ts
700
858
  function jsdoc(opt) {
701
- return {
702
- name: "agilebot/jsdoc",
703
- files: DEFAULT_GLOBS,
704
- plugins: {
705
- jsdoc: import_eslint_plugin_jsdoc.default
706
- },
707
- rules: {
708
- ...opt.ts ? import_eslint_plugin_jsdoc.default.configs["flat/recommended-typescript-error"].rules : import_eslint_plugin_jsdoc.default.configs["flat/recommended-error"].rules,
709
- // 禁止有空行
710
- "jsdoc/no-blank-block-descriptions": "error",
711
- "jsdoc/no-blank-blocks": "error",
712
- // 每行注释都有星号
713
- "jsdoc/require-asterisk-prefix": "error",
714
- "jsdoc/check-tag-names": [
715
- "error",
716
- {
717
- typed: opt.ts
718
- }
719
- ],
720
- "jsdoc/require-returns": "off",
721
- // @return注释不是很有必要
722
- "jsdoc/require-returns-type": "off"
723
- }
724
- };
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
+ };
725
873
  }
726
874
 
727
- // src/configs/lodash.ts
728
- var import_eslint_plugin_you_dont_need_lodash_underscore = __toESM(require("eslint-plugin-you-dont-need-lodash-underscore"));
729
- var import_compat = require("@eslint/compat");
875
+ //#endregion
876
+ //#region src/configs/lodash.ts
730
877
  function lodash() {
731
- return {
732
- // lodash一些方法可能影响性能,如forEach等,优先使用js的原生方法
733
- name: "agilebot/lodash",
734
- files: DEFAULT_GLOBS,
735
- plugins: {
736
- "you-dont-need-lodash-underscore": (0, import_compat.fixupPluginRules)(import_eslint_plugin_you_dont_need_lodash_underscore.default)
737
- },
738
- rules: {
739
- ...import_eslint_plugin_you_dont_need_lodash_underscore.default.configs["all-warn"].rules,
740
- "you-dont-need-lodash-underscore/throttle": "off"
741
- }
742
- };
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
+ };
743
887
  }
744
888
 
745
- // src/configs/comments.ts
746
- var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"));
889
+ //#endregion
890
+ //#region src/configs/comments.ts
747
891
  function comments() {
748
- return {
749
- name: "agilebot/comments",
750
- files: DEFAULT_GLOBS,
751
- plugins: {
752
- "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
753
- },
754
- rules: {
755
- // 禁止未使用的eslint-disable注释
756
- "@eslint-community/eslint-comments/no-unused-disable": "error",
757
- // 禁止无限制的eslint-disable注释
758
- "@eslint-community/eslint-comments/no-unlimited-disable": "error",
759
- // 禁止重复的eslint-disable注释
760
- "@eslint-community/eslint-comments/no-duplicate-disable": "error",
761
- // 禁止聚合的eslint-enable注释
762
- "@eslint-community/eslint-comments/no-aggregating-enable": "error",
763
- // 须说明原因eslint-disable
764
- "@eslint-community/eslint-comments/require-description": [
765
- "error",
766
- {
767
- ignore: ["eslint-env", "exported", "global", "globals"]
768
- }
769
- ]
770
- }
771
- };
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
+ };
772
909
  }
773
910
 
774
- // src/configs/cspell.ts
775
- var import_eslint_plugin6 = __toESM(require("@cspell/eslint-plugin"));
911
+ //#endregion
912
+ //#region src/configs/cspell.ts
776
913
  function cspell(opts) {
777
- return {
778
- name: "agilebot/cspell",
779
- files: DEFAULT_GLOBS,
780
- plugins: {
781
- "@cspell": import_eslint_plugin6.default
782
- },
783
- rules: {
784
- "@cspell/spellchecker": [
785
- "warn",
786
- {
787
- checkComments: false,
788
- autoFix: false,
789
- cspell: opts
790
- }
791
- ]
792
- }
793
- };
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
+ };
794
924
  }
795
925
 
796
- // src/configs/agilebot.ts
797
- var import_eslint_plugin_react_hooks2 = __toESM(require("eslint-plugin-react-hooks"));
798
- var import_eslint_plugin7 = __toESM(require("@agilebot/eslint-plugin"));
926
+ //#endregion
927
+ //#region src/configs/agilebot.ts
799
928
  function agilebot(opts) {
800
- return {
801
- name: "agilebot/agilebot",
802
- files: DEFAULT_GLOBS,
803
- plugins: {
804
- "@agilebot": import_eslint_plugin7.default,
805
- "react-hooks": import_eslint_plugin_react_hooks2.default
806
- },
807
- rules: {
808
- ...import_eslint_plugin7.default.configs.recommended.rules,
809
- "react-hooks/exhaustive-deps": "off",
810
- "@agilebot/react-better-exhaustive-deps": "warn"
811
- },
812
- settings: {
813
- "agilebot/project-root": opts.root,
814
- "agilebot/monorepo-scope": opts.monorepoScope ? opts.monorepoScope.replace(/\//g, "") : void 0
815
- }
816
- };
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
+ };
817
946
  }
818
947
 
819
- // src/configs/prettier.ts
820
- var import_recommended = __toESM(require("eslint-plugin-prettier/recommended"));
821
- var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"));
948
+ //#endregion
949
+ //#region ../prettier-config/dist/index.mjs
950
+ /**
822
951
 
823
- // ../prettier-config/dist/index.mjs
824
- var config = {
825
- tabWidth: 2,
826
- singleQuote: true,
827
- trailingComma: "none",
828
- bracketSpacing: true,
829
- bracketSameLine: true,
830
- useTabs: false,
831
- arrowParens: "avoid"
952
+ * @license @agilebot/prettier-config v0.8.3
953
+
954
+ *
955
+
956
+ * Copyright (c) Agilebot, Inc. and its affiliates.
957
+
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"
832
973
  };
833
- var index_default = config;
974
+ var src_default = config;
834
975
 
835
- // src/configs/prettier.ts
976
+ //#endregion
977
+ //#region src/configs/prettier.ts
836
978
  function prettier(opts) {
837
- return {
838
- name: "agilebot/prettier",
839
- files: DEFAULT_GLOBS,
840
- plugins: {
841
- prettier: import_eslint_plugin_prettier.default
842
- },
843
- // Do not extends
844
- // extends: ['plugin:prettier/recommended'],
845
- rules: {
846
- ...import_recommended.default.rules,
847
- curly: "error",
848
- "arrow-body-style": "off",
849
- "prettier/prettier": [
850
- "error",
851
- {
852
- endOfLine: "auto",
853
- ...index_default,
854
- ...opts
855
- },
856
- {
857
- usePrettierrc: !opts
858
- }
859
- ]
860
- }
861
- };
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
+ };
862
998
  }
863
999
 
864
- // src/configs/godaddy.ts
865
- var import_eslint_config_godaddy = __toESM(require("eslint-config-godaddy"));
866
- var import_js = __toESM(require("@eslint/js"));
867
- var import_eslint_plugin_mocha = __toESM(require("eslint-plugin-mocha"));
1000
+ //#endregion
1001
+ //#region src/configs/godaddy.ts
868
1002
  function godaddy() {
869
- return {
870
- name: "agilebot/godaddy",
871
- files: DEFAULT_GLOBS,
872
- languageOptions: {
873
- parserOptions: {
874
- ecmaVersion: 2022,
875
- sourceType: "module"
876
- }
877
- },
878
- plugins: {
879
- mocha: import_eslint_plugin_mocha.default
880
- },
881
- rules: {
882
- ...import_js.default.configs.recommended.rules,
883
- ...import_eslint_config_godaddy.default.rules,
884
- "quote-props": "off",
885
- "linebreak-style": "off",
886
- complexity: "off",
887
- "max-statements": "off",
888
- "id-length": "off",
889
- "default-case": "off",
890
- "valid-jsdoc": "off",
891
- "generator-star-spacing": "off",
892
- "max-params": "off",
893
- "max-depth": "off",
894
- "max-len": "off",
895
- indent: "off",
896
- "no-undefined": "off",
897
- "no-process-env": "off",
898
- "no-sync": "off",
899
- "no-continue": "off",
900
- "no-case-declarations": "off",
901
- "callback-return": "off",
902
- "unicorn/prefer-string-slice": "off",
903
- "unicorn/prefer-string-replace-all": "off",
904
- "new-cap": "off"
905
- }
906
- };
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
+ };
907
1037
  }
908
1038
 
909
- // src/factory/index.ts
1039
+ //#endregion
1040
+ //#region src/factory/index.ts
910
1041
  function factory(root, options) {
911
- import_node_assert.default.ok(root, "root option is required");
912
- let rootDir;
913
- if (typeof root === "string") {
914
- rootDir = root;
915
- } else if (root?.url) {
916
- rootDir = import_node_path2.default.dirname((0, import_node_url.fileURLToPath)(root.url));
917
- } else {
918
- throw new Error("root must be a string or ImportMeta");
919
- }
920
- const tsconfigFiles = (0, import_eslint_utils3.findTsconfigFiles)(rootDir, {
921
- absolute: true
922
- });
923
- const defaultOptions = {
924
- jsdoc: true,
925
- prettier: true,
926
- lodash: true,
927
- cspell: {},
928
- import: true
929
- };
930
- options = {
931
- ...defaultOptions,
932
- ...options
933
- };
934
- if (options.config) {
935
- import_node_assert.default.ok(
936
- Object.keys(options.config).every(
937
- (key) => key === "rules" || key === "settings"
938
- ),
939
- "config option must only contain rules and settings"
940
- );
941
- }
942
- const commonConfigs = [
943
- unicorn({
944
- module: options.module ?? false
945
- }),
946
- comments()
947
- ];
948
- if (options.import) {
949
- commonConfigs.push(
950
- imports(rootDir, typeof options.import === "object" ? options.import : {})
951
- );
952
- }
953
- if (options.prettier) {
954
- commonConfigs.push(
955
- prettier(
956
- typeof options.prettier === "object" ? options.prettier : void 0
957
- )
958
- );
959
- }
960
- const config2 = [];
961
- if (options.godaddy) {
962
- config2.push({
963
- name: "agilebot/parser",
964
- files: DEFAULT_GLOBS,
965
- languageOptions: {
966
- parser: options.godaddy === "typescript" ? parserTs : void 0,
967
- parserOptions: {
968
- project: tsconfigFiles.length > 0 ? tsconfigFiles : true
969
- }
970
- }
971
- });
972
- config2.push(env());
973
- if (options.jsdoc) {
974
- config2.push(
975
- jsdoc({
976
- ts: false
977
- })
978
- );
979
- }
980
- config2.push(...commonConfigs);
981
- config2.push(godaddy());
982
- } else {
983
- config2.push({
984
- name: "agilebot/parser",
985
- files: DEFAULT_GLOBS,
986
- languageOptions: {
987
- parser: !options.vue ? parserTs : parserVue,
988
- parserOptions: {
989
- parser: parserTs,
990
- tsconfigRootDir: root,
991
- projectService: true,
992
- project: tsconfigFiles.length > 0 ? tsconfigFiles : true,
993
- ecmaFeatures: {
994
- jsx: true
995
- },
996
- sourceType: options.module ? "module" : void 0,
997
- extraFileExtensions: !options.vue ? void 0 : [".vue"]
998
- }
999
- }
1000
- });
1001
- config2.push(env());
1002
- config2.push(standard());
1003
- config2.push(ts());
1004
- config2.push(jsOnly());
1005
- config2.push(dts());
1006
- config2.push(tsOnly());
1007
- if (options.react) {
1008
- config2.push(react({ version: options.react }));
1009
- config2.push(reactJsOnly());
1010
- }
1011
- if (options.vue) {
1012
- config2.push(
1013
- vue({
1014
- version: options.vue
1015
- })
1016
- );
1017
- }
1018
- if (options.lodash) {
1019
- config2.push(lodash());
1020
- }
1021
- if (options.cspell) {
1022
- config2.push(cspell(options.cspell));
1023
- }
1024
- if (options.jsdoc) {
1025
- config2.push({
1026
- ...jsdoc({
1027
- ts: true
1028
- }),
1029
- files: TS_GLOBS
1030
- });
1031
- config2.push({
1032
- ...jsdoc({
1033
- ts: false
1034
- }),
1035
- files: JS_GLOBS
1036
- });
1037
- }
1038
- config2.push(...commonConfigs);
1039
- config2.push(
1040
- agilebot({
1041
- root: rootDir,
1042
- monorepoScope: typeof options.import === "object" ? options.import?.monorepoScope : void 0
1043
- })
1044
- );
1045
- }
1046
- if (options.config) {
1047
- config2.push({
1048
- name: "agilebot/custom",
1049
- files: DEFAULT_GLOBS,
1050
- ...options.config
1051
- });
1052
- }
1053
- config2.push({
1054
- name: "agilebot/ignores",
1055
- ignores: [...IGNORE_GLOBS, ...options.ignores ?? []]
1056
- });
1057
- const allPlugins = {};
1058
- config2.forEach((configItem) => {
1059
- if (configItem.plugins) {
1060
- Object.assign(allPlugins, configItem.plugins);
1061
- delete configItem.plugins;
1062
- }
1063
- });
1064
- config2.unshift({
1065
- name: "agilebot/plugins",
1066
- files: DEFAULT_GLOBS,
1067
- plugins: allPlugins
1068
- });
1069
- 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;
1070
1145
  }
1071
- // Annotate the CommonJS export names for ESM import in node:
1072
- 0 && (module.exports = {
1073
- agilebot
1074
- });
1075
- /**
1076
- * @license @agilebot/prettier-config v0.8.1
1077
- *
1078
- * Copyright (c) Agilebot, Inc. and its affiliates.
1079
- *
1080
- * This source code is licensed under the MIT license found in the
1081
- * LICENSE file in the root directory of this source tree.
1082
- */
1146
+
1147
+ //#endregion
1148
+ exports.agilebot = factory;