@storm-software/eslint 0.107.1 → 0.107.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/README.md +1 -1
- package/dist/chunk-723HQUNP.js +14 -0
- package/dist/chunk-E7T4SNH3.js +1332 -0
- package/dist/chunk-ESFBJFNU.cjs +149 -0
- package/dist/chunk-FTXILLLE.js +24 -0
- package/dist/chunk-JS7W7LMD.cjs +14 -0
- package/dist/chunk-KND2ZTLT.cjs +49 -0
- package/dist/chunk-LSG5T3ZK.js +313 -0
- package/dist/chunk-NFPQICLG.cjs +1332 -0
- package/dist/chunk-OGGLIE6C.cjs +24 -0
- package/dist/chunk-QDLKHXPX.cjs +11 -0
- package/dist/chunk-RTM5LCEB.js +149 -0
- package/dist/chunk-SHUYVCID.js +6 -0
- package/dist/chunk-TXTXUVRZ.cjs +313 -0
- package/dist/chunk-VJ6CKC4P.js +37 -0
- package/dist/chunk-Y67QTC5U.js +49 -0
- package/dist/chunk-YQQ366F7.cjs +37 -0
- package/dist/preset.cjs +427 -112
- package/dist/preset.d.cts +1 -6
- package/dist/preset.d.ts +1 -6
- package/dist/preset.js +360 -12
- package/dist/rules/import.cjs +292 -0
- package/dist/rules/import.d.cts +5 -0
- package/dist/rules/import.d.ts +5 -0
- package/dist/rules/import.js +292 -0
- package/dist/rules/jsx-a11y.cjs +341 -0
- package/dist/rules/jsx-a11y.d.cts +5 -0
- package/dist/rules/jsx-a11y.d.ts +5 -0
- package/dist/rules/jsx-a11y.js +341 -0
- package/dist/rules/react-hooks.cjs +15 -0
- package/dist/rules/react-hooks.d.cts +5 -0
- package/dist/rules/react-hooks.d.ts +5 -0
- package/dist/rules/react-hooks.js +15 -0
- package/dist/rules/react.cjs +689 -0
- package/dist/rules/react.d.cts +5 -0
- package/dist/rules/react.d.ts +5 -0
- package/dist/rules/react.js +689 -0
- package/dist/rules/storm.cjs +7 -0
- package/dist/rules/storm.d.cts +11 -0
- package/dist/rules/storm.d.ts +11 -0
- package/dist/rules/storm.js +7 -0
- package/dist/rules/ts-docs.cjs +7 -0
- package/dist/rules/ts-docs.d.cts +5 -0
- package/dist/rules/ts-docs.d.ts +5 -0
- package/dist/rules/ts-docs.js +7 -0
- package/dist/utils/banner-plugin.cjs +9 -0
- package/dist/utils/banner-plugin.d.cts +6 -0
- package/dist/utils/banner-plugin.d.ts +6 -0
- package/dist/utils/banner-plugin.js +9 -0
- package/dist/utils/constants.cjs +25 -0
- package/dist/utils/constants.d.cts +24 -0
- package/dist/utils/constants.d.ts +24 -0
- package/dist/utils/constants.js +25 -0
- package/dist/utils/create-flat-import-plugin.cjs +20 -0
- package/dist/utils/create-flat-import-plugin.d.cts +11 -0
- package/dist/utils/create-flat-import-plugin.d.ts +11 -0
- package/dist/utils/create-flat-import-plugin.js +20 -0
- package/dist/utils/format-config.cjs +7 -0
- package/dist/utils/format-config.d.cts +5 -0
- package/dist/utils/format-config.d.ts +5 -0
- package/dist/utils/format-config.js +7 -0
- package/dist/utils/get-file-banner.cjs +8 -0
- package/dist/utils/get-file-banner.d.cts +9 -0
- package/dist/utils/get-file-banner.d.ts +9 -0
- package/dist/utils/get-file-banner.js +8 -0
- package/dist/utils/ignores.cjs +7 -0
- package/dist/utils/ignores.d.cts +3 -0
- package/dist/utils/ignores.d.ts +3 -0
- package/dist/utils/ignores.js +7 -0
- package/dist/utils/index.cjs +33 -0
- package/dist/utils/index.d.cts +4 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +33 -0
- package/package.json +1 -1
package/dist/preset.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
+
import { GetStormRulesConfigOptions } from './rules/storm.cjs';
|
|
2
3
|
|
|
3
4
|
/* eslint-disable */
|
|
4
5
|
/* prettier-ignore */
|
|
@@ -7006,12 +7007,6 @@ type YmlSpacedComment =
|
|
|
7006
7007
|
}
|
|
7007
7008
|
];
|
|
7008
7009
|
|
|
7009
|
-
interface GetStormRulesConfigOptions {
|
|
7010
|
-
typescriptEslintConfigType?: string;
|
|
7011
|
-
useUnicorn?: boolean;
|
|
7012
|
-
useNx?: boolean;
|
|
7013
|
-
}
|
|
7014
|
-
|
|
7015
7010
|
/**
|
|
7016
7011
|
* The module boundary dependency constraints.
|
|
7017
7012
|
*/
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
+
import { GetStormRulesConfigOptions } from './rules/storm.js';
|
|
2
3
|
|
|
3
4
|
/* eslint-disable */
|
|
4
5
|
/* prettier-ignore */
|
|
@@ -7006,12 +7007,6 @@ type YmlSpacedComment =
|
|
|
7006
7007
|
}
|
|
7007
7008
|
];
|
|
7008
7009
|
|
|
7009
|
-
interface GetStormRulesConfigOptions {
|
|
7010
|
-
typescriptEslintConfigType?: string;
|
|
7011
|
-
useUnicorn?: boolean;
|
|
7012
|
-
useNx?: boolean;
|
|
7013
|
-
}
|
|
7014
|
-
|
|
7015
7010
|
/**
|
|
7016
7011
|
* The module boundary dependency constraints.
|
|
7017
7012
|
*/
|
package/dist/preset.js
CHANGED
|
@@ -1,9 +1,363 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
formatConfig
|
|
3
|
+
} from "./chunk-FTXILLLE.js";
|
|
4
|
+
import {
|
|
5
|
+
ignores
|
|
6
|
+
} from "./chunk-VJ6CKC4P.js";
|
|
7
|
+
import {
|
|
8
|
+
getStormRulesConfig
|
|
9
|
+
} from "./chunk-E7T4SNH3.js";
|
|
10
|
+
import {
|
|
11
|
+
ts_docs_default
|
|
12
|
+
} from "./chunk-723HQUNP.js";
|
|
13
|
+
import {
|
|
14
|
+
banner_plugin_default
|
|
15
|
+
} from "./chunk-LSG5T3ZK.js";
|
|
16
|
+
import "./chunk-Y67QTC5U.js";
|
|
17
|
+
import {
|
|
18
|
+
CODE_BLOCK,
|
|
19
|
+
TS_FILE
|
|
20
|
+
} from "./chunk-RTM5LCEB.js";
|
|
21
|
+
import {
|
|
22
|
+
__name
|
|
23
|
+
} from "./chunk-SHUYVCID.js";
|
|
24
|
+
|
|
25
|
+
// src/preset.ts
|
|
3
26
|
import eslint from "@eslint/js";
|
|
4
27
|
import next from "@next/eslint-plugin-next";
|
|
5
28
|
import nxPlugin from "@nx/eslint-plugin/nx.js";
|
|
6
|
-
|
|
29
|
+
|
|
30
|
+
// ../config-tools/src/types.ts
|
|
31
|
+
var LogLevel = {
|
|
32
|
+
SILENT: 0,
|
|
33
|
+
FATAL: 10,
|
|
34
|
+
ERROR: 20,
|
|
35
|
+
WARN: 30,
|
|
36
|
+
SUCCESS: 35,
|
|
37
|
+
INFO: 40,
|
|
38
|
+
DEBUG: 60,
|
|
39
|
+
TRACE: 70,
|
|
40
|
+
ALL: 100
|
|
41
|
+
};
|
|
42
|
+
var LogLevelLabel = {
|
|
43
|
+
SILENT: "silent",
|
|
44
|
+
FATAL: "fatal",
|
|
45
|
+
ERROR: "error",
|
|
46
|
+
WARN: "warn",
|
|
47
|
+
INFO: "info",
|
|
48
|
+
DEBUG: "debug",
|
|
49
|
+
TRACE: "trace",
|
|
50
|
+
ALL: "all"
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// ../config/src/constants.ts
|
|
54
|
+
var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
|
|
55
|
+
var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
|
|
56
|
+
var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
|
|
57
|
+
|
|
58
|
+
// ../config/src/schema.ts
|
|
59
|
+
import z from "zod";
|
|
60
|
+
var DarkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
|
|
61
|
+
var LightColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
|
|
62
|
+
var BrandColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
|
|
63
|
+
var AlternateColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
|
|
64
|
+
var AccentColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
|
|
65
|
+
var LinkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
|
|
66
|
+
var HelpColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
|
|
67
|
+
var SuccessColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
|
|
68
|
+
var InfoColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
|
|
69
|
+
var WarningColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
|
|
70
|
+
var DangerColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
|
|
71
|
+
var FatalColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
|
|
72
|
+
var PositiveColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
|
|
73
|
+
var NegativeColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
|
|
74
|
+
var DarkThemeColorConfigSchema = z.object({
|
|
75
|
+
foreground: LightColorSchema,
|
|
76
|
+
background: DarkColorSchema,
|
|
77
|
+
brand: BrandColorSchema,
|
|
78
|
+
alternate: AlternateColorSchema,
|
|
79
|
+
accent: AccentColorSchema,
|
|
80
|
+
link: LinkColorSchema,
|
|
81
|
+
help: HelpColorSchema,
|
|
82
|
+
success: SuccessColorSchema,
|
|
83
|
+
info: InfoColorSchema,
|
|
84
|
+
warning: WarningColorSchema,
|
|
85
|
+
danger: DangerColorSchema,
|
|
86
|
+
fatal: FatalColorSchema,
|
|
87
|
+
positive: PositiveColorSchema,
|
|
88
|
+
negative: NegativeColorSchema
|
|
89
|
+
});
|
|
90
|
+
var LightThemeColorConfigSchema = z.object({
|
|
91
|
+
foreground: DarkColorSchema,
|
|
92
|
+
background: LightColorSchema,
|
|
93
|
+
brand: BrandColorSchema,
|
|
94
|
+
alternate: AlternateColorSchema,
|
|
95
|
+
accent: AccentColorSchema,
|
|
96
|
+
link: LinkColorSchema,
|
|
97
|
+
help: HelpColorSchema,
|
|
98
|
+
success: SuccessColorSchema,
|
|
99
|
+
info: InfoColorSchema,
|
|
100
|
+
warning: WarningColorSchema,
|
|
101
|
+
danger: DangerColorSchema,
|
|
102
|
+
fatal: FatalColorSchema,
|
|
103
|
+
positive: PositiveColorSchema,
|
|
104
|
+
negative: NegativeColorSchema
|
|
105
|
+
});
|
|
106
|
+
var MultiThemeColorConfigSchema = z.object({
|
|
107
|
+
dark: DarkThemeColorConfigSchema,
|
|
108
|
+
light: LightThemeColorConfigSchema
|
|
109
|
+
});
|
|
110
|
+
var SingleThemeColorConfigSchema = z.object({
|
|
111
|
+
dark: DarkColorSchema,
|
|
112
|
+
light: LightColorSchema,
|
|
113
|
+
brand: BrandColorSchema,
|
|
114
|
+
alternate: AlternateColorSchema,
|
|
115
|
+
accent: AccentColorSchema,
|
|
116
|
+
link: LinkColorSchema,
|
|
117
|
+
help: HelpColorSchema,
|
|
118
|
+
success: SuccessColorSchema,
|
|
119
|
+
info: InfoColorSchema,
|
|
120
|
+
warning: WarningColorSchema,
|
|
121
|
+
danger: DangerColorSchema,
|
|
122
|
+
fatal: FatalColorSchema,
|
|
123
|
+
positive: PositiveColorSchema,
|
|
124
|
+
negative: NegativeColorSchema
|
|
125
|
+
});
|
|
126
|
+
var RegistryUrlConfigSchema = z.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
|
|
127
|
+
var RegistryConfigSchema = z.object({
|
|
128
|
+
github: RegistryUrlConfigSchema,
|
|
129
|
+
npm: RegistryUrlConfigSchema,
|
|
130
|
+
cargo: RegistryUrlConfigSchema,
|
|
131
|
+
cyclone: RegistryUrlConfigSchema,
|
|
132
|
+
container: RegistryUrlConfigSchema
|
|
133
|
+
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
134
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
|
|
135
|
+
var ColorConfigMapSchema = z.union([
|
|
136
|
+
z.object({
|
|
137
|
+
"base": ColorConfigSchema
|
|
138
|
+
}),
|
|
139
|
+
z.record(z.string(), ColorConfigSchema)
|
|
140
|
+
]);
|
|
141
|
+
var WorkspaceBotConfigSchema = z.object({
|
|
142
|
+
name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
|
|
143
|
+
email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
144
|
+
}).describe("The workspace's bot user's config used to automated various operations tasks");
|
|
145
|
+
var WorkspaceDirectoryConfigSchema = z.object({
|
|
146
|
+
cache: z.string().trim().optional().describe("The directory used to store the environment's cached file data"),
|
|
147
|
+
data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
148
|
+
config: z.string().trim().optional().describe("The directory used to store the environment's configuration files"),
|
|
149
|
+
temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
150
|
+
log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
151
|
+
build: z.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
|
|
152
|
+
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
153
|
+
var StormConfigSchema = z.object({
|
|
154
|
+
$schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
155
|
+
extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
|
|
156
|
+
name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
157
|
+
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
158
|
+
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
159
|
+
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
160
|
+
license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
161
|
+
homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
|
|
162
|
+
docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
|
|
163
|
+
licensing: z.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
|
|
164
|
+
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
165
|
+
preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
|
|
166
|
+
owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
|
|
167
|
+
bot: WorkspaceBotConfigSchema,
|
|
168
|
+
env: z.enum([
|
|
169
|
+
"development",
|
|
170
|
+
"staging",
|
|
171
|
+
"production"
|
|
172
|
+
]).default("production").describe("The current runtime environment name for the package"),
|
|
173
|
+
workspaceRoot: z.string().trim().default("").describe("The root directory of the workspace"),
|
|
174
|
+
externalPackagePatterns: z.array(z.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
|
|
175
|
+
skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
176
|
+
directories: WorkspaceDirectoryConfigSchema,
|
|
177
|
+
packageManager: z.enum([
|
|
178
|
+
"npm",
|
|
179
|
+
"yarn",
|
|
180
|
+
"pnpm",
|
|
181
|
+
"bun"
|
|
182
|
+
]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
|
|
183
|
+
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
184
|
+
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
185
|
+
logLevel: z.enum([
|
|
186
|
+
"silent",
|
|
187
|
+
"fatal",
|
|
188
|
+
"error",
|
|
189
|
+
"warn",
|
|
190
|
+
"info",
|
|
191
|
+
"debug",
|
|
192
|
+
"trace",
|
|
193
|
+
"all"
|
|
194
|
+
]).default("info").describe("The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."),
|
|
195
|
+
registry: RegistryConfigSchema,
|
|
196
|
+
configFile: z.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
|
|
197
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
|
|
198
|
+
extensions: z.record(z.any()).optional().default({}).describe("Configuration of each used extension")
|
|
199
|
+
}).describe("Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo.");
|
|
200
|
+
|
|
201
|
+
// ../config-tools/src/utilities/get-default-config.ts
|
|
202
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
203
|
+
import { join } from "node:path";
|
|
204
|
+
var DEFAULT_COLOR_CONFIG = {
|
|
205
|
+
"light": {
|
|
206
|
+
"background": "#fafafa",
|
|
207
|
+
"foreground": "#1d1e22",
|
|
208
|
+
"brand": "#1fb2a6",
|
|
209
|
+
"alternate": "#db2777",
|
|
210
|
+
"help": "#5C4EE5",
|
|
211
|
+
"success": "#087f5b",
|
|
212
|
+
"info": "#0550ae",
|
|
213
|
+
"warning": "#e3b341",
|
|
214
|
+
"danger": "#D8314A",
|
|
215
|
+
"positive": "#22c55e",
|
|
216
|
+
"negative": "#dc2626"
|
|
217
|
+
},
|
|
218
|
+
"dark": {
|
|
219
|
+
"background": "#1d1e22",
|
|
220
|
+
"foreground": "#cbd5e1",
|
|
221
|
+
"brand": "#2dd4bf",
|
|
222
|
+
"alternate": "#db2777",
|
|
223
|
+
"help": "#818cf8",
|
|
224
|
+
"success": "#10b981",
|
|
225
|
+
"info": "#58a6ff",
|
|
226
|
+
"warning": "#f3d371",
|
|
227
|
+
"danger": "#D8314A",
|
|
228
|
+
"positive": "#22c55e",
|
|
229
|
+
"negative": "#dc2626"
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// ../config-tools/src/logger/chalk.ts
|
|
234
|
+
import chalk from "chalk";
|
|
235
|
+
var chalkDefault = {
|
|
236
|
+
hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
|
|
237
|
+
bgHex: /* @__PURE__ */ __name((_) => ({
|
|
238
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
|
|
239
|
+
}), "bgHex"),
|
|
240
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright"),
|
|
241
|
+
bold: {
|
|
242
|
+
hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
|
|
243
|
+
bgHex: /* @__PURE__ */ __name((_) => ({
|
|
244
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
|
|
245
|
+
}), "bgHex"),
|
|
246
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var getChalk = /* @__PURE__ */ __name(() => {
|
|
250
|
+
let _chalk = chalk;
|
|
251
|
+
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
252
|
+
_chalk = chalkDefault;
|
|
253
|
+
}
|
|
254
|
+
return _chalk;
|
|
255
|
+
}, "getChalk");
|
|
256
|
+
|
|
257
|
+
// ../config-tools/src/logger/get-log-level.ts
|
|
258
|
+
var getLogLevel = /* @__PURE__ */ __name((label) => {
|
|
259
|
+
switch (label) {
|
|
260
|
+
case "all":
|
|
261
|
+
return LogLevel.ALL;
|
|
262
|
+
case "trace":
|
|
263
|
+
return LogLevel.TRACE;
|
|
264
|
+
case "debug":
|
|
265
|
+
return LogLevel.DEBUG;
|
|
266
|
+
case "info":
|
|
267
|
+
return LogLevel.INFO;
|
|
268
|
+
case "warn":
|
|
269
|
+
return LogLevel.WARN;
|
|
270
|
+
case "error":
|
|
271
|
+
return LogLevel.ERROR;
|
|
272
|
+
case "fatal":
|
|
273
|
+
return LogLevel.FATAL;
|
|
274
|
+
case "silent":
|
|
275
|
+
return LogLevel.SILENT;
|
|
276
|
+
default:
|
|
277
|
+
return LogLevel.INFO;
|
|
278
|
+
}
|
|
279
|
+
}, "getLogLevel");
|
|
280
|
+
|
|
281
|
+
// ../config-tools/src/logger/console.ts
|
|
282
|
+
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
|
|
283
|
+
const _chalk = getChalk();
|
|
284
|
+
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
285
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
286
|
+
if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
|
|
287
|
+
return (_) => {
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
|
|
291
|
+
return (message) => {
|
|
292
|
+
console.error(`${_chalk.bold.hex(colors.fatal ?? "#7d1a1a")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#7d1a1a").whiteBright(" \u{1F480} Fatal ")} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(formatLogMessage(message))}
|
|
293
|
+
`);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
|
|
297
|
+
return (message) => {
|
|
298
|
+
console.error(`${_chalk.bold.hex(colors.danger ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.danger ?? "#f85149").whiteBright(" \u2718 Error ")} ${_chalk.hex(colors.danger ?? "#f85149")(formatLogMessage(message))}
|
|
299
|
+
`);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
|
|
303
|
+
return (message) => {
|
|
304
|
+
console.warn(`${_chalk.bold.hex(colors.warning ?? "#e3b341")(">")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(" \u26A0 Warn ")} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
|
|
305
|
+
`);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
|
|
309
|
+
return (message) => {
|
|
310
|
+
console.info(`${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(" \u2713 Success ")} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
|
|
311
|
+
`);
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
315
|
+
return (message) => {
|
|
316
|
+
console.info(`${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(" \u2139 Info ")} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
|
|
317
|
+
`);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
|
|
321
|
+
return (message) => {
|
|
322
|
+
console.debug(`${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.brand ?? "#1fb2a6").whiteBright(" \u{1F6E0} Debug ")} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
|
|
323
|
+
`);
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
return (message) => {
|
|
327
|
+
console.log(`${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.brand ?? "#1fb2a6").whiteBright(" \u2709 System ")} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
|
|
328
|
+
`);
|
|
329
|
+
};
|
|
330
|
+
}, "getLogFn");
|
|
331
|
+
var writeFatal = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
|
|
332
|
+
var writeError = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
|
|
333
|
+
var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.INFO, config)(message), "writeInfo");
|
|
334
|
+
var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
|
|
335
|
+
var MAX_DEPTH = 4;
|
|
336
|
+
var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth = 0) => {
|
|
337
|
+
if (depth > MAX_DEPTH) {
|
|
338
|
+
return "<max depth>";
|
|
339
|
+
}
|
|
340
|
+
const prefix = options.prefix ?? "-";
|
|
341
|
+
const skip = options.skip ?? [];
|
|
342
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
343
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
344
|
+
prefix: `${prefix}-`,
|
|
345
|
+
skip
|
|
346
|
+
}, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
347
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
|
|
348
|
+
prefix: `${prefix}-`,
|
|
349
|
+
skip
|
|
350
|
+
}, depth + 1) : message[key]}`).join("\n")}` : message;
|
|
351
|
+
}, "formatLogMessage");
|
|
352
|
+
var _isFunction = /* @__PURE__ */ __name((value) => {
|
|
353
|
+
try {
|
|
354
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
355
|
+
} catch (e) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
}, "_isFunction");
|
|
359
|
+
|
|
360
|
+
// src/preset.ts
|
|
7
361
|
import { defu } from "defu";
|
|
8
362
|
import json from "eslint-plugin-json";
|
|
9
363
|
import markdown from "eslint-plugin-markdown";
|
|
@@ -16,12 +370,6 @@ import unicorn from "eslint-plugin-unicorn";
|
|
|
16
370
|
import yml from "eslint-plugin-yml";
|
|
17
371
|
import globalsObj from "globals";
|
|
18
372
|
import tsEslint from "typescript-eslint";
|
|
19
|
-
import { getStormRulesConfig } from "./rules/storm";
|
|
20
|
-
import tsdocRules from "./rules/ts-docs";
|
|
21
|
-
import banner from "./utils/banner-plugin";
|
|
22
|
-
import { CODE_BLOCK, TS_FILE } from "./utils/constants";
|
|
23
|
-
import { formatConfig } from "./utils/format-config";
|
|
24
|
-
import { ignores } from "./utils/ignores";
|
|
25
373
|
function getStormConfig(options = {
|
|
26
374
|
rules: {},
|
|
27
375
|
ignores: [],
|
|
@@ -162,13 +510,13 @@ function getStormConfig(options = {
|
|
|
162
510
|
plugins: {
|
|
163
511
|
tsdoc
|
|
164
512
|
},
|
|
165
|
-
rules:
|
|
513
|
+
rules: ts_docs_default
|
|
166
514
|
});
|
|
167
515
|
configs.push({
|
|
168
516
|
// ...banner.configs!["recommended"],
|
|
169
517
|
name: "banner",
|
|
170
518
|
plugins: {
|
|
171
|
-
banner
|
|
519
|
+
banner: banner_plugin_default
|
|
172
520
|
},
|
|
173
521
|
files: [
|
|
174
522
|
TS_FILE
|
|
@@ -358,7 +706,7 @@ function getStormConfig(options = {
|
|
|
358
706
|
}
|
|
359
707
|
}
|
|
360
708
|
__name(getStormConfig, "getStormConfig");
|
|
361
|
-
|
|
709
|
+
var areFilesEqual = /* @__PURE__ */ __name((files1, files2) => {
|
|
362
710
|
if (files1 === files2) {
|
|
363
711
|
return true;
|
|
364
712
|
} else if (!files1 || !files2) {
|