@agilebot/eslint-config 0.7.4 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -9
- package/bin/eslint-agilebot +2 -2
- package/dist/{chunk-F5MZBDNJ.mjs → chunk-S6JKNAIM.mjs} +9 -9
- package/dist/cli.js +12 -12
- package/dist/cli.mjs +13 -13
- package/dist/index.d.mts +32 -18
- package/dist/index.d.ts +32 -18
- package/dist/index.js +42 -172
- package/dist/index.mjs +37 -165
- package/package.json +21 -19
- package/LICENSE.tpl +0 -8
package/LICENSE
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2024 Agilebot, Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Agilebot, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/bin/eslint-agilebot
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
require('../dist/cli');
|
1
|
+
#!/usr/bin/env node
|
2
|
+
require('../dist/cli');
|
@@ -1,11 +1,11 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license @agilebot/eslint-config v0.8.1
|
3
|
+
*
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
9
|
|
10
10
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
11
11
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
@@ -17,7 +17,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
17
17
|
// <define:__STANDARD_RULES>
|
18
18
|
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 }] };
|
19
19
|
|
20
|
-
// ../../node_modules/.pnpm/tsup@8.
|
20
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_jiti@2.4.2_postc_f8bfeb2bd6bc12891f26d321a609b27e/node_modules/tsup/assets/esm_shims.js
|
21
21
|
import { fileURLToPath } from "url";
|
22
22
|
import path from "path";
|
23
23
|
var getFilename = () => fileURLToPath(import.meta.url);
|
package/dist/cli.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license @agilebot/eslint-config v0.8.1
|
3
|
+
*
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
9
|
|
10
10
|
"use strict";
|
11
11
|
var __create = Object.create;
|
@@ -32,10 +32,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
32
32
|
));
|
33
33
|
|
34
34
|
// src/cli/index.ts
|
35
|
-
var import_eslint_utils = require("@agilebot/eslint-utils");
|
36
35
|
var import_yargs = __toESM(require("yargs"));
|
37
36
|
var import_helpers = require("yargs/helpers");
|
38
|
-
var
|
37
|
+
var import_ansis = __toESM(require("ansis"));
|
38
|
+
var import_eslint_utils = require("@agilebot/eslint-utils");
|
39
39
|
|
40
40
|
// src/constants.ts
|
41
41
|
var JS_EXTS = [".js", ".jsx", ".cjs", ".cjsx", ".mjs", ".mjsx"];
|
@@ -102,7 +102,7 @@ function cli() {
|
|
102
102
|
process.argv = process.argv.slice(0, 2);
|
103
103
|
if (argv._.length === 0) {
|
104
104
|
console.error(
|
105
|
-
|
105
|
+
import_ansis.default.red(
|
106
106
|
"Error: 'patterns' must be a non-empty string or an array of non-empty strings"
|
107
107
|
)
|
108
108
|
);
|
@@ -129,7 +129,7 @@ function cli() {
|
|
129
129
|
}
|
130
130
|
if (!argv.showWarningsInCi && (0, import_eslint_utils.isCI)()) {
|
131
131
|
console.warn(
|
132
|
-
|
132
|
+
import_ansis.default.yellow(
|
133
133
|
`Warning: ${CLI_NAME} will report errors only in CI environment`
|
134
134
|
)
|
135
135
|
);
|
package/dist/cli.mjs
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license @agilebot/eslint-config v0.8.1
|
3
|
+
*
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
9
|
|
10
10
|
import {
|
11
11
|
CLI_NAME,
|
12
12
|
__require
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-S6JKNAIM.mjs";
|
14
14
|
|
15
15
|
// src/cli/index.ts
|
16
|
-
import { isCI } from "@agilebot/eslint-utils";
|
17
16
|
import yargs from "yargs";
|
18
17
|
import { hideBin } from "yargs/helpers";
|
19
|
-
import
|
18
|
+
import ansis from "ansis";
|
19
|
+
import { isCI } from "@agilebot/eslint-utils";
|
20
20
|
|
21
21
|
// src/cli/stages/eslint.ts
|
22
22
|
import path from "node:path";
|
@@ -70,7 +70,7 @@ function cli() {
|
|
70
70
|
process.argv = process.argv.slice(0, 2);
|
71
71
|
if (argv._.length === 0) {
|
72
72
|
console.error(
|
73
|
-
|
73
|
+
ansis.red(
|
74
74
|
"Error: 'patterns' must be a non-empty string or an array of non-empty strings"
|
75
75
|
)
|
76
76
|
);
|
@@ -97,7 +97,7 @@ function cli() {
|
|
97
97
|
}
|
98
98
|
if (!argv.showWarningsInCi && isCI()) {
|
99
99
|
console.warn(
|
100
|
-
|
100
|
+
ansis.yellow(
|
101
101
|
`Warning: ${CLI_NAME} will report errors only in CI environment`
|
102
102
|
)
|
103
103
|
);
|
package/dist/index.d.mts
CHANGED
@@ -10,32 +10,50 @@ interface FlatConfigItem extends Linter.Config {
|
|
10
10
|
|
11
11
|
type Options = Options$1['cspell'];
|
12
12
|
|
13
|
-
interface
|
13
|
+
interface ImportsOptions {
|
14
14
|
/**
|
15
|
-
*
|
15
|
+
* 额外的devDependencies
|
16
16
|
* @default undefined
|
17
17
|
*/
|
18
|
-
|
18
|
+
devDependencies?: string[];
|
19
19
|
/**
|
20
|
-
*
|
20
|
+
* monorepo前缀
|
21
21
|
* @default undefined
|
22
22
|
*/
|
23
|
-
|
23
|
+
monorepoScope?: string;
|
24
24
|
/**
|
25
|
-
*
|
26
|
-
* @default
|
25
|
+
* 核心模块
|
26
|
+
* @default undefiend
|
27
27
|
*/
|
28
|
-
|
28
|
+
coreModules?: string[];
|
29
|
+
/**
|
30
|
+
* 解析器
|
31
|
+
* @default 'typescript'
|
32
|
+
*/
|
33
|
+
resolver?: 'typescript' | 'oxc';
|
34
|
+
/**
|
35
|
+
* 是否允许相对路径
|
36
|
+
* @default false
|
37
|
+
*/
|
38
|
+
allowRelativePaths?: boolean;
|
29
39
|
/**
|
30
|
-
*
|
40
|
+
* 是否允许幽灵依赖
|
41
|
+
* @default false
|
42
|
+
*/
|
43
|
+
allowExtraneousDependencies?: boolean;
|
44
|
+
}
|
45
|
+
|
46
|
+
interface FactoryOptions {
|
47
|
+
/**
|
48
|
+
* Custom ESLint configuration to override or extend defaults
|
31
49
|
* @default undefined
|
32
50
|
*/
|
33
|
-
|
51
|
+
config?: Omit<FlatConfigItem, 'name' | 'files'>;
|
34
52
|
/**
|
35
|
-
*
|
53
|
+
* List of files to ignore
|
36
54
|
* @default undefined
|
37
55
|
*/
|
38
|
-
|
56
|
+
ignores?: string[];
|
39
57
|
/**
|
40
58
|
* Enable React-specific linting rules
|
41
59
|
* @default undefined
|
@@ -77,14 +95,10 @@ interface FactoryOptions {
|
|
77
95
|
*/
|
78
96
|
cspell?: Options | false;
|
79
97
|
/**
|
80
|
-
* Enable
|
98
|
+
* Enable or disable import linting rules
|
81
99
|
* @default true
|
82
100
|
*/
|
83
|
-
import?: boolean;
|
84
|
-
/**
|
85
|
-
* Flag indicating which import resolver to use
|
86
|
-
*/
|
87
|
-
importResolver?: 'typescript' | 'oxc';
|
101
|
+
import?: ImportsOptions | boolean;
|
88
102
|
}
|
89
103
|
|
90
104
|
declare function factory(root: string | ImportMeta, options?: FactoryOptions): FlatConfigItem[];
|
package/dist/index.d.ts
CHANGED
@@ -10,32 +10,50 @@ interface FlatConfigItem extends Linter.Config {
|
|
10
10
|
|
11
11
|
type Options = Options$1['cspell'];
|
12
12
|
|
13
|
-
interface
|
13
|
+
interface ImportsOptions {
|
14
14
|
/**
|
15
|
-
*
|
15
|
+
* 额外的devDependencies
|
16
16
|
* @default undefined
|
17
17
|
*/
|
18
|
-
|
18
|
+
devDependencies?: string[];
|
19
19
|
/**
|
20
|
-
*
|
20
|
+
* monorepo前缀
|
21
21
|
* @default undefined
|
22
22
|
*/
|
23
|
-
|
23
|
+
monorepoScope?: string;
|
24
24
|
/**
|
25
|
-
*
|
26
|
-
* @default
|
25
|
+
* 核心模块
|
26
|
+
* @default undefiend
|
27
27
|
*/
|
28
|
-
|
28
|
+
coreModules?: string[];
|
29
|
+
/**
|
30
|
+
* 解析器
|
31
|
+
* @default 'typescript'
|
32
|
+
*/
|
33
|
+
resolver?: 'typescript' | 'oxc';
|
34
|
+
/**
|
35
|
+
* 是否允许相对路径
|
36
|
+
* @default false
|
37
|
+
*/
|
38
|
+
allowRelativePaths?: boolean;
|
29
39
|
/**
|
30
|
-
*
|
40
|
+
* 是否允许幽灵依赖
|
41
|
+
* @default false
|
42
|
+
*/
|
43
|
+
allowExtraneousDependencies?: boolean;
|
44
|
+
}
|
45
|
+
|
46
|
+
interface FactoryOptions {
|
47
|
+
/**
|
48
|
+
* Custom ESLint configuration to override or extend defaults
|
31
49
|
* @default undefined
|
32
50
|
*/
|
33
|
-
|
51
|
+
config?: Omit<FlatConfigItem, 'name' | 'files'>;
|
34
52
|
/**
|
35
|
-
*
|
53
|
+
* List of files to ignore
|
36
54
|
* @default undefined
|
37
55
|
*/
|
38
|
-
|
56
|
+
ignores?: string[];
|
39
57
|
/**
|
40
58
|
* Enable React-specific linting rules
|
41
59
|
* @default undefined
|
@@ -77,14 +95,10 @@ interface FactoryOptions {
|
|
77
95
|
*/
|
78
96
|
cspell?: Options | false;
|
79
97
|
/**
|
80
|
-
* Enable
|
98
|
+
* Enable or disable import linting rules
|
81
99
|
* @default true
|
82
100
|
*/
|
83
|
-
import?: boolean;
|
84
|
-
/**
|
85
|
-
* Flag indicating which import resolver to use
|
86
|
-
*/
|
87
|
-
importResolver?: 'typescript' | 'oxc';
|
101
|
+
import?: ImportsOptions | boolean;
|
88
102
|
}
|
89
103
|
|
90
104
|
declare function factory(root: string | ImportMeta, options?: FactoryOptions): FlatConfigItem[];
|
package/dist/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license @agilebot/eslint-config v0.8.1
|
3
|
+
*
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
9
|
|
10
10
|
"use strict";
|
11
11
|
var __create = Object.create;
|
@@ -37,11 +37,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
37
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
38
38
|
|
39
39
|
// src/index.ts
|
40
|
-
var
|
41
|
-
__export(
|
40
|
+
var index_exports = {};
|
41
|
+
__export(index_exports, {
|
42
42
|
agilebot: () => factory
|
43
43
|
});
|
44
|
-
module.exports = __toCommonJS(
|
44
|
+
module.exports = __toCommonJS(index_exports);
|
45
45
|
|
46
46
|
// <define:__STANDARD_RULES>
|
47
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 }] };
|
@@ -49,10 +49,10 @@ var define_STANDARD_RULES_default = { "class-methods-use-this": ["off"], "dot-no
|
|
49
49
|
// src/factory/index.ts
|
50
50
|
var import_node_assert = __toESM(require("assert"));
|
51
51
|
var import_node_url = require("url");
|
52
|
-
var
|
53
|
-
var import_eslint_utils3 = require("@agilebot/eslint-utils");
|
52
|
+
var import_node_path2 = __toESM(require("path"));
|
54
53
|
var parserTs = __toESM(require("@typescript-eslint/parser"));
|
55
54
|
var parserVue = __toESM(require("vue-eslint-parser"));
|
55
|
+
var import_eslint_utils3 = require("@agilebot/eslint-utils");
|
56
56
|
|
57
57
|
// src/configs/env.ts
|
58
58
|
var import_globals = __toESM(require("globals"));
|
@@ -234,11 +234,12 @@ function standardDisabled() {
|
|
234
234
|
}
|
235
235
|
|
236
236
|
// src/configs/ts.ts
|
237
|
-
var import_eslint_utils = require("@agilebot/eslint-utils");
|
238
237
|
var pluginTs2 = __toESM(require("@typescript-eslint/eslint-plugin"));
|
239
238
|
var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"));
|
240
239
|
var import_eslint_plugin_prefer_arrow_functions = __toESM(require("eslint-plugin-prefer-arrow-functions"));
|
241
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");
|
242
243
|
function ts() {
|
243
244
|
return {
|
244
245
|
name: "agilebot/ts",
|
@@ -247,7 +248,8 @@ function ts() {
|
|
247
248
|
"@typescript-eslint": pluginTs2,
|
248
249
|
"@stylistic": import_eslint_plugin2.default,
|
249
250
|
"prefer-arrow-functions": import_eslint_plugin_prefer_arrow_functions.default,
|
250
|
-
"unused-imports": import_eslint_plugin_unused_imports.default
|
251
|
+
"unused-imports": import_eslint_plugin_unused_imports.default,
|
252
|
+
"react-edge": import_eslint_plugin_react_edge.default
|
251
253
|
},
|
252
254
|
rules: {
|
253
255
|
// 如果没用模板字符串,避免使用反引号
|
@@ -337,7 +339,8 @@ function ts() {
|
|
337
339
|
checksVoidReturn: false
|
338
340
|
}
|
339
341
|
],
|
340
|
-
"@typescript-eslint/no-deprecated": "error"
|
342
|
+
"@typescript-eslint/no-deprecated": "error",
|
343
|
+
"react-edge/var-naming": "error"
|
341
344
|
}
|
342
345
|
};
|
343
346
|
}
|
@@ -378,14 +381,14 @@ function dts() {
|
|
378
381
|
// src/configs/imports.ts
|
379
382
|
var import_node_path = __toESM(require("path"));
|
380
383
|
var import_node_fs = __toESM(require("fs"));
|
381
|
-
var import_eslint_utils2 = require("@agilebot/eslint-utils");
|
382
384
|
var import_eslint_plugin_import_x2 = __toESM(require("eslint-plugin-import-x"));
|
383
385
|
var import_eslint_plugin_no_relative_import_paths = __toESM(require("eslint-plugin-no-relative-import-paths"));
|
384
|
-
|
386
|
+
var import_eslint_utils2 = require("@agilebot/eslint-utils");
|
387
|
+
function imports(packageDir, opts) {
|
385
388
|
const rootDir = (0, import_eslint_utils2.findRootDir)(__dirname);
|
386
|
-
const pkgPath = import_node_path.default.join(
|
389
|
+
const pkgPath = import_node_path.default.join(packageDir, "package.json");
|
387
390
|
if (!import_node_fs.default.existsSync(pkgPath)) {
|
388
|
-
throw new Error(`package.json not found in ${
|
391
|
+
throw new Error(`package.json not found in ${packageDir}`);
|
389
392
|
}
|
390
393
|
const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf8"));
|
391
394
|
const tmpPkg = {
|
@@ -439,10 +442,10 @@ function imports(opts) {
|
|
439
442
|
allowObject: true
|
440
443
|
}
|
441
444
|
],
|
442
|
-
"import-x/no-extraneous-dependencies": [
|
445
|
+
"import-x/no-extraneous-dependencies": opts.allowExtraneousDependencies ? "off" : [
|
443
446
|
"error",
|
444
447
|
{
|
445
|
-
packageDir: [
|
448
|
+
packageDir: [packageDir, tmpPkgDir, rootDir],
|
446
449
|
devDependencies: [
|
447
450
|
"test/**/*",
|
448
451
|
"tests/**/*",
|
@@ -480,10 +483,7 @@ function imports(opts) {
|
|
480
483
|
distinctGroup: false
|
481
484
|
}
|
482
485
|
],
|
483
|
-
"no-relative-import-paths/no-relative-import-paths": [
|
484
|
-
"warn",
|
485
|
-
{ allowSameFolder: true }
|
486
|
-
]
|
486
|
+
"no-relative-import-paths/no-relative-import-paths": opts.allowRelativePaths ? "off" : ["warn", { allowSameFolder: true }]
|
487
487
|
},
|
488
488
|
settings: {
|
489
489
|
"import-x/parsers": {
|
@@ -552,6 +552,7 @@ var import_eslint_plugin3 = __toESM(require("@eslint-react/eslint-plugin"));
|
|
552
552
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"));
|
553
553
|
var import_eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"));
|
554
554
|
var import_eslint_plugin4 = __toESM(require("@stylistic/eslint-plugin"));
|
555
|
+
var import_eslint_plugin_react_edge2 = __toESM(require("eslint-plugin-react-edge"));
|
555
556
|
var import_eslint_plugin5 = __toESM(require("@agilebot/eslint-plugin"));
|
556
557
|
function react(opts) {
|
557
558
|
return {
|
@@ -563,12 +564,11 @@ function react(opts) {
|
|
563
564
|
"jsx-a11y": import_eslint_plugin_jsx_a11y.default,
|
564
565
|
...import_eslint_plugin3.default.configs.recommended.plugins,
|
565
566
|
"@stylistic": import_eslint_plugin4.default,
|
566
|
-
"@agilebot": import_eslint_plugin5.default
|
567
|
+
"@agilebot": import_eslint_plugin5.default,
|
568
|
+
"react-edge": import_eslint_plugin_react_edge2.default
|
567
569
|
},
|
568
570
|
rules: {
|
569
571
|
...import_eslint_plugin_jsx_a11y.default.flatConfigs.recommended.rules,
|
570
|
-
// recommended rules from eslint-plugin-react
|
571
|
-
"react/no-is-mounted": "error",
|
572
572
|
// recommended rules from @eslint-react
|
573
573
|
"@eslint-react/no-direct-mutation-state": "error",
|
574
574
|
// Children API
|
@@ -625,6 +625,7 @@ function react(opts) {
|
|
625
625
|
"react-hooks/rules-of-hooks": "error",
|
626
626
|
// recommended rules from @eslint-react/naming-convention
|
627
627
|
"@eslint-react/naming-convention/component-name": "error",
|
628
|
+
"@eslint-react/naming-convention/context-name": "error",
|
628
629
|
"@eslint-react/naming-convention/use-state": "error",
|
629
630
|
// recommended rules from @eslint-react/web-api
|
630
631
|
"@eslint-react/web-api/no-leaked-interval": "warn",
|
@@ -653,7 +654,8 @@ function react(opts) {
|
|
653
654
|
],
|
654
655
|
"jsx-a11y/click-events-have-key-events": "off",
|
655
656
|
"jsx-a11y/no-static-element-interactions": "off",
|
656
|
-
"jsx-a11y/alt-text": "off"
|
657
|
+
"jsx-a11y/alt-text": "off",
|
658
|
+
"react-edge/prefer-named-property-access": "error"
|
657
659
|
},
|
658
660
|
settings: {
|
659
661
|
react: {
|
@@ -724,139 +726,14 @@ function jsdoc(opt) {
|
|
724
726
|
|
725
727
|
// src/configs/lodash.ts
|
726
728
|
var import_eslint_plugin_you_dont_need_lodash_underscore = __toESM(require("eslint-plugin-you-dont-need-lodash-underscore"));
|
727
|
-
|
728
|
-
// ../../node_modules/.pnpm/@eslint+compat@1.2.3_eslint@9.15.0_jiti@2.3.3_/node_modules/@eslint/compat/dist/esm/index.js
|
729
|
-
var import_node_fs2 = __toESM(require("fs"), 1);
|
730
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
731
|
-
var removedMethodNames = /* @__PURE__ */ new Map([
|
732
|
-
["getSource", "getText"],
|
733
|
-
["getSourceLines", "getLines"],
|
734
|
-
["getAllComments", "getAllComments"],
|
735
|
-
["getDeclaredVariables", "getDeclaredVariables"],
|
736
|
-
["getNodeByRangeIndex", "getNodeByRangeIndex"],
|
737
|
-
["getCommentsBefore", "getCommentsBefore"],
|
738
|
-
["getCommentsAfter", "getCommentsAfter"],
|
739
|
-
["getCommentsInside", "getCommentsInside"],
|
740
|
-
["getJSDocComment", "getJSDocComment"],
|
741
|
-
["getFirstToken", "getFirstToken"],
|
742
|
-
["getFirstTokens", "getFirstTokens"],
|
743
|
-
["getLastToken", "getLastToken"],
|
744
|
-
["getLastTokens", "getLastTokens"],
|
745
|
-
["getTokenAfter", "getTokenAfter"],
|
746
|
-
["getTokenBefore", "getTokenBefore"],
|
747
|
-
["getTokenByRangeStart", "getTokenByRangeStart"],
|
748
|
-
["getTokens", "getTokens"],
|
749
|
-
["getTokensAfter", "getTokensAfter"],
|
750
|
-
["getTokensBefore", "getTokensBefore"],
|
751
|
-
["getTokensBetween", "getTokensBetween"]
|
752
|
-
]);
|
753
|
-
var fixedUpRuleReplacements = /* @__PURE__ */ new WeakMap();
|
754
|
-
var fixedUpRules = /* @__PURE__ */ new WeakSet();
|
755
|
-
var fixedUpPluginReplacements = /* @__PURE__ */ new WeakMap();
|
756
|
-
var fixedUpPlugins = /* @__PURE__ */ new WeakSet();
|
757
|
-
function fixupRule(ruleDefinition) {
|
758
|
-
if (fixedUpRuleReplacements.has(ruleDefinition)) {
|
759
|
-
return fixedUpRuleReplacements.get(ruleDefinition);
|
760
|
-
}
|
761
|
-
const isLegacyRule = typeof ruleDefinition === "function";
|
762
|
-
if (!isLegacyRule && fixedUpRules.has(ruleDefinition)) {
|
763
|
-
return ruleDefinition;
|
764
|
-
}
|
765
|
-
const originalCreate = isLegacyRule ? ruleDefinition : ruleDefinition.create.bind(ruleDefinition);
|
766
|
-
function ruleCreate(context) {
|
767
|
-
if ("getScope" in context) {
|
768
|
-
return originalCreate(context);
|
769
|
-
}
|
770
|
-
const sourceCode = context.sourceCode;
|
771
|
-
let currentNode = sourceCode.ast;
|
772
|
-
const newContext = Object.assign(Object.create(context), {
|
773
|
-
parserServices: sourceCode.parserServices,
|
774
|
-
/*
|
775
|
-
* The following methods rely on the current node in the traversal,
|
776
|
-
* so we need to add them manually.
|
777
|
-
*/
|
778
|
-
getScope() {
|
779
|
-
return sourceCode.getScope(currentNode);
|
780
|
-
},
|
781
|
-
getAncestors() {
|
782
|
-
return sourceCode.getAncestors(currentNode);
|
783
|
-
},
|
784
|
-
markVariableAsUsed(variable) {
|
785
|
-
sourceCode.markVariableAsUsed(variable, currentNode);
|
786
|
-
}
|
787
|
-
});
|
788
|
-
for (const [
|
789
|
-
contextMethodName,
|
790
|
-
sourceCodeMethodName
|
791
|
-
] of removedMethodNames) {
|
792
|
-
newContext[contextMethodName] = sourceCode[sourceCodeMethodName].bind(sourceCode);
|
793
|
-
}
|
794
|
-
Object.freeze(newContext);
|
795
|
-
const visitor = originalCreate(newContext);
|
796
|
-
for (const [methodName, method] of Object.entries(visitor)) {
|
797
|
-
if (methodName.startsWith("on")) {
|
798
|
-
visitor[methodName] = (...args) => {
|
799
|
-
currentNode = args[methodName === "onCodePathSegmentLoop" ? 2 : 1];
|
800
|
-
return method.call(visitor, ...args);
|
801
|
-
};
|
802
|
-
continue;
|
803
|
-
}
|
804
|
-
visitor[methodName] = (...args) => {
|
805
|
-
currentNode = args[0];
|
806
|
-
return method.call(visitor, ...args);
|
807
|
-
};
|
808
|
-
}
|
809
|
-
return visitor;
|
810
|
-
}
|
811
|
-
const newRuleDefinition = {
|
812
|
-
...isLegacyRule ? void 0 : ruleDefinition,
|
813
|
-
create: ruleCreate
|
814
|
-
};
|
815
|
-
const { schema } = ruleDefinition;
|
816
|
-
if (schema) {
|
817
|
-
if (!newRuleDefinition.meta) {
|
818
|
-
newRuleDefinition.meta = { schema };
|
819
|
-
} else {
|
820
|
-
newRuleDefinition.meta = {
|
821
|
-
...newRuleDefinition.meta,
|
822
|
-
// top-level `schema` had precedence over `meta.schema` so it's okay to overwrite `meta.schema` if it exists
|
823
|
-
schema
|
824
|
-
};
|
825
|
-
}
|
826
|
-
}
|
827
|
-
fixedUpRuleReplacements.set(ruleDefinition, newRuleDefinition);
|
828
|
-
fixedUpRules.add(newRuleDefinition);
|
829
|
-
return newRuleDefinition;
|
830
|
-
}
|
831
|
-
function fixupPluginRules(plugin) {
|
832
|
-
if (fixedUpPluginReplacements.has(plugin)) {
|
833
|
-
return fixedUpPluginReplacements.get(plugin);
|
834
|
-
}
|
835
|
-
if (fixedUpPlugins.has(plugin) || !plugin.rules) {
|
836
|
-
return plugin;
|
837
|
-
}
|
838
|
-
const newPlugin = {
|
839
|
-
...plugin,
|
840
|
-
rules: Object.fromEntries(
|
841
|
-
Object.entries(plugin.rules).map(([ruleId, ruleDefinition]) => [
|
842
|
-
ruleId,
|
843
|
-
fixupRule(ruleDefinition)
|
844
|
-
])
|
845
|
-
)
|
846
|
-
};
|
847
|
-
fixedUpPluginReplacements.set(plugin, newPlugin);
|
848
|
-
fixedUpPlugins.add(newPlugin);
|
849
|
-
return newPlugin;
|
850
|
-
}
|
851
|
-
|
852
|
-
// src/configs/lodash.ts
|
729
|
+
var import_compat = require("@eslint/compat");
|
853
730
|
function lodash() {
|
854
731
|
return {
|
855
732
|
// lodash一些方法可能影响性能,如forEach等,优先使用js的原生方法
|
856
733
|
name: "agilebot/lodash",
|
857
734
|
files: DEFAULT_GLOBS,
|
858
735
|
plugins: {
|
859
|
-
"you-dont-need-lodash-underscore": fixupPluginRules(import_eslint_plugin_you_dont_need_lodash_underscore.default)
|
736
|
+
"you-dont-need-lodash-underscore": (0, import_compat.fixupPluginRules)(import_eslint_plugin_you_dont_need_lodash_underscore.default)
|
860
737
|
},
|
861
738
|
rules: {
|
862
739
|
...import_eslint_plugin_you_dont_need_lodash_underscore.default.configs["all-warn"].rules,
|
@@ -917,8 +794,8 @@ function cspell(opts) {
|
|
917
794
|
}
|
918
795
|
|
919
796
|
// src/configs/agilebot.ts
|
920
|
-
var import_eslint_plugin7 = __toESM(require("@agilebot/eslint-plugin"));
|
921
797
|
var import_eslint_plugin_react_hooks2 = __toESM(require("eslint-plugin-react-hooks"));
|
798
|
+
var import_eslint_plugin7 = __toESM(require("@agilebot/eslint-plugin"));
|
922
799
|
function agilebot(opts) {
|
923
800
|
return {
|
924
801
|
name: "agilebot/agilebot",
|
@@ -953,7 +830,7 @@ var config = {
|
|
953
830
|
useTabs: false,
|
954
831
|
arrowParens: "avoid"
|
955
832
|
};
|
956
|
-
var
|
833
|
+
var index_default = config;
|
957
834
|
|
958
835
|
// src/configs/prettier.ts
|
959
836
|
function prettier(opts) {
|
@@ -973,7 +850,7 @@ function prettier(opts) {
|
|
973
850
|
"error",
|
974
851
|
{
|
975
852
|
endOfLine: "auto",
|
976
|
-
...
|
853
|
+
...index_default,
|
977
854
|
...opts
|
978
855
|
},
|
979
856
|
{
|
@@ -1036,7 +913,7 @@ function factory(root, options) {
|
|
1036
913
|
if (typeof root === "string") {
|
1037
914
|
rootDir = root;
|
1038
915
|
} else if (root?.url) {
|
1039
|
-
rootDir =
|
916
|
+
rootDir = import_node_path2.default.dirname((0, import_node_url.fileURLToPath)(root.url));
|
1040
917
|
} else {
|
1041
918
|
throw new Error("root must be a string or ImportMeta");
|
1042
919
|
}
|
@@ -1048,8 +925,7 @@ function factory(root, options) {
|
|
1048
925
|
prettier: true,
|
1049
926
|
lodash: true,
|
1050
927
|
cspell: {},
|
1051
|
-
import: true
|
1052
|
-
importResolver: "typescript"
|
928
|
+
import: true
|
1053
929
|
};
|
1054
930
|
options = {
|
1055
931
|
...defaultOptions,
|
@@ -1071,13 +947,7 @@ function factory(root, options) {
|
|
1071
947
|
];
|
1072
948
|
if (options.import) {
|
1073
949
|
commonConfigs.push(
|
1074
|
-
imports({
|
1075
|
-
packageDir: rootDir,
|
1076
|
-
devDependencies: options.devDependencies,
|
1077
|
-
monorepoScope: options.monorepoScope,
|
1078
|
-
coreModules: options.coreModules,
|
1079
|
-
resolver: options.importResolver
|
1080
|
-
})
|
950
|
+
imports(rootDir, typeof options.import === "object" ? options.import : {})
|
1081
951
|
);
|
1082
952
|
}
|
1083
953
|
if (options.prettier) {
|
@@ -1169,7 +1039,7 @@ function factory(root, options) {
|
|
1169
1039
|
config2.push(
|
1170
1040
|
agilebot({
|
1171
1041
|
root: rootDir,
|
1172
|
-
monorepoScope: options.monorepoScope
|
1042
|
+
monorepoScope: typeof options.import === "object" ? options.import?.monorepoScope : void 0
|
1173
1043
|
})
|
1174
1044
|
);
|
1175
1045
|
}
|
@@ -1203,7 +1073,7 @@ function factory(root, options) {
|
|
1203
1073
|
agilebot
|
1204
1074
|
});
|
1205
1075
|
/**
|
1206
|
-
* @license @agilebot/prettier-config v0.
|
1076
|
+
* @license @agilebot/prettier-config v0.8.1
|
1207
1077
|
*
|
1208
1078
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
1209
1079
|
*
|
package/dist/index.mjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license @agilebot/eslint-config v0.8.1
|
3
|
+
*
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
9
|
|
10
10
|
import {
|
11
11
|
DEFAULT_GLOBS,
|
@@ -16,15 +16,15 @@ import {
|
|
16
16
|
VUE_GLOBS,
|
17
17
|
__dirname,
|
18
18
|
define_STANDARD_RULES_default
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-S6JKNAIM.mjs";
|
20
20
|
|
21
21
|
// src/factory/index.ts
|
22
22
|
import assert from "node:assert";
|
23
23
|
import { fileURLToPath } from "node:url";
|
24
24
|
import path2 from "node:path";
|
25
|
-
import { findTsconfigFiles } from "@agilebot/eslint-utils";
|
26
25
|
import * as parserTs from "@typescript-eslint/parser";
|
27
26
|
import * as parserVue from "vue-eslint-parser";
|
27
|
+
import { findTsconfigFiles } from "@agilebot/eslint-utils";
|
28
28
|
|
29
29
|
// src/configs/env.ts
|
30
30
|
import globals from "globals";
|
@@ -159,11 +159,12 @@ function standardDisabled() {
|
|
159
159
|
}
|
160
160
|
|
161
161
|
// src/configs/ts.ts
|
162
|
-
import { isInEditor } from "@agilebot/eslint-utils";
|
163
162
|
import * as pluginTs2 from "@typescript-eslint/eslint-plugin";
|
164
163
|
import pluginStylistic from "@stylistic/eslint-plugin";
|
165
164
|
import pluginPreferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
166
165
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
166
|
+
import pluginReactEdge from "eslint-plugin-react-edge";
|
167
|
+
import { isInEditor } from "@agilebot/eslint-utils";
|
167
168
|
function ts() {
|
168
169
|
return {
|
169
170
|
name: "agilebot/ts",
|
@@ -172,7 +173,8 @@ function ts() {
|
|
172
173
|
"@typescript-eslint": pluginTs2,
|
173
174
|
"@stylistic": pluginStylistic,
|
174
175
|
"prefer-arrow-functions": pluginPreferArrowFunctions,
|
175
|
-
"unused-imports": pluginUnusedImports
|
176
|
+
"unused-imports": pluginUnusedImports,
|
177
|
+
"react-edge": pluginReactEdge
|
176
178
|
},
|
177
179
|
rules: {
|
178
180
|
// 如果没用模板字符串,避免使用反引号
|
@@ -262,7 +264,8 @@ function ts() {
|
|
262
264
|
checksVoidReturn: false
|
263
265
|
}
|
264
266
|
],
|
265
|
-
"@typescript-eslint/no-deprecated": "error"
|
267
|
+
"@typescript-eslint/no-deprecated": "error",
|
268
|
+
"react-edge/var-naming": "error"
|
266
269
|
}
|
267
270
|
};
|
268
271
|
}
|
@@ -303,14 +306,14 @@ function dts() {
|
|
303
306
|
// src/configs/imports.ts
|
304
307
|
import path from "node:path";
|
305
308
|
import fs from "node:fs";
|
306
|
-
import { findCacheDir, findRootDir, isInEditor as isInEditor2 } from "@agilebot/eslint-utils";
|
307
309
|
import pluginImport2 from "eslint-plugin-import-x";
|
308
310
|
import pluginNoRelativeImportPaths from "eslint-plugin-no-relative-import-paths";
|
309
|
-
|
311
|
+
import { findCacheDir, findRootDir, isInEditor as isInEditor2 } from "@agilebot/eslint-utils";
|
312
|
+
function imports(packageDir, opts) {
|
310
313
|
const rootDir = findRootDir(__dirname);
|
311
|
-
const pkgPath = path.join(
|
314
|
+
const pkgPath = path.join(packageDir, "package.json");
|
312
315
|
if (!fs.existsSync(pkgPath)) {
|
313
|
-
throw new Error(`package.json not found in ${
|
316
|
+
throw new Error(`package.json not found in ${packageDir}`);
|
314
317
|
}
|
315
318
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
316
319
|
const tmpPkg = {
|
@@ -364,10 +367,10 @@ function imports(opts) {
|
|
364
367
|
allowObject: true
|
365
368
|
}
|
366
369
|
],
|
367
|
-
"import-x/no-extraneous-dependencies": [
|
370
|
+
"import-x/no-extraneous-dependencies": opts.allowExtraneousDependencies ? "off" : [
|
368
371
|
"error",
|
369
372
|
{
|
370
|
-
packageDir: [
|
373
|
+
packageDir: [packageDir, tmpPkgDir, rootDir],
|
371
374
|
devDependencies: [
|
372
375
|
"test/**/*",
|
373
376
|
"tests/**/*",
|
@@ -405,10 +408,7 @@ function imports(opts) {
|
|
405
408
|
distinctGroup: false
|
406
409
|
}
|
407
410
|
],
|
408
|
-
"no-relative-import-paths/no-relative-import-paths": [
|
409
|
-
"warn",
|
410
|
-
{ allowSameFolder: true }
|
411
|
-
]
|
411
|
+
"no-relative-import-paths/no-relative-import-paths": opts.allowRelativePaths ? "off" : ["warn", { allowSameFolder: true }]
|
412
412
|
},
|
413
413
|
settings: {
|
414
414
|
"import-x/parsers": {
|
@@ -477,6 +477,7 @@ import pluginReactX from "@eslint-react/eslint-plugin";
|
|
477
477
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
478
478
|
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
479
479
|
import pluginStylistic2 from "@stylistic/eslint-plugin";
|
480
|
+
import pluginReactEdge2 from "eslint-plugin-react-edge";
|
480
481
|
import pluginAgilebot from "@agilebot/eslint-plugin";
|
481
482
|
function react(opts) {
|
482
483
|
return {
|
@@ -488,12 +489,11 @@ function react(opts) {
|
|
488
489
|
"jsx-a11y": pluginJsxA11y,
|
489
490
|
...pluginReactX.configs.recommended.plugins,
|
490
491
|
"@stylistic": pluginStylistic2,
|
491
|
-
"@agilebot": pluginAgilebot
|
492
|
+
"@agilebot": pluginAgilebot,
|
493
|
+
"react-edge": pluginReactEdge2
|
492
494
|
},
|
493
495
|
rules: {
|
494
496
|
...pluginJsxA11y.flatConfigs.recommended.rules,
|
495
|
-
// recommended rules from eslint-plugin-react
|
496
|
-
"react/no-is-mounted": "error",
|
497
497
|
// recommended rules from @eslint-react
|
498
498
|
"@eslint-react/no-direct-mutation-state": "error",
|
499
499
|
// Children API
|
@@ -550,6 +550,7 @@ function react(opts) {
|
|
550
550
|
"react-hooks/rules-of-hooks": "error",
|
551
551
|
// recommended rules from @eslint-react/naming-convention
|
552
552
|
"@eslint-react/naming-convention/component-name": "error",
|
553
|
+
"@eslint-react/naming-convention/context-name": "error",
|
553
554
|
"@eslint-react/naming-convention/use-state": "error",
|
554
555
|
// recommended rules from @eslint-react/web-api
|
555
556
|
"@eslint-react/web-api/no-leaked-interval": "warn",
|
@@ -578,7 +579,8 @@ function react(opts) {
|
|
578
579
|
],
|
579
580
|
"jsx-a11y/click-events-have-key-events": "off",
|
580
581
|
"jsx-a11y/no-static-element-interactions": "off",
|
581
|
-
"jsx-a11y/alt-text": "off"
|
582
|
+
"jsx-a11y/alt-text": "off",
|
583
|
+
"react-edge/prefer-named-property-access": "error"
|
582
584
|
},
|
583
585
|
settings: {
|
584
586
|
react: {
|
@@ -649,130 +651,7 @@ function jsdoc(opt) {
|
|
649
651
|
|
650
652
|
// src/configs/lodash.ts
|
651
653
|
import pluginLodash from "eslint-plugin-you-dont-need-lodash-underscore";
|
652
|
-
|
653
|
-
// ../../node_modules/.pnpm/@eslint+compat@1.2.3_eslint@9.15.0_jiti@2.3.3_/node_modules/@eslint/compat/dist/esm/index.js
|
654
|
-
var removedMethodNames = /* @__PURE__ */ new Map([
|
655
|
-
["getSource", "getText"],
|
656
|
-
["getSourceLines", "getLines"],
|
657
|
-
["getAllComments", "getAllComments"],
|
658
|
-
["getDeclaredVariables", "getDeclaredVariables"],
|
659
|
-
["getNodeByRangeIndex", "getNodeByRangeIndex"],
|
660
|
-
["getCommentsBefore", "getCommentsBefore"],
|
661
|
-
["getCommentsAfter", "getCommentsAfter"],
|
662
|
-
["getCommentsInside", "getCommentsInside"],
|
663
|
-
["getJSDocComment", "getJSDocComment"],
|
664
|
-
["getFirstToken", "getFirstToken"],
|
665
|
-
["getFirstTokens", "getFirstTokens"],
|
666
|
-
["getLastToken", "getLastToken"],
|
667
|
-
["getLastTokens", "getLastTokens"],
|
668
|
-
["getTokenAfter", "getTokenAfter"],
|
669
|
-
["getTokenBefore", "getTokenBefore"],
|
670
|
-
["getTokenByRangeStart", "getTokenByRangeStart"],
|
671
|
-
["getTokens", "getTokens"],
|
672
|
-
["getTokensAfter", "getTokensAfter"],
|
673
|
-
["getTokensBefore", "getTokensBefore"],
|
674
|
-
["getTokensBetween", "getTokensBetween"]
|
675
|
-
]);
|
676
|
-
var fixedUpRuleReplacements = /* @__PURE__ */ new WeakMap();
|
677
|
-
var fixedUpRules = /* @__PURE__ */ new WeakSet();
|
678
|
-
var fixedUpPluginReplacements = /* @__PURE__ */ new WeakMap();
|
679
|
-
var fixedUpPlugins = /* @__PURE__ */ new WeakSet();
|
680
|
-
function fixupRule(ruleDefinition) {
|
681
|
-
if (fixedUpRuleReplacements.has(ruleDefinition)) {
|
682
|
-
return fixedUpRuleReplacements.get(ruleDefinition);
|
683
|
-
}
|
684
|
-
const isLegacyRule = typeof ruleDefinition === "function";
|
685
|
-
if (!isLegacyRule && fixedUpRules.has(ruleDefinition)) {
|
686
|
-
return ruleDefinition;
|
687
|
-
}
|
688
|
-
const originalCreate = isLegacyRule ? ruleDefinition : ruleDefinition.create.bind(ruleDefinition);
|
689
|
-
function ruleCreate(context) {
|
690
|
-
if ("getScope" in context) {
|
691
|
-
return originalCreate(context);
|
692
|
-
}
|
693
|
-
const sourceCode = context.sourceCode;
|
694
|
-
let currentNode = sourceCode.ast;
|
695
|
-
const newContext = Object.assign(Object.create(context), {
|
696
|
-
parserServices: sourceCode.parserServices,
|
697
|
-
/*
|
698
|
-
* The following methods rely on the current node in the traversal,
|
699
|
-
* so we need to add them manually.
|
700
|
-
*/
|
701
|
-
getScope() {
|
702
|
-
return sourceCode.getScope(currentNode);
|
703
|
-
},
|
704
|
-
getAncestors() {
|
705
|
-
return sourceCode.getAncestors(currentNode);
|
706
|
-
},
|
707
|
-
markVariableAsUsed(variable) {
|
708
|
-
sourceCode.markVariableAsUsed(variable, currentNode);
|
709
|
-
}
|
710
|
-
});
|
711
|
-
for (const [
|
712
|
-
contextMethodName,
|
713
|
-
sourceCodeMethodName
|
714
|
-
] of removedMethodNames) {
|
715
|
-
newContext[contextMethodName] = sourceCode[sourceCodeMethodName].bind(sourceCode);
|
716
|
-
}
|
717
|
-
Object.freeze(newContext);
|
718
|
-
const visitor = originalCreate(newContext);
|
719
|
-
for (const [methodName, method] of Object.entries(visitor)) {
|
720
|
-
if (methodName.startsWith("on")) {
|
721
|
-
visitor[methodName] = (...args) => {
|
722
|
-
currentNode = args[methodName === "onCodePathSegmentLoop" ? 2 : 1];
|
723
|
-
return method.call(visitor, ...args);
|
724
|
-
};
|
725
|
-
continue;
|
726
|
-
}
|
727
|
-
visitor[methodName] = (...args) => {
|
728
|
-
currentNode = args[0];
|
729
|
-
return method.call(visitor, ...args);
|
730
|
-
};
|
731
|
-
}
|
732
|
-
return visitor;
|
733
|
-
}
|
734
|
-
const newRuleDefinition = {
|
735
|
-
...isLegacyRule ? void 0 : ruleDefinition,
|
736
|
-
create: ruleCreate
|
737
|
-
};
|
738
|
-
const { schema } = ruleDefinition;
|
739
|
-
if (schema) {
|
740
|
-
if (!newRuleDefinition.meta) {
|
741
|
-
newRuleDefinition.meta = { schema };
|
742
|
-
} else {
|
743
|
-
newRuleDefinition.meta = {
|
744
|
-
...newRuleDefinition.meta,
|
745
|
-
// top-level `schema` had precedence over `meta.schema` so it's okay to overwrite `meta.schema` if it exists
|
746
|
-
schema
|
747
|
-
};
|
748
|
-
}
|
749
|
-
}
|
750
|
-
fixedUpRuleReplacements.set(ruleDefinition, newRuleDefinition);
|
751
|
-
fixedUpRules.add(newRuleDefinition);
|
752
|
-
return newRuleDefinition;
|
753
|
-
}
|
754
|
-
function fixupPluginRules(plugin) {
|
755
|
-
if (fixedUpPluginReplacements.has(plugin)) {
|
756
|
-
return fixedUpPluginReplacements.get(plugin);
|
757
|
-
}
|
758
|
-
if (fixedUpPlugins.has(plugin) || !plugin.rules) {
|
759
|
-
return plugin;
|
760
|
-
}
|
761
|
-
const newPlugin = {
|
762
|
-
...plugin,
|
763
|
-
rules: Object.fromEntries(
|
764
|
-
Object.entries(plugin.rules).map(([ruleId, ruleDefinition]) => [
|
765
|
-
ruleId,
|
766
|
-
fixupRule(ruleDefinition)
|
767
|
-
])
|
768
|
-
)
|
769
|
-
};
|
770
|
-
fixedUpPluginReplacements.set(plugin, newPlugin);
|
771
|
-
fixedUpPlugins.add(newPlugin);
|
772
|
-
return newPlugin;
|
773
|
-
}
|
774
|
-
|
775
|
-
// src/configs/lodash.ts
|
654
|
+
import { fixupPluginRules } from "@eslint/compat";
|
776
655
|
function lodash() {
|
777
656
|
return {
|
778
657
|
// lodash一些方法可能影响性能,如forEach等,优先使用js的原生方法
|
@@ -840,8 +719,8 @@ function cspell(opts) {
|
|
840
719
|
}
|
841
720
|
|
842
721
|
// src/configs/agilebot.ts
|
843
|
-
import pluginAgilebot2 from "@agilebot/eslint-plugin";
|
844
722
|
import pluginReactHooks2 from "eslint-plugin-react-hooks";
|
723
|
+
import pluginAgilebot2 from "@agilebot/eslint-plugin";
|
845
724
|
function agilebot(opts) {
|
846
725
|
return {
|
847
726
|
name: "agilebot/agilebot",
|
@@ -876,7 +755,7 @@ var config = {
|
|
876
755
|
useTabs: false,
|
877
756
|
arrowParens: "avoid"
|
878
757
|
};
|
879
|
-
var
|
758
|
+
var index_default = config;
|
880
759
|
|
881
760
|
// src/configs/prettier.ts
|
882
761
|
function prettier(opts) {
|
@@ -896,7 +775,7 @@ function prettier(opts) {
|
|
896
775
|
"error",
|
897
776
|
{
|
898
777
|
endOfLine: "auto",
|
899
|
-
...
|
778
|
+
...index_default,
|
900
779
|
...opts
|
901
780
|
},
|
902
781
|
{
|
@@ -971,8 +850,7 @@ function factory(root, options) {
|
|
971
850
|
prettier: true,
|
972
851
|
lodash: true,
|
973
852
|
cspell: {},
|
974
|
-
import: true
|
975
|
-
importResolver: "typescript"
|
853
|
+
import: true
|
976
854
|
};
|
977
855
|
options = {
|
978
856
|
...defaultOptions,
|
@@ -994,13 +872,7 @@ function factory(root, options) {
|
|
994
872
|
];
|
995
873
|
if (options.import) {
|
996
874
|
commonConfigs.push(
|
997
|
-
imports({
|
998
|
-
packageDir: rootDir,
|
999
|
-
devDependencies: options.devDependencies,
|
1000
|
-
monorepoScope: options.monorepoScope,
|
1001
|
-
coreModules: options.coreModules,
|
1002
|
-
resolver: options.importResolver
|
1003
|
-
})
|
875
|
+
imports(rootDir, typeof options.import === "object" ? options.import : {})
|
1004
876
|
);
|
1005
877
|
}
|
1006
878
|
if (options.prettier) {
|
@@ -1092,7 +964,7 @@ function factory(root, options) {
|
|
1092
964
|
config2.push(
|
1093
965
|
agilebot({
|
1094
966
|
root: rootDir,
|
1095
|
-
monorepoScope: options.monorepoScope
|
967
|
+
monorepoScope: typeof options.import === "object" ? options.import?.monorepoScope : void 0
|
1096
968
|
})
|
1097
969
|
);
|
1098
970
|
}
|
@@ -1125,7 +997,7 @@ export {
|
|
1125
997
|
factory as agilebot
|
1126
998
|
};
|
1127
999
|
/**
|
1128
|
-
* @license @agilebot/prettier-config v0.
|
1000
|
+
* @license @agilebot/prettier-config v0.8.1
|
1129
1001
|
*
|
1130
1002
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
1131
1003
|
*
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.8.1",
|
4
4
|
"description": "Agilebot's ESLint config",
|
5
5
|
"bin": {
|
6
6
|
"eslint-agilebot": "bin/eslint-agilebot"
|
@@ -26,39 +26,41 @@
|
|
26
26
|
},
|
27
27
|
"homepage": "https://github.com/sh-agilebot/frontend-toolkit/tree/master/packages/eslint-config#readme",
|
28
28
|
"dependencies": {
|
29
|
-
"@cspell/eslint-plugin": "^8.
|
29
|
+
"@cspell/eslint-plugin": "^8.17.5",
|
30
30
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
31
|
-
"@eslint-react/eslint-plugin": "^1.
|
32
|
-
"@eslint/
|
33
|
-
"@
|
31
|
+
"@eslint-react/eslint-plugin": "^1.29.0",
|
32
|
+
"@eslint/compat": "^1.2.7",
|
33
|
+
"@eslint/js": "^9.21.0",
|
34
|
+
"@stylistic/eslint-plugin": "^4.1.0",
|
34
35
|
"@typescript-eslint/eslint-plugin": "~8.25.0",
|
35
36
|
"@typescript-eslint/parser": "~8.25.0",
|
37
|
+
"ansis": "^3.17.0",
|
36
38
|
"eslint-config-godaddy": "^6.0.0",
|
37
39
|
"eslint-config-prettier": "^9.1.0",
|
38
|
-
"eslint-import-resolver-oxc": "^0.
|
39
|
-
"eslint-import-resolver-typescript": "^3.
|
40
|
-
"eslint-plugin-file-progress": "^
|
41
|
-
"eslint-plugin-import-x": "^4.
|
42
|
-
"eslint-plugin-jsdoc": "^50.
|
40
|
+
"eslint-import-resolver-oxc": "^0.12.0",
|
41
|
+
"eslint-import-resolver-typescript": "^3.8.3",
|
42
|
+
"eslint-plugin-file-progress": "^3.0.1",
|
43
|
+
"eslint-plugin-import-x": "^4.6.1",
|
44
|
+
"eslint-plugin-jsdoc": "^50.6.3",
|
43
45
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
44
46
|
"eslint-plugin-mocha": "^10.5.0",
|
45
|
-
"eslint-plugin-n": "^17.
|
46
|
-
"eslint-plugin-no-relative-import-paths": "^1.
|
47
|
-
"eslint-plugin-prefer-arrow-functions": "^3.
|
47
|
+
"eslint-plugin-n": "^17.16.1",
|
48
|
+
"eslint-plugin-no-relative-import-paths": "^1.6.1",
|
49
|
+
"eslint-plugin-prefer-arrow-functions": "^3.6.2",
|
48
50
|
"eslint-plugin-prettier": "^5.2.1",
|
49
|
-
"eslint-plugin-promise": "^7.1
|
51
|
+
"eslint-plugin-promise": "^7.2.1",
|
50
52
|
"eslint-plugin-react": "^7.37.2",
|
53
|
+
"eslint-plugin-react-edge": "^0.1.1",
|
51
54
|
"eslint-plugin-react-hooks": "^5.0.0",
|
52
55
|
"eslint-plugin-unicorn": "^56.0.1",
|
53
56
|
"eslint-plugin-unused-imports": "^4.1.4",
|
54
|
-
"eslint-plugin-vue": "^9.
|
57
|
+
"eslint-plugin-vue": "^9.32.0",
|
55
58
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
56
59
|
"find-up": "^5.0.0",
|
57
|
-
"globals": "^
|
58
|
-
"picocolors": "^1.1.0",
|
60
|
+
"globals": "^16.0.0",
|
59
61
|
"vue-eslint-parser": "^9.4.3",
|
60
62
|
"yargs": "^17.7.2",
|
61
|
-
"@agilebot/eslint-utils": "0.
|
63
|
+
"@agilebot/eslint-utils": "0.8.1"
|
62
64
|
},
|
63
65
|
"devDependencies": {
|
64
66
|
"@types/yargs": "^17.0.33",
|
@@ -66,7 +68,7 @@
|
|
66
68
|
},
|
67
69
|
"peerDependencies": {
|
68
70
|
"eslint": "^8.57.0 || ^9.0.0",
|
69
|
-
"@agilebot/eslint-plugin": "0.
|
71
|
+
"@agilebot/eslint-plugin": "0.8.1"
|
70
72
|
},
|
71
73
|
"files": [
|
72
74
|
"bin",
|