@storm-software/eslint 0.170.156 → 0.170.158

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 (55) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.mts +43 -0
  3. package/dist/index.mjs +44 -0
  4. package/dist/plugins.d.mts +15 -0
  5. package/dist/plugins.mjs +16 -0
  6. package/dist/preset.d.mts +32 -0
  7. package/dist/preset.mjs +213 -0
  8. package/dist/{types.d.cts → typegen.d.mts} +8538 -11156
  9. package/dist/types.d.mts +735 -0
  10. package/dist/types.mjs +5 -0
  11. package/dist/utils/correct-paths.mjs +136 -0
  12. package/dist/utils/find-workspace-root.mjs +83 -0
  13. package/dist/utils/helpers.mjs +75 -0
  14. package/dist/utils/package-manager.mjs +20 -0
  15. package/dist/utils/tsconfig.mjs +48 -0
  16. package/package.json +58 -79
  17. package/dist/index.cjs +0 -24
  18. package/dist/index.d.cts +0 -127
  19. package/dist/index.d.ts +0 -127
  20. package/dist/index.js +0 -7
  21. package/dist/preset.cjs +0 -354
  22. package/dist/preset.d.cts +0 -34
  23. package/dist/preset.d.ts +0 -34
  24. package/dist/preset.js +0 -344
  25. package/dist/types.cjs +0 -12
  26. package/dist/types.d.ts +0 -19537
  27. package/dist/types.js +0 -1
  28. package/dist/utils/combine.cjs +0 -8
  29. package/dist/utils/combine.d.cts +0 -14
  30. package/dist/utils/combine.d.ts +0 -14
  31. package/dist/utils/combine.js +0 -6
  32. package/dist/utils/correct-paths.cjs +0 -231
  33. package/dist/utils/correct-paths.d.cts +0 -30
  34. package/dist/utils/correct-paths.d.ts +0 -30
  35. package/dist/utils/correct-paths.js +0 -216
  36. package/dist/utils/find-workspace-root.cjs +0 -96
  37. package/dist/utils/find-workspace-root.d.cts +0 -16
  38. package/dist/utils/find-workspace-root.d.ts +0 -16
  39. package/dist/utils/find-workspace-root.js +0 -93
  40. package/dist/utils/format-config.cjs +0 -19
  41. package/dist/utils/format-config.d.cts +0 -5
  42. package/dist/utils/format-config.d.ts +0 -5
  43. package/dist/utils/format-config.js +0 -17
  44. package/dist/utils/helpers.cjs +0 -86
  45. package/dist/utils/helpers.d.cts +0 -55
  46. package/dist/utils/helpers.d.ts +0 -55
  47. package/dist/utils/helpers.js +0 -72
  48. package/dist/utils/package-manager.cjs +0 -18
  49. package/dist/utils/package-manager.d.cts +0 -8
  50. package/dist/utils/package-manager.d.ts +0 -8
  51. package/dist/utils/package-manager.js +0 -16
  52. package/dist/utils/tsconfig.cjs +0 -43
  53. package/dist/utils/tsconfig.d.cts +0 -25
  54. package/dist/utils/tsconfig.d.ts +0 -25
  55. package/dist/utils/tsconfig.js +0 -40
