@agilebot/eslint-config 0.8.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -9
- package/README.md +52 -52
- package/bin/eslint-agilebot +1 -1
- package/dist/cli.js +16 -22
- package/dist/{constants-BCEutGd8.mjs → constants-D6y7pnqv.js} +0 -9
- package/dist/index.d.ts +4 -18
- package/dist/index.js +155 -182
- package/package.json +6 -7
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -92
- package/dist/constants-D74t6AHL.js +0 -150
- package/dist/index.d.mts +0 -125
- package/dist/index.mjs +0 -1169
package/dist/cli.mjs
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.8.9
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
9
|
-
|
10
|
-
import { CLI_NAME } from "./constants-BCEutGd8.mjs";
|
11
|
-
import { createRequire } from "node:module";
|
12
|
-
import yargs from "yargs";
|
13
|
-
import { hideBin } from "yargs/helpers";
|
14
|
-
import ansis from "ansis";
|
15
|
-
import { isCI } from "@agilebot/eslint-utils";
|
16
|
-
import path from "node:path";
|
17
|
-
|
18
|
-
//#region rolldown:runtime
|
19
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
20
|
-
|
21
|
-
//#endregion
|
22
|
-
//#region src/cli/stages/eslint.ts
|
23
|
-
function patch() {
|
24
|
-
if (console?.error) {
|
25
|
-
const origConsoleError = console.error;
|
26
|
-
console.error = (...args) => {
|
27
|
-
if (args?.[0]?.includes("React version not specified")) return;
|
28
|
-
origConsoleError(...args);
|
29
|
-
};
|
30
|
-
}
|
31
|
-
}
|
32
|
-
function runBinary() {
|
33
|
-
const pkg = __require.resolve("eslint/package.json");
|
34
|
-
const bin = path.join(pkg, "..", "bin", "eslint.js");
|
35
|
-
__require(bin);
|
36
|
-
}
|
37
|
-
|
38
|
-
//#endregion
|
39
|
-
//#region src/cli/index.ts
|
40
|
-
function cli() {
|
41
|
-
patch();
|
42
|
-
const argv = yargs(hideBin(process.argv)).scriptName(CLI_NAME).usage(`${CLI_NAME} [options] file.js [file.js] [dir]`).options({
|
43
|
-
config: {
|
44
|
-
alias: "c",
|
45
|
-
type: "string",
|
46
|
-
description: "Use this configuration instead of eslint.config.js, eslint.config.mjs, or eslint.config.cjs"
|
47
|
-
},
|
48
|
-
fix: {
|
49
|
-
type: "boolean",
|
50
|
-
description: "Automatically fix problems",
|
51
|
-
default: true
|
52
|
-
},
|
53
|
-
"check-intl": {
|
54
|
-
type: "boolean",
|
55
|
-
description: "Check for unused intl IDs",
|
56
|
-
default: false
|
57
|
-
},
|
58
|
-
progress: {
|
59
|
-
type: "boolean",
|
60
|
-
description: "Show progress bar",
|
61
|
-
default: false
|
62
|
-
},
|
63
|
-
"show-warnings-in-ci": {
|
64
|
-
type: "boolean",
|
65
|
-
description: "Show warnings in CI environment",
|
66
|
-
default: false
|
67
|
-
}
|
68
|
-
}).alias("h", "help").alias("v", "version").parseSync();
|
69
|
-
process.argv = process.argv.slice(0, 2);
|
70
|
-
if (argv._.length === 0) {
|
71
|
-
console.error(ansis.red("Error: 'patterns' must be a non-empty string or an array of non-empty strings"));
|
72
|
-
process.exit(1);
|
73
|
-
}
|
74
|
-
argv._.forEach((pattern) => {
|
75
|
-
process.argv.push(String(pattern));
|
76
|
-
});
|
77
|
-
if (argv.fix) process.argv.splice(2, 0, "--fix");
|
78
|
-
if (argv.config) process.argv.splice(2, 0, "--config", argv.config);
|
79
|
-
if (argv.progress && !isCI()) process.argv.splice(2, 0, "--plugin", "file-progress", "--rule", "file-progress/activate: 1");
|
80
|
-
if (!argv.showWarningsInCi && isCI()) {
|
81
|
-
console.warn(ansis.yellow(`Warning: ${CLI_NAME} will report errors only in CI environment`));
|
82
|
-
process.argv.splice(2, 0, "--quiet");
|
83
|
-
}
|
84
|
-
if (argv.checkIntl) process.argv.splice(2, 0, "--rule", "@agilebot/intl-id-unused: 1");
|
85
|
-
runBinary();
|
86
|
-
}
|
87
|
-
|
88
|
-
//#endregion
|
89
|
-
//#region src/cli.ts
|
90
|
-
cli();
|
91
|
-
|
92
|
-
//#endregion
|
@@ -1,150 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.8.9
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
9
|
-
|
10
|
-
//#region rolldown:runtime
|
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 __copyProps = (to, from, except, desc) => {
|
18
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
19
|
-
key = keys[i];
|
20
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
21
|
-
get: ((k) => from[k]).bind(null, key),
|
22
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
23
|
-
});
|
24
|
-
}
|
25
|
-
return to;
|
26
|
-
};
|
27
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
28
|
-
value: mod,
|
29
|
-
enumerable: true
|
30
|
-
}) : target, mod));
|
31
|
-
|
32
|
-
//#endregion
|
33
|
-
|
34
|
-
//#region src/constants.ts
|
35
|
-
const JS_EXTS = [
|
36
|
-
".js",
|
37
|
-
".jsx",
|
38
|
-
".cjs",
|
39
|
-
".cjsx",
|
40
|
-
".mjs",
|
41
|
-
".mjsx"
|
42
|
-
];
|
43
|
-
const TS_EXTS = [
|
44
|
-
".ts",
|
45
|
-
".tsx",
|
46
|
-
".cts",
|
47
|
-
".ctsx",
|
48
|
-
".mts",
|
49
|
-
".mtsx"
|
50
|
-
];
|
51
|
-
const DTS_EXTS = [
|
52
|
-
".d.ts",
|
53
|
-
".d.cts",
|
54
|
-
".d.mts"
|
55
|
-
];
|
56
|
-
const VUE_EXTS = [".vue"];
|
57
|
-
const DEFAULT_EXTS = [
|
58
|
-
...JS_EXTS,
|
59
|
-
...TS_EXTS,
|
60
|
-
...VUE_EXTS
|
61
|
-
];
|
62
|
-
const JS_GLOBS = JS_EXTS.map((ext) => `**/*${ext}`);
|
63
|
-
const TS_GLOBS = TS_EXTS.map((ext) => `**/*${ext}`);
|
64
|
-
const DTS_GLOBS = DTS_EXTS.map((ext) => `**/*${ext}`);
|
65
|
-
const VUE_GLOBS = VUE_EXTS.map((ext) => `**/*${ext}`);
|
66
|
-
const DEFAULT_GLOBS = DEFAULT_EXTS.map((ext) => `**/*${ext}`);
|
67
|
-
const IGNORE_GLOBS = [
|
68
|
-
"**/node_modules",
|
69
|
-
"**/dist",
|
70
|
-
"**/package-lock.json",
|
71
|
-
"**/yarn.lock",
|
72
|
-
"**/pnpm-lock.yaml",
|
73
|
-
"**/bun.lockb",
|
74
|
-
"**/output",
|
75
|
-
"**/coverage",
|
76
|
-
"**/temp",
|
77
|
-
"**/.temp",
|
78
|
-
"**/tmp",
|
79
|
-
"**/.tmp",
|
80
|
-
"**/.history",
|
81
|
-
"**/.vitepress/cache",
|
82
|
-
"**/.nuxt",
|
83
|
-
"**/.next",
|
84
|
-
"**/.svelte-kit",
|
85
|
-
"**/.vercel",
|
86
|
-
"**/.changeset",
|
87
|
-
"**/.idea",
|
88
|
-
"**/.cache",
|
89
|
-
"**/.output",
|
90
|
-
"**/.vite-inspect",
|
91
|
-
"**/.yarn",
|
92
|
-
"**/vite.config.*.timestamp-*",
|
93
|
-
"**/CHANGELOG*.md",
|
94
|
-
"**/*.min.*",
|
95
|
-
"**/LICENSE*",
|
96
|
-
"**/__snapshots__",
|
97
|
-
"**/auto-import?(s).d.ts",
|
98
|
-
"**/components.d.ts"
|
99
|
-
];
|
100
|
-
const CLI_NAME = "eslint-agilebot";
|
101
|
-
|
102
|
-
//#endregion
|
103
|
-
Object.defineProperty(exports, 'CLI_NAME', {
|
104
|
-
enumerable: true,
|
105
|
-
get: function () {
|
106
|
-
return CLI_NAME;
|
107
|
-
}
|
108
|
-
});
|
109
|
-
Object.defineProperty(exports, 'DEFAULT_GLOBS', {
|
110
|
-
enumerable: true,
|
111
|
-
get: function () {
|
112
|
-
return DEFAULT_GLOBS;
|
113
|
-
}
|
114
|
-
});
|
115
|
-
Object.defineProperty(exports, 'DTS_GLOBS', {
|
116
|
-
enumerable: true,
|
117
|
-
get: function () {
|
118
|
-
return DTS_GLOBS;
|
119
|
-
}
|
120
|
-
});
|
121
|
-
Object.defineProperty(exports, 'IGNORE_GLOBS', {
|
122
|
-
enumerable: true,
|
123
|
-
get: function () {
|
124
|
-
return IGNORE_GLOBS;
|
125
|
-
}
|
126
|
-
});
|
127
|
-
Object.defineProperty(exports, 'JS_GLOBS', {
|
128
|
-
enumerable: true,
|
129
|
-
get: function () {
|
130
|
-
return JS_GLOBS;
|
131
|
-
}
|
132
|
-
});
|
133
|
-
Object.defineProperty(exports, 'TS_GLOBS', {
|
134
|
-
enumerable: true,
|
135
|
-
get: function () {
|
136
|
-
return TS_GLOBS;
|
137
|
-
}
|
138
|
-
});
|
139
|
-
Object.defineProperty(exports, 'VUE_GLOBS', {
|
140
|
-
enumerable: true,
|
141
|
-
get: function () {
|
142
|
-
return VUE_GLOBS;
|
143
|
-
}
|
144
|
-
});
|
145
|
-
Object.defineProperty(exports, '__toESM', {
|
146
|
-
enumerable: true,
|
147
|
-
get: function () {
|
148
|
-
return __toESM;
|
149
|
-
}
|
150
|
-
});
|
package/dist/index.d.mts
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-config v0.8.9
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
9
|
-
|
10
|
-
import { Options } from "@cspell/eslint-plugin";
|
11
|
-
import { Linter } from "eslint";
|
12
|
-
import { Options as Options$1 } from "prettier";
|
13
|
-
|
14
|
-
//#region src/types.d.ts
|
15
|
-
interface FlatConfigItem extends Linter.Config {
|
16
|
-
name: string;
|
17
|
-
files: (string | string[])[];
|
18
|
-
plugins?: Record<string, any>;
|
19
|
-
}
|
20
|
-
//#endregion
|
21
|
-
//#region src/configs/cspell.d.ts
|
22
|
-
type Options$2 = Options['cspell'];
|
23
|
-
//#endregion
|
24
|
-
//#region src/configs/imports.d.ts
|
25
|
-
interface ImportsOptions {
|
26
|
-
/**
|
27
|
-
* 额外的devDependencies
|
28
|
-
* @default undefined
|
29
|
-
*/
|
30
|
-
devDependencies?: string[];
|
31
|
-
/**
|
32
|
-
* monorepo前缀
|
33
|
-
* @default undefined
|
34
|
-
*/
|
35
|
-
monorepoScope?: string;
|
36
|
-
/**
|
37
|
-
* 核心模块
|
38
|
-
* @default undefiend
|
39
|
-
*/
|
40
|
-
coreModules?: string[];
|
41
|
-
/**
|
42
|
-
* 是否允许相对路径
|
43
|
-
* @default false
|
44
|
-
*/
|
45
|
-
allowRelativePaths?: boolean;
|
46
|
-
/**
|
47
|
-
* 是否允许幽灵依赖
|
48
|
-
* @default false
|
49
|
-
*/
|
50
|
-
allowExtraneousDependencies?: boolean;
|
51
|
-
}
|
52
|
-
/**
|
53
|
-
* eslint-plugin-import 规则
|
54
|
-
* @param packageDir 子包路径
|
55
|
-
* @param opts 参数
|
56
|
-
*/
|
57
|
-
//#endregion
|
58
|
-
//#region src/factory/options.d.ts
|
59
|
-
interface FactoryOptions {
|
60
|
-
/**
|
61
|
-
* Custom ESLint configuration to override or extend defaults
|
62
|
-
* @default undefined
|
63
|
-
*/
|
64
|
-
config?: Omit<FlatConfigItem, 'name' | 'files'>;
|
65
|
-
/**
|
66
|
-
* List of files to ignore
|
67
|
-
* @default undefined
|
68
|
-
*/
|
69
|
-
ignores?: string[];
|
70
|
-
/**
|
71
|
-
* Enable React-specific linting rules
|
72
|
-
* @default false
|
73
|
-
*/
|
74
|
-
react?: boolean | string;
|
75
|
-
/**
|
76
|
-
* Specify the Vue.js version for linting
|
77
|
-
* @default false
|
78
|
-
*/
|
79
|
-
vue?: number;
|
80
|
-
/**
|
81
|
-
* Enable TSS linting rules
|
82
|
-
* @default false
|
83
|
-
*/
|
84
|
-
tss?: boolean;
|
85
|
-
/**
|
86
|
-
* Enable ES module linting rules
|
87
|
-
* @default false
|
88
|
-
*/
|
89
|
-
module?: boolean;
|
90
|
-
/**
|
91
|
-
* Enable GoDaddy-specific linting configurations
|
92
|
-
* @default false
|
93
|
-
*/
|
94
|
-
godaddy?: boolean | 'typescript';
|
95
|
-
/**
|
96
|
-
* Enable or disable JSDoc linting rules
|
97
|
-
* @default true
|
98
|
-
*/
|
99
|
-
jsdoc?: boolean;
|
100
|
-
/**
|
101
|
-
* Enable Prettier for code formatting
|
102
|
-
* @default true
|
103
|
-
*/
|
104
|
-
prettier?: boolean | Options$1;
|
105
|
-
/**
|
106
|
-
* Enable Lodash-specific linting rules
|
107
|
-
* @default true
|
108
|
-
*/
|
109
|
-
lodash?: boolean;
|
110
|
-
/**
|
111
|
-
* Custom spelling configurations for CSpell
|
112
|
-
* @default {}
|
113
|
-
*/
|
114
|
-
cspell?: Options$2 | false;
|
115
|
-
/**
|
116
|
-
* Enable or disable import linting rules
|
117
|
-
* @default true
|
118
|
-
*/
|
119
|
-
import?: ImportsOptions | boolean;
|
120
|
-
}
|
121
|
-
//#endregion
|
122
|
-
//#region src/factory/index.d.ts
|
123
|
-
declare function factory(root: string | ImportMeta, options?: FactoryOptions): FlatConfigItem[];
|
124
|
-
//#endregion
|
125
|
-
export { factory as agilebot };
|