@storm-software/eslint 0.122.8 → 0.122.9

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.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-7NZUDX62.js +99 -0
  3. package/dist/{chunk-Y67QTC5U.js → chunk-K6KBWFPU.js} +1 -1
  4. package/dist/{chunk-LSG5T3ZK.js → chunk-W6QEP5VE.js} +7 -6
  5. package/dist/chunk-X3L37QNE.js +161 -0
  6. package/dist/preset.d.ts +23 -7048
  7. package/dist/preset.js +3590 -933
  8. package/dist/types-Drnq7vws.d.ts +14859 -0
  9. package/dist/utils/banner-plugin.js +3 -3
  10. package/dist/utils/combine.d.ts +14 -0
  11. package/dist/utils/combine.js +13 -0
  12. package/dist/utils/constants.d.ts +33 -22
  13. package/dist/utils/constants.js +65 -19
  14. package/dist/utils/get-file-banner.js +2 -2
  15. package/dist/utils/helpers.d.ts +55 -0
  16. package/dist/utils/helpers.js +19 -0
  17. package/dist/utils/index.d.ts +1 -1
  18. package/dist/utils/index.js +67 -21
  19. package/package.json +76 -50
  20. package/dist/chunk-723HQUNP.js +0 -14
  21. package/dist/chunk-ESFBJFNU.cjs +0 -149
  22. package/dist/chunk-GMT3V67N.cjs +0 -24
  23. package/dist/chunk-HMBBDY5L.cjs +0 -49
  24. package/dist/chunk-JS7W7LMD.cjs +0 -14
  25. package/dist/chunk-KISSHBCD.cjs +0 -1333
  26. package/dist/chunk-LFHG33FO.cjs +0 -313
  27. package/dist/chunk-QSFZU7HX.cjs +0 -47
  28. package/dist/chunk-RTM5LCEB.js +0 -149
  29. package/dist/chunk-USNT2KNT.cjs +0 -6
  30. package/dist/chunk-VIASOXKK.js +0 -1333
  31. package/dist/preset.cjs +0 -988
  32. package/dist/preset.d.cts +0 -7057
  33. package/dist/rules/import.cjs +0 -291
  34. package/dist/rules/import.d.cts +0 -5
  35. package/dist/rules/import.d.ts +0 -5
  36. package/dist/rules/import.js +0 -291
  37. package/dist/rules/jsx-a11y.cjs +0 -341
  38. package/dist/rules/jsx-a11y.d.cts +0 -5
  39. package/dist/rules/jsx-a11y.d.ts +0 -5
  40. package/dist/rules/jsx-a11y.js +0 -341
  41. package/dist/rules/react-hooks.cjs +0 -15
  42. package/dist/rules/react-hooks.d.cts +0 -5
  43. package/dist/rules/react-hooks.d.ts +0 -5
  44. package/dist/rules/react-hooks.js +0 -15
  45. package/dist/rules/react.cjs +0 -689
  46. package/dist/rules/react.d.cts +0 -5
  47. package/dist/rules/react.d.ts +0 -5
  48. package/dist/rules/react.js +0 -689
  49. package/dist/rules/storm.cjs +0 -7
  50. package/dist/rules/storm.d.cts +0 -11
  51. package/dist/rules/storm.d.ts +0 -11
  52. package/dist/rules/storm.js +0 -7
  53. package/dist/rules/ts-docs.cjs +0 -7
  54. package/dist/rules/ts-docs.d.cts +0 -5
  55. package/dist/rules/ts-docs.d.ts +0 -5
  56. package/dist/rules/ts-docs.js +0 -7
  57. package/dist/rules.d.ts +0 -7005
  58. package/dist/utils/banner-plugin.cjs +0 -9
  59. package/dist/utils/banner-plugin.d.cts +0 -6
  60. package/dist/utils/constants.cjs +0 -25
  61. package/dist/utils/constants.d.cts +0 -24
  62. package/dist/utils/create-flat-import-plugin.cjs +0 -20
  63. package/dist/utils/create-flat-import-plugin.d.cts +0 -11
  64. package/dist/utils/create-flat-import-plugin.d.ts +0 -11
  65. package/dist/utils/create-flat-import-plugin.js +0 -20
  66. package/dist/utils/format-config.cjs +0 -7
  67. package/dist/utils/format-config.d.cts +0 -5
  68. package/dist/utils/get-file-banner.cjs +0 -8
  69. package/dist/utils/get-file-banner.d.cts +0 -9
  70. package/dist/utils/ignores.cjs +0 -7
  71. package/dist/utils/ignores.d.cts +0 -3
  72. package/dist/utils/index.cjs +0 -33
  73. package/dist/utils/index.d.cts +0 -4