package/dist/preset.js DELETED
@@ -1,344 +0,0 @@
1
- import { FlatConfigComposer } from 'eslint-flat-config-utils';
2
- import { isPackageExists } from 'local-pkg';
3
- import { ignores, javascript, node, imports, nx, perfectionist, secrets, typescript, banner, prettier, cspell, unicorn, jsdoc, tsdoc, jsx, zod, stylistic, regexp, test, graphql, react, reactNative, next, storybook, unocss, astro, pnpm, jsonc, sortTsconfig, sortPackageJson, yaml, toml, markdown, mdx, formatters, disables } from './configs';
4
- import { isInEditorEnv, interopDefault } from './utils/helpers';
5
- import { getTsConfigPath } from './utils/tsconfig';
6
- import { detectPackageManager } from './utils/package-manager';
7
- import { bun } from './configs/bun';
8
-
9
- const flatConfigProps = [
10
- "name",
11
- "languageOptions",
12
- "linterOptions",
13
- "processor",
14
- "plugins",
15
- "rules",
16
- "settings"
17
- ];
18
- const defaultPluginRenaming = {
19
- "@eslint-react": "react",
20
- "@eslint-react/dom": "react-dom",
21
- "@eslint-react/hooks-extra": "react-hooks-extra",
22
- "@eslint-react/naming-convention": "react-naming-convention",
23
- "@stylistic": "style",
24
- "@typescript-eslint": "ts",
25
- "import-x": "import",
26
- n: "node",
27
- vitest: "test",
28
- yml: "yaml"
29
- };
30
- function resolveSubOptions(options, key) {
31
- return typeof options[key] === "boolean" ? {} : options[key] || {};
32
- }
33
- function getOverrides(options, key) {
34
- const sub = resolveSubOptions(options, key);
35
- return "overrides" in sub ? sub.overrides : {};
36
- }
37
- function preset(options, ...userConfigs) {
38
- const {
39
- name,
40
- globals = {},
41
- banner: enableBanner = true,
42
- astro: enableAstro = false,
43
- autoRenamePlugins = true,
44
- componentExts = [],
45
- gitignore: enableGitignore = true,
46
- jsx: enableJsx = true,
47
- mdx: enableMdx = false,
48
- cspell: enableCSpell = true,
49
- react: enableReact = false,
50
- "react-native": enableReactNative = false,
51
- regexp: enableRegexp = true,
52
- next: enableNext = false,
53
- graphql: enableGraphQL = false,
54
- storybook: enableStorybook = false,
55
- typescript: enableTypeScript = isPackageExists("typescript"),
56
- unicorn: enableUnicorn = true,
57
- jsdoc: enableJSDoc = false,
58
- tsdoc: enableTSDoc = true,
59
- test: enableTest = true,
60
- unocss: enableUnoCSS = false,
61
- zod: enableZod = false,
62
- bun: enableBun,
63
- pnpm: enablePnpm
64
- } = options;
65
- const packageManager = detectPackageManager();
66
- let isInEditor = options.isInEditor;
67
- if (!isInEditor) {
68
- isInEditor = isInEditorEnv();
69
- if (isInEditor) {
70
- console.log(
71
- "[@storm-software/eslint] Detected running in editor, some rules are disabled."
72
- );
73
- }
74
- }
75
- const stylisticOptions = !options.stylistic ? false : typeof options.stylistic === "object" ? options.stylistic : {};
76
- if (stylisticOptions && !("jsx" in stylisticOptions)) {
77
- stylisticOptions.jsx = enableJsx;
78
- }
79
- const configs = [];
80
- if (enableGitignore) {
81
- if (typeof enableGitignore !== "boolean") {
82
- configs.push(
83
- interopDefault(import('eslint-config-flat-gitignore')).then((r) => [
84
- r({
85
- name: "storm/gitignore",
86
- ...enableGitignore
87
- })
88
- ])
89
- );
90
- } else {
91
- configs.push(
92
- interopDefault(import('eslint-config-flat-gitignore')).then((r) => [
93
- r({
94
- name: "storm/gitignore",
95
- strict: false
96
- })
97
- ])
98
- );
99
- }
100
- }
101
- configs.push(
102
- ignores(options.ignores),
103
- javascript({
104
- globals,
105
- isInEditor,
106
- overrides: getOverrides(options, "javascript")
107
- }),
108
- node(),
109
- imports({
110
- stylistic: stylisticOptions
111
- }),
112
- nx(resolveSubOptions(options, "nx")),
113
- perfectionist(),
114
- secrets({ json: options.jsonc !== false })
115
- );
116
- let typescriptOptions = {};
117
- if (enableTypeScript) {
118
- typescriptOptions = resolveSubOptions(options, "typescript");
119
- if (typescriptOptions.tsconfigPath !== false) {
120
- typescriptOptions.tsconfigPath = getTsConfigPath(
121
- typescriptOptions.tsconfigPath,
122
- options.type
123
- );
124
- }
125
- }
126
- if (enableTypeScript) {
127
- configs.push(
128
- typescript({
129
- ...typescriptOptions,
130
- tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
131
- componentExts,
132
- overrides: getOverrides(options, "typescript"),
133
- type: options.type
134
- })
135
- );
136
- }
137
- if (enableBanner) {
138
- configs.push(
139
- banner({
140
- ...resolveSubOptions(options, "banner"),
141
- name,
142
- overrides: getOverrides(options, "banner")
143
- })
144
- );
145
- }
146
- if (!stylisticOptions) {
147
- configs.push(prettier());
148
- }
149
- if (enableCSpell) {
150
- configs.push(cspell(resolveSubOptions(options, "cspell")));
151
- }
152
- if (enableUnicorn) {
153
- configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
154
- }
155
- if (enableJSDoc) {
156
- configs.push(
157
- jsdoc({
158
- ...resolveSubOptions(options, "jsdoc"),
159
- overrides: getOverrides(options, "jsdoc")
160
- })
161
- );
162
- }
163
- if (enableTSDoc) {
164
- configs.push(
165
- tsdoc({
166
- ...resolveSubOptions(options, "tsdoc"),
167
- overrides: getOverrides(options, "tsdoc")
168
- })
169
- );
170
- }
171
- if (enableJsx) {
172
- configs.push(jsx());
173
- }
174
- if (enableZod) {
175
- configs.push(
176
- zod({
177
- overrides: getOverrides(options, "zod")
178
- })
179
- );
180
- }
181
- if (stylisticOptions) {
182
- configs.push(
183
- stylistic({
184
- ...stylisticOptions,
185
- lineEndings: stylisticOptions.lineEndings ?? "unix",
186
- lessOpinionated: options.lessOpinionated,
187
- overrides: getOverrides(options, "stylistic")
188
- })
189
- );
190
- }
191
- if (enableRegexp) {
192
- configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
193
- }
194
- if (enableTest) {
195
- configs.push(
196
- test({
197
- isInEditor,
198
- overrides: getOverrides(options, "test")
199
- })
200
- );
201
- }
202
- if (enableGraphQL) {
203
- configs.push(graphql(resolveSubOptions(options, "graphql")));
204
- }
205
- if (enableReact) {
206
- configs.push(
207
- react({
208
- ...typescriptOptions,
209
- tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
210
- ...typeof enableReact === "boolean" ? { strict: false } : enableReact,
211
- overrides: getOverrides(options, "react")
212
- })
213
- );
214
- }
215
- if (enableReactNative) {
216
- configs.push(
217
- reactNative({
218
- ...resolveSubOptions(options, "react-native"),
219
- overrides: getOverrides(options, "react-native")
220
- })
221
- );
222
- }
223
- if (enableNext) {
224
- configs.push(next(resolveSubOptions(options, "next")));
225
- }
226
- if (enableStorybook) {
227
- configs.push(storybook(resolveSubOptions(options, "storybook")));
228
- }
229
- if (enableUnoCSS) {
230
- configs.push(
231
- unocss({
232
- ...resolveSubOptions(options, "unocss"),
233
- overrides: getOverrides(options, "unocss")
234
- })
235
- );
236
- }
237
- if (enableAstro) {
238
- configs.push(
239
- astro({
240
- overrides: getOverrides(options, "astro"),
241
- stylistic: stylisticOptions
242
- })
243
- );
244
- }
245
- if (enablePnpm ?? packageManager !== "bun") {
246
- configs.push(
247
- pnpm({
248
- overrides: getOverrides(options, "pnpm"),
249
- ignore: typeof enablePnpm !== "boolean" ? enablePnpm?.ignore : void 0
250
- })
251
- );
252
- }
253
- if (enableBun ?? packageManager === "bun") {
254
- configs.push(bun({
255
- overrides: getOverrides(options, "bun"),
256
- ignore: typeof enableBun !== "boolean" ? enableBun?.ignore : void 0
257
- }));
258
- }
259
- if (options.jsonc ?? true) {
260
- configs.push(
261
- jsonc({
262
- overrides: getOverrides(options, "jsonc"),
263
- stylistic: stylisticOptions
264
- }),
265
- sortTsconfig()
266
- );
267
- if (stylisticOptions) {
268
- configs.push(sortPackageJson());
269
- }
270
- }
271
- if (options.yaml ?? true) {
272
- configs.push(
273
- yaml({
274
- overrides: getOverrides(options, "yaml"),
275
- stylistic: stylisticOptions
276
- })
277
- );
278
- }
279
- if (options.toml ?? true) {
280
- configs.push(
281
- toml({
282
- overrides: getOverrides(options, "toml"),
283
- stylistic: stylisticOptions
284
- })
285
- );
286
- }
287
- if (options.markdown === true) {
288
- configs.push(
289
- markdown({
290
- componentExts,
291
- overrides: getOverrides(options, "markdown")
292
- })
293
- );
294
- }
295
- if (enableMdx) {
296
- configs.push(
297
- mdx({
298
- overrides: getOverrides(options, "mdx")
299
- })
300
- );
301
- }
302
- if (options.formatters) {
303
- configs.push(
304
- formatters(
305
- options.formatters,
306
- typeof stylisticOptions === "boolean" ? {} : stylisticOptions
307
- )
308
- );
309
- }
310
- configs.push(disables());
311
- if ("files" in options) {
312
- throw new Error(
313
- '[@storm-software/eslint] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.'
314
- );
315
- }
316
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
317
- if (key in options) {
318
- acc[key] = options[key];
319
- }
320
- return acc;
321
- }, {});
322
- if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
323
- let composer = new FlatConfigComposer();
324
- composer = composer.append(
325
- ...configs,
326
- ...userConfigs
327
- );
328
- if (autoRenamePlugins) {
329
- composer = composer.renamePlugins(defaultPluginRenaming);
330
- }
331
- if (isInEditor) {
332
- composer = composer.disableRulesFix(["test/no-only-tests"], {
333
- builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then(
334
- (r) => r.builtinRules
335
- )
336
- });
337
- }
338
- return composer;
339
- }
340
- const getConfig = preset;
341
- const defineConfig = preset;
342
- var preset_default = preset;
343
-
344
- export { preset_default as default, defaultPluginRenaming, defineConfig, getConfig, getOverrides, preset, resolveSubOptions };
package/dist/types.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var typegen_d = require('./typegen.d');
4
-
5
-
6
-
7
- Object.keys(typegen_d).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return typegen_d[k]; }
11
- });
12
- });