@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/index.d.cts DELETED
@@ -1,127 +0,0 @@
1
- import { defineConfig } from './preset.cjs';
2
- export { ResolvedOptions, defaultPluginRenaming, getConfig, getOverrides, default as preset, resolveSubOptions } from './preset.cjs';
3
- import { OptionsOverrides, OptionsStylistic, OptionsFiles, TypedFlatConfigItem, OptionsBanner, OptionsIsInEditor, OptionsPnpm, OptionsCSpell, OptionsFormatters, StylisticConfig, OptionsGraphQL, OptionsJavascript, OptionsJSDoc, OptionsComponentExts, OptionsNext, OptionsNx, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsTSDoc, OptionsProjectType, OptionsUnicorn, OptionsUnoCSS } from './types.cjs';
4
- export { Awaitable, ConfigNames, ESLintGlobalsPropValue, OptionsBun, OptionsConfig, OptionsHasTypeScript, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsTypescript, PresetConfig, PresetResult, RuleOptions, Rules, UserConfig } from './types.cjs';
5
- import 'eslint';
6
- import '@storm-software/eslint-plugin-banner/rules/banner';
7
- import '@stylistic/eslint-plugin';
8
- import '@typescript-eslint/parser';
9
- import 'eslint-config-flat-gitignore';
10
- import 'eslint-flat-config-utils';
11
-
12
- declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
13
-
14
- declare function banner(options?: Partial<OptionsBanner> & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
15
-
16
- declare function bun(options?: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
17
-
18
- /**
19
- * Config for CSpell spell checking
20
- */
21
- declare function cspell(options?: OptionsCSpell): Promise<TypedFlatConfigItem[]>;
22
-
23
- declare function disables(): Promise<TypedFlatConfigItem[]>;
24
-
25
- declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
26
-
27
- declare function graphql(options?: OptionsGraphQL): Promise<TypedFlatConfigItem[]>;
28
-
29
- declare function ignores(userIgnores?: string[]): Promise<TypedFlatConfigItem[]>;
30
-
31
- declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
32
-
33
- declare function javascript(options?: Partial<OptionsJavascript> & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
34
-
35
- declare function jsdoc(options?: OptionsJSDoc): Promise<TypedFlatConfigItem[]>;
36
-
37
- declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
38
-
39
- declare function jsx(): Promise<TypedFlatConfigItem[]>;
40
-
41
- declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
42
-
43
- declare function mdx(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
44
-
45
- /**
46
- * Config for Next.js projects.
47
- */
48
- declare function next(options?: OptionsNext): Promise<TypedFlatConfigItem[]>;
49
-
50
- declare function node(): Promise<TypedFlatConfigItem[]>;
51
-
52
- /**
53
- * Config for Nx monorepos
54
- */
55
- declare function nx(options?: OptionsNx): Promise<TypedFlatConfigItem[]>;
56
-
57
- /**
58
- * Perfectionist plugin for props and items sorting.
59
- *
60
- * @see https://github.com/azat-io/eslint-plugin-perfectionist
61
- */
62
- declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
63
-
64
- declare function pnpm(options?: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
65
-
66
- /**
67
- * Config for Prettier eslint integration
68
- */
69
- declare function prettier(): Promise<TypedFlatConfigItem[]>;
70
-
71
- declare function react(options?: OptionsComponentExts & Omit<OptionsTypeScriptParserOptions, "tsconfigPath"> & OptionsTypeScriptWithTypes & OptionsReact & OptionsFiles): Promise<TypedFlatConfigItem[]>;
72
-
73
- /**
74
- * Config for React Native projects.
75
- */
76
- declare function reactNative(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
77
-
78
- declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
79
-
80
- /**
81
- * Config for No-Secrets ESLint plugin
82
- */
83
- declare function secrets(options: {
84
- json: boolean;
85
- }): Promise<TypedFlatConfigItem[]>;
86
-
87
- /**
88
- * Sort package.json
89
- *
90
- * Requires `jsonc` config
91
- */
92
- declare function sortPackageJson(): Promise<TypedFlatConfigItem[]>;
93
- /**
94
- * Sort tsconfig.json
95
- *
96
- * Requires `jsonc` config
97
- */
98
- declare function sortTsconfig(): TypedFlatConfigItem[];
99
-
100
- declare function storybook(options?: OptionsStorybook): Promise<TypedFlatConfigItem[]>;
101
-
102
- declare const StylisticConfigDefaults: StylisticConfig;
103
- interface StylisticOptions extends StylisticConfig, OptionsOverrides {
104
- lessOpinionated?: boolean;
105
- }
106
- declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
107
-
108
- declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
109
-
110
- declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
111
-
112
- declare function tsdoc(options?: OptionsFiles & OptionsTSDoc): Promise<TypedFlatConfigItem[]>;
113
-
114
- declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & Omit<OptionsTypeScriptParserOptions, "tsconfigPath"> & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
115
-
116
- declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
117
-
118
- declare function unocss(options?: OptionsUnoCSS): Promise<TypedFlatConfigItem[]>;
119
-
120
- declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
121
-
122
- /**
123
- * Config for Import-Zod ESLint plugin
124
- */
125
- declare function zod(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
126
-
127
- export { OptionsBanner, OptionsCSpell, OptionsComponentExts, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsUnicorn, OptionsUnoCSS, StylisticConfig, StylisticConfigDefaults, type StylisticOptions, TypedFlatConfigItem, astro, banner, bun, cspell, defineConfig as default, defineConfig, disables, formatters, graphql, ignores, imports, javascript, jsdoc, jsonc, jsx, markdown, mdx, next, node, nx, perfectionist, pnpm, prettier, react, reactNative, regexp, secrets, sortPackageJson, sortTsconfig, storybook, stylistic, test, toml, tsdoc, typescript, unicorn, unocss, yaml, zod };
package/dist/index.d.ts DELETED
@@ -1,127 +0,0 @@
1
- import { defineConfig } from './preset.js';
2
- export { ResolvedOptions, defaultPluginRenaming, getConfig, getOverrides, default as preset, resolveSubOptions } from './preset.js';
3
- import { OptionsOverrides, OptionsStylistic, OptionsFiles, TypedFlatConfigItem, OptionsBanner, OptionsIsInEditor, OptionsPnpm, OptionsCSpell, OptionsFormatters, StylisticConfig, OptionsGraphQL, OptionsJavascript, OptionsJSDoc, OptionsComponentExts, OptionsNext, OptionsNx, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsTSDoc, OptionsProjectType, OptionsUnicorn, OptionsUnoCSS } from './types.js';
4
- export { Awaitable, ConfigNames, ESLintGlobalsPropValue, OptionsBun, OptionsConfig, OptionsHasTypeScript, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsTypescript, PresetConfig, PresetResult, RuleOptions, Rules, UserConfig } from './types.js';
5
- import 'eslint';
6
- import '@storm-software/eslint-plugin-banner/rules/banner';
7
- import '@stylistic/eslint-plugin';
8
- import '@typescript-eslint/parser';
9
- import 'eslint-config-flat-gitignore';
10
- import 'eslint-flat-config-utils';
11
-
12
- declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
13
-
14
- declare function banner(options?: Partial<OptionsBanner> & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
15
-
16
- declare function bun(options?: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
17
-
18
- /**
19
- * Config for CSpell spell checking
20
- */
21
- declare function cspell(options?: OptionsCSpell): Promise<TypedFlatConfigItem[]>;
22
-
23
- declare function disables(): Promise<TypedFlatConfigItem[]>;
24
-
25
- declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
26
-
27
- declare function graphql(options?: OptionsGraphQL): Promise<TypedFlatConfigItem[]>;
28
-
29
- declare function ignores(userIgnores?: string[]): Promise<TypedFlatConfigItem[]>;
30
-
31
- declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
32
-
33
- declare function javascript(options?: Partial<OptionsJavascript> & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
34
-
35
- declare function jsdoc(options?: OptionsJSDoc): Promise<TypedFlatConfigItem[]>;
36
-
37
- declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
38
-
39
- declare function jsx(): Promise<TypedFlatConfigItem[]>;
40
-
41
- declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
42
-
43
- declare function mdx(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
44
-
45
- /**
46
- * Config for Next.js projects.
47
- */
48
- declare function next(options?: OptionsNext): Promise<TypedFlatConfigItem[]>;
49
-
50
- declare function node(): Promise<TypedFlatConfigItem[]>;
51
-
52
- /**
53
- * Config for Nx monorepos
54
- */
55
- declare function nx(options?: OptionsNx): Promise<TypedFlatConfigItem[]>;
56
-
57
- /**
58
- * Perfectionist plugin for props and items sorting.
59
- *
60
- * @see https://github.com/azat-io/eslint-plugin-perfectionist
61
- */
62
- declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
63
-
64
- declare function pnpm(options?: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
65
-
66
- /**
67
- * Config for Prettier eslint integration
68
- */
69
- declare function prettier(): Promise<TypedFlatConfigItem[]>;
70
-
71
- declare function react(options?: OptionsComponentExts & Omit<OptionsTypeScriptParserOptions, "tsconfigPath"> & OptionsTypeScriptWithTypes & OptionsReact & OptionsFiles): Promise<TypedFlatConfigItem[]>;
72
-
73
- /**
74
- * Config for React Native projects.
75
- */
76
- declare function reactNative(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
77
-
78
- declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
79
-
80
- /**
81
- * Config for No-Secrets ESLint plugin
82
- */
83
- declare function secrets(options: {
84
- json: boolean;
85
- }): Promise<TypedFlatConfigItem[]>;
86
-
87
- /**
88
- * Sort package.json
89
- *
90
- * Requires `jsonc` config
91
- */
92
- declare function sortPackageJson(): Promise<TypedFlatConfigItem[]>;
93
- /**
94
- * Sort tsconfig.json
95
- *
96
- * Requires `jsonc` config
97
- */
98
- declare function sortTsconfig(): TypedFlatConfigItem[];
99
-
100
- declare function storybook(options?: OptionsStorybook): Promise<TypedFlatConfigItem[]>;
101
-
102
- declare const StylisticConfigDefaults: StylisticConfig;
103
- interface StylisticOptions extends StylisticConfig, OptionsOverrides {
104
- lessOpinionated?: boolean;
105
- }
106
- declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
107
-
108
- declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
109
-
110
- declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
111
-
112
- declare function tsdoc(options?: OptionsFiles & OptionsTSDoc): Promise<TypedFlatConfigItem[]>;
113
-
114
- declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & Omit<OptionsTypeScriptParserOptions, "tsconfigPath"> & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
115
-
116
- declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
117
-
118
- declare function unocss(options?: OptionsUnoCSS): Promise<TypedFlatConfigItem[]>;
119
-
120
- declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
121
-
122
- /**
123
- * Config for Import-Zod ESLint plugin
124
- */
125
- declare function zod(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
126
-
127
- export { OptionsBanner, OptionsCSpell, OptionsComponentExts, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsUnicorn, OptionsUnoCSS, StylisticConfig, StylisticConfigDefaults, type StylisticOptions, TypedFlatConfigItem, astro, banner, bun, cspell, defineConfig as default, defineConfig, disables, formatters, graphql, ignores, imports, javascript, jsdoc, jsonc, jsx, markdown, mdx, next, node, nx, perfectionist, pnpm, prettier, react, reactNative, regexp, secrets, sortPackageJson, sortTsconfig, storybook, stylistic, test, toml, tsdoc, typescript, unicorn, unocss, yaml, zod };
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- import { defineConfig } from './preset';
2
- export * from './preset';
3
- export * from './configs';
4
-
5
- var index_default = defineConfig;
6
-
7
- export { index_default as default };
package/dist/preset.cjs DELETED
@@ -1,354 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var eslintFlatConfigUtils = require('eslint-flat-config-utils');
6
- var localPkg = require('local-pkg');
7
- var configs = require('./configs');
8
- var helpers = require('./utils/helpers');
9
- var tsconfig = require('./utils/tsconfig');
10
- var packageManager = require('./utils/package-manager');
11
- var bun = require('./configs/bun');
12
-
13
- const flatConfigProps = [
14
- "name",
15
- "languageOptions",
16
- "linterOptions",
17
- "processor",
18
- "plugins",
19
- "rules",
20
- "settings"
21
- ];
22
- const defaultPluginRenaming = {
23
- "@eslint-react": "react",
24
- "@eslint-react/dom": "react-dom",
25
- "@eslint-react/hooks-extra": "react-hooks-extra",
26
- "@eslint-react/naming-convention": "react-naming-convention",
27
- "@stylistic": "style",
28
- "@typescript-eslint": "ts",
29
- "import-x": "import",
30
- n: "node",
31
- vitest: "test",
32
- yml: "yaml"
33
- };
34
- function resolveSubOptions(options, key) {
35
- return typeof options[key] === "boolean" ? {} : options[key] || {};
36
- }
37
- function getOverrides(options, key) {
38
- const sub = resolveSubOptions(options, key);
39
- return "overrides" in sub ? sub.overrides : {};
40
- }
41
- function preset(options, ...userConfigs) {
42
- const {
43
- name,
44
- globals = {},
45
- banner: enableBanner = true,
46
- astro: enableAstro = false,
47
- autoRenamePlugins = true,
48
- componentExts = [],
49
- gitignore: enableGitignore = true,
50
- jsx: enableJsx = true,
51
- mdx: enableMdx = false,
52
- cspell: enableCSpell = true,
53
- react: enableReact = false,
54
- "react-native": enableReactNative = false,
55
- regexp: enableRegexp = true,
56
- next: enableNext = false,
57
- graphql: enableGraphQL = false,
58
- storybook: enableStorybook = false,
59
- typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
60
- unicorn: enableUnicorn = true,
61
- jsdoc: enableJSDoc = false,
62
- tsdoc: enableTSDoc = true,
63
- test: enableTest = true,
64
- unocss: enableUnoCSS = false,
65
- zod: enableZod = false,
66
- bun: enableBun,
67
- pnpm: enablePnpm
68
- } = options;
69
- const packageManager$1 = packageManager.detectPackageManager();
70
- let isInEditor = options.isInEditor;
71
- if (!isInEditor) {
72
- isInEditor = helpers.isInEditorEnv();
73
- if (isInEditor) {
74
- console.log(
75
- "[@storm-software/eslint] Detected running in editor, some rules are disabled."
76
- );
77
- }
78
- }
79
- const stylisticOptions = !options.stylistic ? false : typeof options.stylistic === "object" ? options.stylistic : {};
80
- if (stylisticOptions && !("jsx" in stylisticOptions)) {
81
- stylisticOptions.jsx = enableJsx;
82
- }
83
- const configs$1 = [];
84
- if (enableGitignore) {
85
- if (typeof enableGitignore !== "boolean") {
86
- configs$1.push(
87
- helpers.interopDefault(import('eslint-config-flat-gitignore')).then((r) => [
88
- r({
89
- name: "storm/gitignore",
90
- ...enableGitignore
91
- })
92
- ])
93
- );
94
- } else {
95
- configs$1.push(
96
- helpers.interopDefault(import('eslint-config-flat-gitignore')).then((r) => [
97
- r({
98
- name: "storm/gitignore",
99
- strict: false
100
- })
101
- ])
102
- );
103
- }
104
- }
105
- configs$1.push(
106
- configs.ignores(options.ignores),
107
- configs.javascript({
108
- globals,
109
- isInEditor,
110
- overrides: getOverrides(options, "javascript")
111
- }),
112
- configs.node(),
113
- configs.imports({
114
- stylistic: stylisticOptions
115
- }),
116
- configs.nx(resolveSubOptions(options, "nx")),
117
- configs.perfectionist(),
118
- configs.secrets({ json: options.jsonc !== false })
119
- );
120
- let typescriptOptions = {};
121
- if (enableTypeScript) {
122
- typescriptOptions = resolveSubOptions(options, "typescript");
123
- if (typescriptOptions.tsconfigPath !== false) {
124
- typescriptOptions.tsconfigPath = tsconfig.getTsConfigPath(
125
- typescriptOptions.tsconfigPath,
126
- options.type
127
- );
128
- }
129
- }
130
- if (enableTypeScript) {
131
- configs$1.push(
132
- configs.typescript({
133
- ...typescriptOptions,
134
- tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
135
- componentExts,
136
- overrides: getOverrides(options, "typescript"),
137
- type: options.type
138
- })
139
- );
140
- }
141
- if (enableBanner) {
142
- configs$1.push(
143
- configs.banner({
144
- ...resolveSubOptions(options, "banner"),
145
- name,
146
- overrides: getOverrides(options, "banner")
147
- })
148
- );
149
- }
150
- if (!stylisticOptions) {
151
- configs$1.push(configs.prettier());
152
- }
153
- if (enableCSpell) {
154
- configs$1.push(configs.cspell(resolveSubOptions(options, "cspell")));
155
- }
156
- if (enableUnicorn) {
157
- configs$1.push(configs.unicorn(enableUnicorn === true ? {} : enableUnicorn));
158
- }
159
- if (enableJSDoc) {
160
- configs$1.push(
161
- configs.jsdoc({
162
- ...resolveSubOptions(options, "jsdoc"),
163
- overrides: getOverrides(options, "jsdoc")
164
- })
165
- );
166
- }
167
- if (enableTSDoc) {
168
- configs$1.push(
169
- configs.tsdoc({
170
- ...resolveSubOptions(options, "tsdoc"),
171
- overrides: getOverrides(options, "tsdoc")
172
- })
173
- );
174
- }
175
- if (enableJsx) {
176
- configs$1.push(configs.jsx());
177
- }
178
- if (enableZod) {
179
- configs$1.push(
180
- configs.zod({
181
- overrides: getOverrides(options, "zod")
182
- })
183
- );
184
- }
185
- if (stylisticOptions) {
186
- configs$1.push(
187
- configs.stylistic({
188
- ...stylisticOptions,
189
- lineEndings: stylisticOptions.lineEndings ?? "unix",
190
- lessOpinionated: options.lessOpinionated,
191
- overrides: getOverrides(options, "stylistic")
192
- })
193
- );
194
- }
195
- if (enableRegexp) {
196
- configs$1.push(configs.regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
197
- }
198
- if (enableTest) {
199
- configs$1.push(
200
- configs.test({
201
- isInEditor,
202
- overrides: getOverrides(options, "test")
203
- })
204
- );
205
- }
206
- if (enableGraphQL) {
207
- configs$1.push(configs.graphql(resolveSubOptions(options, "graphql")));
208
- }
209
- if (enableReact) {
210
- configs$1.push(
211
- configs.react({
212
- ...typescriptOptions,
213
- tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
214
- ...typeof enableReact === "boolean" ? { strict: false } : enableReact,
215
- overrides: getOverrides(options, "react")
216
- })
217
- );
218
- }
219
- if (enableReactNative) {
220
- configs$1.push(
221
- configs.reactNative({
222
- ...resolveSubOptions(options, "react-native"),
223
- overrides: getOverrides(options, "react-native")
224
- })
225
- );
226
- }
227
- if (enableNext) {
228
- configs$1.push(configs.next(resolveSubOptions(options, "next")));
229
- }
230
- if (enableStorybook) {
231
- configs$1.push(configs.storybook(resolveSubOptions(options, "storybook")));
232
- }
233
- if (enableUnoCSS) {
234
- configs$1.push(
235
- configs.unocss({
236
- ...resolveSubOptions(options, "unocss"),
237
- overrides: getOverrides(options, "unocss")
238
- })
239
- );
240
- }
241
- if (enableAstro) {
242
- configs$1.push(
243
- configs.astro({
244
- overrides: getOverrides(options, "astro"),
245
- stylistic: stylisticOptions
246
- })
247
- );
248
- }
249
- if (enablePnpm ?? packageManager$1 !== "bun") {
250
- configs$1.push(
251
- configs.pnpm({
252
- overrides: getOverrides(options, "pnpm"),
253
- ignore: typeof enablePnpm !== "boolean" ? enablePnpm?.ignore : void 0
254
- })
255
- );
256
- }
257
- if (enableBun ?? packageManager$1 === "bun") {
258
- configs$1.push(bun.bun({
259
- overrides: getOverrides(options, "bun"),
260
- ignore: typeof enableBun !== "boolean" ? enableBun?.ignore : void 0
261
- }));
262
- }
263
- if (options.jsonc ?? true) {
264
- configs$1.push(
265
- configs.jsonc({
266
- overrides: getOverrides(options, "jsonc"),
267
- stylistic: stylisticOptions
268
- }),
269
- configs.sortTsconfig()
270
- );
271
- if (stylisticOptions) {
272
- configs$1.push(configs.sortPackageJson());
273
- }
274
- }
275
- if (options.yaml ?? true) {
276
- configs$1.push(
277
- configs.yaml({
278
- overrides: getOverrides(options, "yaml"),
279
- stylistic: stylisticOptions
280
- })
281
- );
282
- }
283
- if (options.toml ?? true) {
284
- configs$1.push(
285
- configs.toml({
286
- overrides: getOverrides(options, "toml"),
287
- stylistic: stylisticOptions
288
- })
289
- );
290
- }
291
- if (options.markdown === true) {
292
- configs$1.push(
293
- configs.markdown({
294
- componentExts,
295
- overrides: getOverrides(options, "markdown")
296
- })
297
- );
298
- }
299
- if (enableMdx) {
300
- configs$1.push(
301
- configs.mdx({
302
- overrides: getOverrides(options, "mdx")
303
- })
304
- );
305
- }
306
- if (options.formatters) {
307
- configs$1.push(
308
- configs.formatters(
309
- options.formatters,
310
- typeof stylisticOptions === "boolean" ? {} : stylisticOptions
311
- )
312
- );
313
- }
314
- configs$1.push(configs.disables());
315
- if ("files" in options) {
316
- throw new Error(
317
- '[@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.'
318
- );
319
- }
320
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
321
- if (key in options) {
322
- acc[key] = options[key];
323
- }
324
- return acc;
325
- }, {});
326
- if (Object.keys(fusedConfig).length) configs$1.push([fusedConfig]);
327
- let composer = new eslintFlatConfigUtils.FlatConfigComposer();
328
- composer = composer.append(
329
- ...configs$1,
330
- ...userConfigs
331
- );
332
- if (autoRenamePlugins) {
333
- composer = composer.renamePlugins(defaultPluginRenaming);
334
- }
335
- if (isInEditor) {
336
- composer = composer.disableRulesFix(["test/no-only-tests"], {
337
- builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then(
338
- (r) => r.builtinRules
339
- )
340
- });
341
- }
342
- return composer;
343
- }
344
- const getConfig = preset;
345
- const defineConfig = preset;
346
- var preset_default = preset;
347
-
348
- exports.default = preset_default;
349
- exports.defaultPluginRenaming = defaultPluginRenaming;
350
- exports.defineConfig = defineConfig;
351
- exports.getConfig = getConfig;
352
- exports.getOverrides = getOverrides;
353
- exports.preset = preset;
354
- exports.resolveSubOptions = resolveSubOptions;
package/dist/preset.d.cts DELETED
@@ -1,34 +0,0 @@
1
- import { Linter } from 'eslint';
2
- import { PresetConfig, OptionsConfig, UserConfig, PresetResult, RuleOptions } from './types.cjs';
3
- import '@storm-software/eslint-plugin-banner/rules/banner';
4
- import '@stylistic/eslint-plugin';
5
- import '@typescript-eslint/parser';
6
- import 'eslint-config-flat-gitignore';
7
- import 'eslint-flat-config-utils';
8
-
9
- declare const defaultPluginRenaming: {
10
- "@eslint-react": string;
11
- "@eslint-react/dom": string;
12
- "@eslint-react/hooks-extra": string;
13
- "@eslint-react/naming-convention": string;
14
- "@stylistic": string;
15
- "@typescript-eslint": string;
16
- "import-x": string;
17
- n: string;
18
- vitest: string;
19
- yml: string;
20
- };
21
- type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
22
- declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
23
- declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
24
- /**
25
- * Get the ESLint configuration for a Storm workspace.
26
- *
27
- * @param options - The preset options.
28
- * @param userConfigs - Additional ESLint configurations.
29
- */
30
- declare function preset(options: PresetConfig<OptionsConfig>, ...userConfigs: UserConfig[]): PresetResult;
31
- declare const getConfig: typeof preset;
32
- declare const defineConfig: typeof preset;
33
-
34
- export { type ResolvedOptions, preset as default, defaultPluginRenaming, defineConfig, getConfig, getOverrides, preset, resolveSubOptions };
package/dist/preset.d.ts DELETED
@@ -1,34 +0,0 @@
1
- import { Linter } from 'eslint';
2
- import { PresetConfig, OptionsConfig, UserConfig, PresetResult, RuleOptions } from './types.js';
3
- import '@storm-software/eslint-plugin-banner/rules/banner';
4
- import '@stylistic/eslint-plugin';
5
- import '@typescript-eslint/parser';
6
- import 'eslint-config-flat-gitignore';
7
- import 'eslint-flat-config-utils';
8
-
9
- declare const defaultPluginRenaming: {
10
- "@eslint-react": string;
11
- "@eslint-react/dom": string;
12
- "@eslint-react/hooks-extra": string;
13
- "@eslint-react/naming-convention": string;
14
- "@stylistic": string;
15
- "@typescript-eslint": string;
16
- "import-x": string;
17
- n: string;
18
- vitest: string;
19
- yml: string;
20
- };
21
- type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
22
- declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
23
- declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
24
- /**
25
- * Get the ESLint configuration for a Storm workspace.
26
- *
27
- * @param options - The preset options.
28
- * @param userConfigs - Additional ESLint configurations.
29
- */
30
- declare function preset(options: PresetConfig<OptionsConfig>, ...userConfigs: UserConfig[]): PresetResult;
31
- declare const getConfig: typeof preset;
32
- declare const defineConfig: typeof preset;
33
-
34
- export { type ResolvedOptions, preset as default, defaultPluginRenaming, defineConfig, getConfig, getOverrides, preset, resolveSubOptions };