package/dist/preset.cjs DELETED
@@ -1,988 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkGMT3V67Ncjs = require('./chunk-GMT3V67N.cjs');
4
-
5
-
6
- var _chunkQSFZU7HXcjs = require('./chunk-QSFZU7HX.cjs');
7
-
8
-
9
- var _chunkKISSHBCDcjs = require('./chunk-KISSHBCD.cjs');
10
-
11
-
12
- var _chunkJS7W7LMDcjs = require('./chunk-JS7W7LMD.cjs');
13
-
14
-
15
- var _chunkLFHG33FOcjs = require('./chunk-LFHG33FO.cjs');
16
- require('./chunk-HMBBDY5L.cjs');
17
-
18
-
19
-
20
-
21
- var _chunkESFBJFNUcjs = require('./chunk-ESFBJFNU.cjs');
22
-
23
-
24
- var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
25
-
26
- // src/preset.ts
27
- var _recommended = require('@cspell/eslint-plugin/recommended'); var _recommended2 = _interopRequireDefault(_recommended);
28
- var _js = require('@eslint/js'); var _js2 = _interopRequireDefault(_js);
29
- var _eslintpluginnext = require('@next/eslint-plugin-next'); var _eslintpluginnext2 = _interopRequireDefault(_eslintpluginnext);
30
- var _nxjs = require('@nx/eslint-plugin/nx.js'); var _nxjs2 = _interopRequireDefault(_nxjs);
31
-
32
- // ../config-tools/src/types.ts
33
- var LogLevel = {
34
- SILENT: 0,
35
- FATAL: 10,
36
- ERROR: 20,
37
- WARN: 30,
38
- SUCCESS: 35,
39
- INFO: 40,
40
- DEBUG: 60,
41
- TRACE: 70,
42
- ALL: 100
43
- };
44
- var LogLevelLabel = {
45
- SILENT: "silent",
46
- FATAL: "fatal",
47
- ERROR: "error",
48
- WARN: "warn",
49
- SUCCESS: "success",
50
- INFO: "info",
51
- DEBUG: "debug",
52
- TRACE: "trace",
53
- ALL: "all"
54
- };
55
-
56
- // ../config/src/constants.ts
57
- var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
58
- var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
59
- var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
60
-
61
- // ../config/src/schema.ts
62
- var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);
63
- var DarkColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
64
- var LightColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
65
- var BrandColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
66
- var AlternateColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
67
- var AccentColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
68
- var LinkColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
69
- var HelpColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
70
- var SuccessColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
71
- var InfoColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
72
- var WarningColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
73
- var DangerColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
74
- var FatalColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
75
- var PositiveColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
76
- var NegativeColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
77
- var DarkThemeColorConfigSchema = _zod2.default.object({
78
- foreground: LightColorSchema,
79
- background: DarkColorSchema,
80
- brand: BrandColorSchema,
81
- alternate: AlternateColorSchema,
82
- accent: AccentColorSchema,
83
- link: LinkColorSchema,
84
- help: HelpColorSchema,
85
- success: SuccessColorSchema,
86
- info: InfoColorSchema,
87
- warning: WarningColorSchema,
88
- danger: DangerColorSchema,
89
- fatal: FatalColorSchema,
90
- positive: PositiveColorSchema,
91
- negative: NegativeColorSchema
92
- });
93
- var LightThemeColorConfigSchema = _zod2.default.object({
94
- foreground: DarkColorSchema,
95
- background: LightColorSchema,
96
- brand: BrandColorSchema,
97
- alternate: AlternateColorSchema,
98
- accent: AccentColorSchema,
99
- link: LinkColorSchema,
100
- help: HelpColorSchema,
101
- success: SuccessColorSchema,
102
- info: InfoColorSchema,
103
- warning: WarningColorSchema,
104
- danger: DangerColorSchema,
105
- fatal: FatalColorSchema,
106
- positive: PositiveColorSchema,
107
- negative: NegativeColorSchema
108
- });
109
- var MultiThemeColorConfigSchema = _zod2.default.object({
110
- dark: DarkThemeColorConfigSchema,
111
- light: LightThemeColorConfigSchema
112
- });
113
- var SingleThemeColorConfigSchema = _zod2.default.object({
114
- dark: DarkColorSchema,
115
- light: LightColorSchema,
116
- brand: BrandColorSchema,
117
- alternate: AlternateColorSchema,
118
- accent: AccentColorSchema,
119
- link: LinkColorSchema,
120
- help: HelpColorSchema,
121
- success: SuccessColorSchema,
122
- info: InfoColorSchema,
123
- warning: WarningColorSchema,
124
- danger: DangerColorSchema,
125
- fatal: FatalColorSchema,
126
- positive: PositiveColorSchema,
127
- negative: NegativeColorSchema
128
- });
129
- var RegistryUrlConfigSchema = _zod2.default.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
130
- var RegistryConfigSchema = _zod2.default.object({
131
- github: RegistryUrlConfigSchema,
132
- npm: RegistryUrlConfigSchema,
133
- cargo: RegistryUrlConfigSchema,
134
- cyclone: RegistryUrlConfigSchema,
135
- container: RegistryUrlConfigSchema
136
- }).default({}).describe("A list of remote registry URLs used by Storm Software");
137
- var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
138
- var ColorConfigMapSchema = _zod2.default.union([
139
- _zod2.default.object({
140
- base: ColorConfigSchema
141
- }),
142
- _zod2.default.record(_zod2.default.string(), ColorConfigSchema)
143
- ]);
144
- var ExtendsItemSchema = _zod2.default.string().trim().describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
145
- var ExtendsSchema = ExtendsItemSchema.or(_zod2.default.array(ExtendsItemSchema)).describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
146
- var WorkspaceBotConfigSchema = _zod2.default.object({
147
- name: _zod2.default.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
148
- email: _zod2.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
149
- }).describe("The workspace's bot user's config used to automated various operations tasks");
150
- var WorkspaceDirectoryConfigSchema = _zod2.default.object({
151
- cache: _zod2.default.string().trim().optional().describe("The directory used to store the environment's cached file data"),
152
- data: _zod2.default.string().trim().optional().describe("The directory used to store the environment's data files"),
153
- config: _zod2.default.string().trim().optional().describe("The directory used to store the environment's configuration files"),
154
- temp: _zod2.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
155
- log: _zod2.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
156
- build: _zod2.default.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
157
- }).describe("Various directories used by the workspace to store data, cache, and configuration files");
158
- var StormConfigSchema = _zod2.default.object({
159
- $schema: _zod2.default.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm-workspace.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
160
- extends: ExtendsSchema.optional(),
161
- name: _zod2.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
162
- namespace: _zod2.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
163
- organization: _zod2.default.string().trim().default("storm-software").describe("The organization of the workspace"),
164
- repository: _zod2.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
165
- license: _zod2.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
166
- homepage: _zod2.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
167
- docs: _zod2.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
168
- licensing: _zod2.default.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
169
- branch: _zod2.default.string().trim().default("main").describe("The branch of the workspace"),
170
- preid: _zod2.default.string().optional().describe("A tag specifying the version pre-release identifier"),
171
- owner: _zod2.default.string().trim().default("@storm-software/admin").describe("The owner of the package"),
172
- bot: WorkspaceBotConfigSchema,
173
- mode: _zod2.default.enum([
174
- "development",
175
- "staging",
176
- "production"
177
- ]).default("production").describe("The current runtime environment mode for the package"),
178
- workspaceRoot: _zod2.default.string().trim().default("").describe("The root directory of the workspace"),
179
- externalPackagePatterns: _zod2.default.array(_zod2.default.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
180
- skipCache: _zod2.default.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
181
- directories: WorkspaceDirectoryConfigSchema,
182
- packageManager: _zod2.default.enum([
183
- "npm",
184
- "yarn",
185
- "pnpm",
186
- "bun"
187
- ]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
188
- timezone: _zod2.default.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
189
- locale: _zod2.default.string().trim().default("en-US").describe("The default locale of the workspace"),
190
- logLevel: _zod2.default.enum([
191
- "silent",
192
- "fatal",
193
- "error",
194
- "warn",
195
- "success",
196
- "info",
197
- "debug",
198
- "trace",
199
- "all"
200
- ]).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`)."),
201
- skipConfigLogging: _zod2.default.boolean().optional().describe("Should the logging of the current Storm Workspace configuration be skipped?"),
202
- registry: RegistryConfigSchema,
203
- configFile: _zod2.default.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."),
204
- colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
205
- extensions: _zod2.default.record(_zod2.default.any()).optional().default({}).describe("Configuration of each used extension")
206
- }).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.");
207
-
208
- // ../config-tools/src/utilities/get-default-config.ts
209
- var _fs = require('fs');
210
- var _promises = require('fs/promises');
211
- var _path = require('path');
212
-
213
- // ../config-tools/src/utilities/correct-paths.ts
214
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
215
- function normalizeWindowsPath(input = "") {
216
- if (!input) {
217
- return input;
218
- }
219
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
220
- }
221
- _chunkUSNT2KNTcjs.__name.call(void 0, normalizeWindowsPath, "normalizeWindowsPath");
222
- var _UNC_REGEX = /^[/\\]{2}/;
223
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
224
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
225
- var correctPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(path) {
226
- if (!path || path.length === 0) {
227
- return ".";
228
- }
229
- path = normalizeWindowsPath(path);
230
- const isUNCPath = path.match(_UNC_REGEX);
231
- const isPathAbsolute = isAbsolute(path);
232
- const trailingSeparator = path[path.length - 1] === "/";
233
- path = normalizeString(path, !isPathAbsolute);
234
- if (path.length === 0) {
235
- if (isPathAbsolute) {
236
- return "/";
237
- }
238
- return trailingSeparator ? "./" : ".";
239
- }
240
- if (trailingSeparator) {
241
- path += "/";
242
- }
243
- if (_DRIVE_LETTER_RE.test(path)) {
244
- path += "/";
245
- }
246
- if (isUNCPath) {
247
- if (!isPathAbsolute) {
248
- return `//./${path}`;
249
- }
250
- return `//${path}`;
251
- }
252
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
253
- }, "correctPaths");
254
- var joinPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(...segments) {
255
- let path = "";
256
- for (const seg of segments) {
257
- if (!seg) {
258
- continue;
259
- }
260
- if (path.length > 0) {
261
- const pathTrailing = path[path.length - 1] === "/";
262
- const segLeading = seg[0] === "/";
263
- const both = pathTrailing && segLeading;
264
- if (both) {
265
- path += seg.slice(1);
266
- } else {
267
- path += pathTrailing || segLeading ? seg : `/${seg}`;
268
- }
269
- } else {
270
- path += seg;
271
- }
272
- }
273
- return correctPaths(path);
274
- }, "joinPaths");
275
- function normalizeString(path, allowAboveRoot) {
276
- let res = "";
277
- let lastSegmentLength = 0;
278
- let lastSlash = -1;
279
- let dots = 0;
280
- let char = null;
281
- for (let index = 0; index <= path.length; ++index) {
282
- if (index < path.length) {
283
- char = path[index];
284
- } else if (char === "/") {
285
- break;
286
- } else {
287
- char = "/";
288
- }
289
- if (char === "/") {
290
- if (lastSlash === index - 1 || dots === 1) {
291
- } else if (dots === 2) {
292
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
293
- if (res.length > 2) {
294
- const lastSlashIndex = res.lastIndexOf("/");
295
- if (lastSlashIndex === -1) {
296
- res = "";
297
- lastSegmentLength = 0;
298
- } else {
299
- res = res.slice(0, lastSlashIndex);
300
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
301
- }
302
- lastSlash = index;
303
- dots = 0;
304
- continue;
305
- } else if (res.length > 0) {
306
- res = "";
307
- lastSegmentLength = 0;
308
- lastSlash = index;
309
- dots = 0;
310
- continue;
311
- }
312
- }
313
- if (allowAboveRoot) {
314
- res += res.length > 0 ? "/.." : "..";
315
- lastSegmentLength = 2;
316
- }
317
- } else {
318
- if (res.length > 0) {
319
- res += `/${path.slice(lastSlash + 1, index)}`;
320
- } else {
321
- res = path.slice(lastSlash + 1, index);
322
- }
323
- lastSegmentLength = index - lastSlash - 1;
324
- }
325
- lastSlash = index;
326
- dots = 0;
327
- } else if (char === "." && dots !== -1) {
328
- ++dots;
329
- } else {
330
- dots = -1;
331
- }
332
- }
333
- return res;
334
- }
335
- _chunkUSNT2KNTcjs.__name.call(void 0, normalizeString, "normalizeString");
336
- var isAbsolute = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(p) {
337
- return _IS_ABSOLUTE_RE.test(p);
338
- }, "isAbsolute");
339
-
340
- // ../config-tools/src/utilities/find-up.ts
341
-
342
-
343
- var MAX_PATH_SEARCH_DEPTH = 30;
344
- var depth = 0;
345
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
346
- const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
347
- if (endDirectoryNames.some((endDirName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endDirName)))) {
348
- return _startPath;
349
- }
350
- if (endFileNames.some((endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName)))) {
351
- return _startPath;
352
- }
353
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
354
- const parent = _path.join.call(void 0, _startPath, "..");
355
- return findFolderUp(parent, endFileNames, endDirectoryNames);
356
- }
357
- return void 0;
358
- }
359
- _chunkUSNT2KNTcjs.__name.call(void 0, findFolderUp, "findFolderUp");
360
-
361
- // ../config-tools/src/utilities/find-workspace-root.ts
362
- var rootFiles = [
363
- "storm-workspace.json",
364
- "storm-workspace.json",
365
- "storm-workspace.yaml",
366
- "storm-workspace.yml",
367
- "storm-workspace.js",
368
- "storm-workspace.ts",
369
- ".storm-workspace.json",
370
- ".storm-workspace.yaml",
371
- ".storm-workspace.yml",
372
- ".storm-workspace.js",
373
- ".storm-workspace.ts",
374
- "lerna.json",
375
- "nx.json",
376
- "turbo.json",
377
- "npm-workspace.json",
378
- "yarn-workspace.json",
379
- "pnpm-workspace.json",
380
- "npm-workspace.yaml",
381
- "yarn-workspace.yaml",
382
- "pnpm-workspace.yaml",
383
- "npm-workspace.yml",
384
- "yarn-workspace.yml",
385
- "pnpm-workspace.yml",
386
- "npm-lock.json",
387
- "yarn-lock.json",
388
- "pnpm-lock.json",
389
- "npm-lock.yaml",
390
- "yarn-lock.yaml",
391
- "pnpm-lock.yaml",
392
- "npm-lock.yml",
393
- "yarn-lock.yml",
394
- "pnpm-lock.yml",
395
- "bun.lockb"
396
- ];
397
- var rootDirectories = [
398
- ".storm-workspace",
399
- ".nx",
400
- ".github",
401
- ".vscode",
402
- ".verdaccio"
403
- ];
404
- function findWorkspaceRootSafe(pathInsideMonorepo) {
405
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
406
- return correctPaths(_nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH)));
407
- }
408
- return correctPaths(findFolderUp(_nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())), rootFiles, rootDirectories));
409
- }
410
- _chunkUSNT2KNTcjs.__name.call(void 0, findWorkspaceRootSafe, "findWorkspaceRootSafe");
411
- function findWorkspaceRoot(pathInsideMonorepo) {
412
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
413
- if (!result) {
414
- throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
415
- ${rootFiles.join("\n")}
416
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
417
- }
418
- return result;
419
- }
420
- _chunkUSNT2KNTcjs.__name.call(void 0, findWorkspaceRoot, "findWorkspaceRoot");
421
-
422
- // ../config-tools/src/utilities/get-default-config.ts
423
- var DEFAULT_COLOR_CONFIG = {
424
- light: {
425
- background: "#fafafa",
426
- foreground: "#1d1e22",
427
- brand: "#1fb2a6",
428
- alternate: "#db2777",
429
- help: "#5C4EE5",
430
- success: "#087f5b",
431
- info: "#0550ae",
432
- warning: "#e3b341",
433
- danger: "#D8314A",
434
- positive: "#22c55e",
435
- negative: "#dc2626"
436
- },
437
- dark: {
438
- background: "#1d1e22",
439
- foreground: "#cbd5e1",
440
- brand: "#2dd4bf",
441
- alternate: "#db2777",
442
- help: "#818cf8",
443
- success: "#10b981",
444
- info: "#58a6ff",
445
- warning: "#f3d371",
446
- danger: "#D8314A",
447
- positive: "#22c55e",
448
- negative: "#dc2626"
449
- }
450
- };
451
-
452
- // ../config-tools/src/logger/chalk.ts
453
- var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
454
- var chalkDefault = {
455
- hex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => (message) => message, "hex"),
456
- bgHex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => ({
457
- whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright")
458
- }), "bgHex"),
459
- whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright"),
460
- gray: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "gray"),
461
- bold: {
462
- hex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => (message) => message, "hex"),
463
- bgHex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => ({
464
- whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright")
465
- }), "bgHex"),
466
- whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright")
467
- },
468
- dim: {
469
- hex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => (message) => message, "hex"),
470
- gray: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "gray")
471
- }
472
- };
473
- var getChalk = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
474
- let _chalk = _chalk3.default;
475
- if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright])) {
476
- _chalk = chalkDefault;
477
- }
478
- return _chalk;
479
- }, "getChalk");
480
-
481
- // ../config-tools/src/logger/is-unicode-supported.ts
482
- function isUnicodeSupported() {
483
- if (process.platform !== "win32") {
484
- return process.env.TERM !== "linux";
485
- }
486
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
487
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
488
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
489
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
490
- }
491
- _chunkUSNT2KNTcjs.__name.call(void 0, isUnicodeSupported, "isUnicodeSupported");
492
-
493
- // ../config-tools/src/logger/console-icons.ts
494
- var useIcon = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (c, fallback) => isUnicodeSupported() ? c : fallback, "useIcon");
495
- var CONSOLE_ICONS = {
496
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
497
- [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
498
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
499
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
500
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
501
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
502
- [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
503
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
504
- };
505
-
506
- // ../config-tools/src/logger/format-timestamp.ts
507
- var formatTimestamp = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (date = /* @__PURE__ */ new Date()) => {
508
- return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
509
- }, "formatTimestamp");
510
-
511
- // ../config-tools/src/logger/get-log-level.ts
512
- var getLogLevel = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (label) => {
513
- switch (label) {
514
- case "all":
515
- return LogLevel.ALL;
516
- case "trace":
517
- return LogLevel.TRACE;
518
- case "debug":
519
- return LogLevel.DEBUG;
520
- case "info":
521
- return LogLevel.INFO;
522
- case "warn":
523
- return LogLevel.WARN;
524
- case "error":
525
- return LogLevel.ERROR;
526
- case "fatal":
527
- return LogLevel.FATAL;
528
- case "silent":
529
- return LogLevel.SILENT;
530
- default:
531
- return LogLevel.INFO;
532
- }
533
- }, "getLogLevel");
534
-
535
- // ../config-tools/src/logger/console.ts
536
- var getLogFn = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
537
- const colors = !_optionalChain([config, 'access', _7 => _7.colors, 'optionalAccess', _8 => _8.dark]) && !_optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10["base"]]) && !_optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"], 'optionalAccess', _18 => _18.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _19 => _19.colors, 'optionalAccess', _20 => _20["base"]]) ? _optionalChain([config, 'access', _21 => _21.colors, 'optionalAccess', _22 => _22["base"]]) : DEFAULT_COLOR_CONFIG;
538
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
539
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
540
- return (_) => {
541
- };
542
- }
543
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
544
- return (message) => {
545
- console.error(`
546
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( "#7d1a1a")))(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
547
- `);
548
- };
549
- }
550
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
551
- return (message) => {
552
- console.error(`
553
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( "#f85149")))(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
554
- `);
555
- };
556
- }
557
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
558
- return (message) => {
559
- console.warn(`
560
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( "#e3b341")))(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
561
- `);
562
- };
563
- }
564
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
565
- return (message) => {
566
- console.info(`
567
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( "#56d364")))(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
568
- `);
569
- };
570
- }
571
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
572
- return (message) => {
573
- console.info(`
574
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( "#58a6ff")))(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
575
- `);
576
- };
577
- }
578
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
579
- return (message) => {
580
- console.debug(`
581
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
582
- `);
583
- };
584
- }
585
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
586
- return (message) => {
587
- console.debug(`
588
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
589
- `);
590
- };
591
- }
592
- return (message) => {
593
- console.log(`
594
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
595
- `);
596
- };
597
- }, "getLogFn");
598
- var writeFatal = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
599
- var writeError = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
600
- var writeInfo = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.INFO, config)(message), "writeInfo");
601
- var writeDebug = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
602
- var writeTrace = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
603
- var MAX_DEPTH = 4;
604
- var formatLogMessage = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, options = {}, depth2 = 0) => {
605
- if (depth2 > MAX_DEPTH) {
606
- return "<max depth>";
607
- }
608
- const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
609
- const skip = _nullishCoalesce(options.skip, () => ( []));
610
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
611
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
612
- prefix: `${prefix}-`,
613
- skip
614
- }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
615
- ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
616
- prefix: `${prefix}-`,
617
- skip
618
- }, depth2 + 1) : message[key]}`).join("\n")}` : message;
619
- }, "formatLogMessage");
620
- var _isFunction = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
621
- try {
622
- return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _23 => _23.constructor]) && _optionalChain([value, 'optionalAccess', _24 => _24.call]) && _optionalChain([value, 'optionalAccess', _25 => _25.apply]));
623
- } catch (e) {
624
- return false;
625
- }
626
- }, "_isFunction");
627
-
628
- // src/preset.ts
629
- var _defu = require('defu');
630
- var _eslintpluginjson = require('eslint-plugin-json'); var _eslintpluginjson2 = _interopRequireDefault(_eslintpluginjson);
631
- var _eslintpluginmarkdown = require('eslint-plugin-markdown'); var _eslintpluginmarkdown2 = _interopRequireDefault(_eslintpluginmarkdown);
632
- var _recommended3 = require('eslint-plugin-prettier/recommended'); var _recommended4 = _interopRequireDefault(_recommended3);
633
- var _eslintpluginreact = require('eslint-plugin-react'); var _eslintpluginreact2 = _interopRequireDefault(_eslintpluginreact);
634
- var _eslintpluginreactcompiler = require('eslint-plugin-react-compiler'); var _eslintpluginreactcompiler2 = _interopRequireDefault(_eslintpluginreactcompiler);
635
- var _eslintpluginreacthooks = require('eslint-plugin-react-hooks'); var _eslintpluginreacthooks2 = _interopRequireDefault(_eslintpluginreacthooks);
636
- var _eslintpluginstorybook = require('eslint-plugin-storybook'); var _eslintpluginstorybook2 = _interopRequireDefault(_eslintpluginstorybook);
637
- var _eslintplugintsdoc = require('eslint-plugin-tsdoc'); var _eslintplugintsdoc2 = _interopRequireDefault(_eslintplugintsdoc);
638
- var _eslintpluginunicorn = require('eslint-plugin-unicorn'); var _eslintpluginunicorn2 = _interopRequireDefault(_eslintpluginunicorn);
639
- var _eslintpluginyml = require('eslint-plugin-yml'); var _eslintpluginyml2 = _interopRequireDefault(_eslintpluginyml);
640
- var _globals = require('globals'); var _globals2 = _interopRequireDefault(_globals);
641
- var _typescripteslint = require('typescript-eslint'); var _typescripteslint2 = _interopRequireDefault(_typescripteslint);
642
- function getStormConfig(options = {
643
- rules: {},
644
- ignores: [],
645
- globals: {},
646
- useUnicorn: true,
647
- markdown: {},
648
- react: {},
649
- nx: {},
650
- useReactCompiler: false,
651
- logLevel: "info",
652
- cspellConfigFile: "./.vscode/cspell.json"
653
- }, ...userConfigs) {
654
- const tsconfig = options.tsconfig;
655
- const parserOptions = options.parserOptions;
656
- const typescriptEslintConfigType = options.typescriptEslintConfigType || "eslintRecommended";
657
- const useUnicorn = _nullishCoalesce(options.useUnicorn, () => ( true));
658
- const react = _nullishCoalesce(options.react, () => ( {}));
659
- const nx = _nullishCoalesce(options.nx, () => ( {}));
660
- const useReactCompiler = _nullishCoalesce(options.useReactCompiler, () => ( false));
661
- const logLevel = _nullishCoalesce(options.logLevel, () => ( "info"));
662
- const globals = _nullishCoalesce(options.globals, () => ( {}));
663
- const cspellConfigFile = options.cspellConfigFile || "./.vscode/cspell.json";
664
- try {
665
- const ignoredFiles = [
666
- ..._chunkQSFZU7HXcjs.DEFAULT_IGNORES,
667
- ...options.ignores || []
668
- ].filter(Boolean);
669
- const configs = [
670
- // Prettier
671
- _recommended4.default,
672
- // Import
673
- // https://www.npmjs.com/package/eslint-plugin-import
674
- // { plugins: { import: importEslint } },
675
- // {
676
- // files: [CODE_FILE],
677
- // rules: importRules
678
- // },
679
- // Json
680
- // https://www.npmjs.com/package/eslint-plugin-json
681
- {
682
- files: [
683
- "**/*.json"
684
- ],
685
- ..._eslintpluginjson2.default.configs["recommended"],
686
- rules: {
687
- "json/json": [
688
- "warn",
689
- {
690
- allowComments: true
691
- }
692
- ]
693
- }
694
- },
695
- {
696
- files: [
697
- "**/executors/**/schema.json",
698
- "**/generators/**/schema.json"
699
- ],
700
- rules: nx !== false ? {
701
- "@nx/workspace/valid-schema-description": "error"
702
- } : {}
703
- },
704
- {
705
- files: [
706
- "**/package.json"
707
- ],
708
- rules: nx !== false ? {
709
- "@nx/dependency-checks": [
710
- "error",
711
- {
712
- buildTargets: [
713
- "build-base",
714
- "build"
715
- ],
716
- ignoredDependencies: [
717
- "typescript"
718
- ],
719
- checkMissingDependencies: true,
720
- checkObsoleteDependencies: true,
721
- checkVersionMismatches: false,
722
- includeTransitiveDependencies: true,
723
- useLocalPathsForWorkspaceDependencies: true
724
- }
725
- ]
726
- } : {}
727
- },
728
- // YML
729
- // https://www.npmjs.com/package/eslint-plugin-yml
730
- ..._eslintpluginyml2.default.configs["flat/recommended"],
731
- ..._eslintpluginyml2.default.configs["flat/prettier"],
732
- // CSpell
733
- {
734
- ..._recommended2.default,
735
- rules: {
736
- ..._recommended2.default.rules,
737
- "@cspell/spellchecker": [
738
- "warn",
739
- {
740
- configFile: joinPaths(findWorkspaceRoot(), cspellConfigFile),
741
- autoFix: true
742
- }
743
- ]
744
- }
745
- },
746
- // User overrides
747
- ...userConfigs
748
- ].filter(Boolean);
749
- if (nx) {
750
- configs.push({
751
- plugins: {
752
- "@nx": _nxjs2.default
753
- }
754
- });
755
- }
756
- configs.push(_js2.default.configs.recommended);
757
- if (typescriptEslintConfigType !== "none") {
758
- if (!(typescriptEslintConfigType in _typescripteslint2.default.configs)) {
759
- console.warn("Invalid TypeScript ESLint configuration type:", typescriptEslintConfigType);
760
- } else {
761
- configs.push(...Array.isArray(_typescripteslint2.default.configs[typescriptEslintConfigType]) ? _typescripteslint2.default.configs[typescriptEslintConfigType] : [
762
- _typescripteslint2.default.configs[typescriptEslintConfigType]
763
- ]);
764
- }
765
- }
766
- if (useUnicorn) {
767
- configs.push({
768
- files: [
769
- _chunkESFBJFNUcjs.TS_FILE
770
- ],
771
- plugins: {
772
- unicorn: _eslintpluginunicorn2.default
773
- },
774
- rules: {
775
- ..._eslintpluginunicorn2.default.configs["flat/recommended"].rules
776
- }
777
- });
778
- }
779
- configs.push({
780
- files: [
781
- _chunkESFBJFNUcjs.TS_FILE
782
- ],
783
- plugins: {
784
- tsdoc: _eslintplugintsdoc2.default
785
- },
786
- rules: _chunkJS7W7LMDcjs.ts_docs_default
787
- });
788
- configs.push({
789
- ..._chunkLFHG33FOcjs.banner_plugin_default.configs["recommended"],
790
- name: "banner",
791
- plugins: {
792
- banner: _chunkLFHG33FOcjs.banner_plugin_default
793
- },
794
- files: [
795
- _chunkESFBJFNUcjs.CODE_FILE
796
- ],
797
- rules: {
798
- "banner/banner": [
799
- "error",
800
- {
801
- commentType: "block",
802
- numNewlines: 2,
803
- repositoryName: options.name
804
- }
805
- ]
806
- }
807
- });
808
- if (react) {
809
- const reactConfigs = [
810
- {
811
- ..._optionalChain([_eslintpluginreact2.default, 'access', _26 => _26.configs, 'optionalAccess', _27 => _27.recommended]),
812
- plugins: {
813
- react: _eslintpluginreact2.default
814
- },
815
- files: [
816
- "**/*.tsx"
817
- ],
818
- ...react
819
- },
820
- {
821
- ..._optionalChain([_eslintpluginreacthooks2.default, 'access', _28 => _28.configs, 'optionalAccess', _29 => _29.recommended]),
822
- plugins: {
823
- "react-hooks": _eslintpluginreacthooks2.default
824
- },
825
- files: [
826
- _chunkESFBJFNUcjs.TS_FILE
827
- ]
828
- }
829
- ];
830
- if (useReactCompiler) {
831
- reactConfigs.push({
832
- files: [
833
- "**/*.tsx"
834
- ],
835
- plugins: {
836
- "react-compiler": _eslintpluginreactcompiler2.default
837
- },
838
- rules: {
839
- "react-compiler/react-compiler": "error"
840
- }
841
- });
842
- }
843
- reactConfigs.push(_eslintpluginstorybook2.default.configs["flat/recommended"]);
844
- configs.push(...reactConfigs);
845
- }
846
- if (options.nextFiles && options.nextFiles.length > 0) {
847
- configs.push({
848
- ..._eslintpluginnext2.default.configs["core-web-vitals"],
849
- files: options.nextFiles
850
- });
851
- }
852
- const typescriptConfig = {
853
- files: [
854
- _chunkESFBJFNUcjs.TS_FILE
855
- ],
856
- languageOptions: {
857
- globals: {
858
- ...Object.fromEntries(Object.keys(_globals2.default).flatMap((group) => Object.keys(_globals2.default[group]).map((key) => [
859
- key,
860
- "readonly"
861
- ]))),
862
- ..._globals2.default.browser,
863
- ..._globals2.default.node,
864
- ...globals,
865
- window: "readonly"
866
- },
867
- parserOptions: {
868
- projectService: true,
869
- ecmaFeatures: {
870
- jsx: react !== false
871
- }
872
- }
873
- },
874
- rules: {
875
- ..._chunkKISSHBCDcjs.getStormRulesConfig.call(void 0, {
876
- ...options,
877
- typescriptEslintConfigType,
878
- useUnicorn,
879
- useNx: nx !== false
880
- }),
881
- ...Object.keys(_nullishCoalesce(options.rules, () => ( {}))).filter((ruleId) => !useUnicorn || !ruleId.startsWith("unicorn/") || !react || !ruleId.startsWith("react/") && !ruleId.startsWith("react-hooks/")).reduce((ret, ruleId) => {
882
- ret[ruleId] = options.rules[ruleId];
883
- return ret;
884
- }, {})
885
- }
886
- };
887
- if (parserOptions) {
888
- typescriptConfig.languageOptions ??= {};
889
- typescriptConfig.languageOptions.parserOptions = parserOptions;
890
- }
891
- if (tsconfig) {
892
- typescriptConfig.languageOptions ??= {};
893
- typescriptConfig.languageOptions.parserOptions ??= {};
894
- typescriptConfig.languageOptions.parserOptions.project = tsconfig;
895
- }
896
- configs.push(typescriptConfig);
897
- if (options.markdown) {
898
- configs.push(..._eslintpluginmarkdown2.default.configs.recommended);
899
- configs.push({
900
- files: [
901
- _chunkESFBJFNUcjs.CODE_BLOCK
902
- ],
903
- processor: "markdown/markdown",
904
- rules: {
905
- "unicorn/filename-case": "off",
906
- "no-undef": "off",
907
- "no-unused-expressions": "off",
908
- "padded-blocks": "off",
909
- "no-empty-pattern": "off",
910
- "no-redeclare": "off",
911
- "no-import-assign": "off",
912
- ...options.markdown
913
- }
914
- });
915
- configs.push({
916
- files: [
917
- "**/*.md/*.js",
918
- "**/*.md/*.ts"
919
- ],
920
- rules: {
921
- "unicorn/filename-case": "off",
922
- "no-undef": "off",
923
- "no-unused-expressions": "off",
924
- "padded-blocks": "off",
925
- "no-empty-pattern": "off",
926
- "no-redeclare": "off",
927
- "no-import-assign": "off",
928
- ...options.markdown
929
- }
930
- });
931
- }
932
- writeTrace(formatLogMessage(configs, {
933
- skip: [
934
- "globals"
935
- ]
936
- }), {
937
- logLevel
938
- });
939
- const result = _chunkGMT3V67Ncjs.formatConfig.call(void 0, "Preset", configs.reduce((ret, config) => {
940
- delete config.parserOptions;
941
- const existingIndex = ret.findIndex((existing) => areFilesEqual(existing.files, config.files));
942
- if (existingIndex >= 0) {
943
- ret[existingIndex] = _defu.defu.call(void 0, ret[existingIndex], config);
944
- } else {
945
- ret.push(config);
946
- }
947
- return ret;
948
- }, []));
949
- result.unshift({
950
- ignores: ignoredFiles
951
- });
952
- writeInfo("\u2699\uFE0F Completed generated Storm ESLint configuration objects", {
953
- logLevel
954
- });
955
- writeDebug(formatLogMessage(result, {
956
- skip: [
957
- "globals"
958
- ]
959
- }), {
960
- logLevel
961
- });
962
- return result;
963
- } catch (error) {
964
- writeFatal("Error generating Storm ESLint configuration objects", {
965
- logLevel
966
- });
967
- writeError(error, {
968
- logLevel
969
- });
970
- throw error;
971
- }
972
- }
973
- _chunkUSNT2KNTcjs.__name.call(void 0, getStormConfig, "getStormConfig");
974
- var areFilesEqual = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (files1, files2) => {
975
- if (files1 === files2) {
976
- return true;
977
- } else if (!files1 || !files2) {
978
- return false;
979
- } else if (typeof files1 === "string" && typeof files2 !== "string" || typeof files1 !== "string" && typeof files2 === "string" || Array.isArray(files1) && !Array.isArray(files2) || !Array.isArray(files1) && Array.isArray(files2)) {
980
- return false;
981
- } else if (files1.length !== files2.length) {
982
- return false;
983
- }
984
- return files1.every((file, index) => Array.isArray(file) && Array.isArray(_optionalChain([files2, 'optionalAccess', _30 => _30[index]])) ? areFilesEqual(file, _optionalChain([files2, 'optionalAccess', _31 => _31[index]])) : !Array.isArray(file) && !Array.isArray(_optionalChain([files2, 'optionalAccess', _32 => _32[index]])) ? _optionalChain([file, 'optionalAccess', _33 => _33.toLowerCase, 'call', _34 => _34()]) === _optionalChain([files2, 'optionalAccess', _35 => _35[index], 'optionalAccess', _36 => _36.toLowerCase, 'call', _37 => _37()]) : file === files2);
985
- }, "areFilesEqual");
986
-
987
-
988
- exports.getStormConfig = getStormConfig;