@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.
- package/README.md +1 -1
- package/dist/index.d.mts +43 -0
- package/dist/index.mjs +44 -0
- package/dist/plugins.d.mts +15 -0
- package/dist/plugins.mjs +16 -0
- package/dist/preset.d.mts +32 -0
- package/dist/preset.mjs +213 -0
- package/dist/{types.d.cts → typegen.d.mts} +8538 -11156
- package/dist/types.d.mts +735 -0
- package/dist/types.mjs +5 -0
- package/dist/utils/correct-paths.mjs +136 -0
- package/dist/utils/find-workspace-root.mjs +83 -0
- package/dist/utils/helpers.mjs +75 -0
- package/dist/utils/package-manager.mjs +20 -0
- package/dist/utils/tsconfig.mjs +48 -0
- package/package.json +58 -79
- package/dist/index.cjs +0 -24
- package/dist/index.d.cts +0 -127
- package/dist/index.d.ts +0 -127
- package/dist/index.js +0 -7
- package/dist/preset.cjs +0 -354
- package/dist/preset.d.cts +0 -34
- package/dist/preset.d.ts +0 -34
- package/dist/preset.js +0 -344
- package/dist/types.cjs +0 -12
- package/dist/types.d.ts +0 -19537
- package/dist/types.js +0 -1
- package/dist/utils/combine.cjs +0 -8
- package/dist/utils/combine.d.cts +0 -14
- package/dist/utils/combine.d.ts +0 -14
- package/dist/utils/combine.js +0 -6
- package/dist/utils/correct-paths.cjs +0 -231
- package/dist/utils/correct-paths.d.cts +0 -30
- package/dist/utils/correct-paths.d.ts +0 -30
- package/dist/utils/correct-paths.js +0 -216
- package/dist/utils/find-workspace-root.cjs +0 -96
- package/dist/utils/find-workspace-root.d.cts +0 -16
- package/dist/utils/find-workspace-root.d.ts +0 -16
- package/dist/utils/find-workspace-root.js +0 -93
- package/dist/utils/format-config.cjs +0 -19
- package/dist/utils/format-config.d.cts +0 -5
- package/dist/utils/format-config.d.ts +0 -5
- package/dist/utils/format-config.js +0 -17
- package/dist/utils/helpers.cjs +0 -86
- package/dist/utils/helpers.d.cts +0 -55
- package/dist/utils/helpers.d.ts +0 -55
- package/dist/utils/helpers.js +0 -72
- package/dist/utils/package-manager.cjs +0 -18
- package/dist/utils/package-manager.d.cts +0 -8
- package/dist/utils/package-manager.d.ts +0 -8
- package/dist/utils/package-manager.js +0 -16
- package/dist/utils/tsconfig.cjs +0 -43
- package/dist/utils/tsconfig.d.cts +0 -25
- package/dist/utils/tsconfig.d.ts +0 -25
- package/dist/utils/tsconfig.js +0 -40
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { ConfigNames, RuleOptions } from "./typegen.mjs";
|
|
4
|
+
import { Awaitable, ESLintGlobalsPropValue, OptionsBanner, OptionsBun, OptionsCSpell, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsGraphQL, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSDoc, OptionsJavascript, OptionsNext, OptionsNx, OptionsNxDependencyChecks, OptionsNxEnforceModuleBoundaries, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStorybook, OptionsStylistic, OptionsTSDoc, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, PresetConfig, PresetResult, Rules, StylisticConfig, TypedFlatConfigItem, UserConfig } from "./types.mjs";
|
|
5
|
+
import { astro } from "./configs/astro.mjs";
|
|
6
|
+
import { banner } from "./configs/banner.mjs";
|
|
7
|
+
import { bun } from "./configs/bun.mjs";
|
|
8
|
+
import { cspell } from "./configs/cspell.mjs";
|
|
9
|
+
import { disables } from "./configs/disables.mjs";
|
|
10
|
+
import { formatters } from "./configs/formatters.mjs";
|
|
11
|
+
import { graphql } from "./configs/graphql.mjs";
|
|
12
|
+
import { ignores } from "./configs/ignores.mjs";
|
|
13
|
+
import { imports } from "./configs/imports.mjs";
|
|
14
|
+
import { javascript } from "./configs/javascript.mjs";
|
|
15
|
+
import { jsdoc } from "./configs/jsdoc.mjs";
|
|
16
|
+
import { jsonc } from "./configs/jsonc.mjs";
|
|
17
|
+
import { jsx } from "./configs/jsx.mjs";
|
|
18
|
+
import { markdown } from "./configs/markdown.mjs";
|
|
19
|
+
import { mdx } from "./configs/mdx.mjs";
|
|
20
|
+
import { next } from "./configs/next.mjs";
|
|
21
|
+
import { node } from "./configs/node.mjs";
|
|
22
|
+
import { nx } from "./configs/nx.mjs";
|
|
23
|
+
import { perfectionist } from "./configs/perfectionist.mjs";
|
|
24
|
+
import { pnpm } from "./configs/pnpm.mjs";
|
|
25
|
+
import { prettier } from "./configs/prettier.mjs";
|
|
26
|
+
import { react } from "./configs/react.mjs";
|
|
27
|
+
import { reactNative } from "./configs/react-native.mjs";
|
|
28
|
+
import { regexp } from "./configs/regexp.mjs";
|
|
29
|
+
import { secrets } from "./configs/secrets.mjs";
|
|
30
|
+
import { sortPackageJson, sortTsconfig } from "./configs/sort.mjs";
|
|
31
|
+
import { storybook } from "./configs/storybook.mjs";
|
|
32
|
+
import { StylisticConfigDefaults, StylisticOptions, stylistic } from "./configs/stylistic.mjs";
|
|
33
|
+
import { test } from "./configs/test.mjs";
|
|
34
|
+
import { toml } from "./configs/toml.mjs";
|
|
35
|
+
import { tsdoc } from "./configs/tsdoc.mjs";
|
|
36
|
+
import { typescript } from "./configs/typescript.mjs";
|
|
37
|
+
import { unicorn } from "./configs/unicorn.mjs";
|
|
38
|
+
import { unocss } from "./configs/unocss.mjs";
|
|
39
|
+
import { yaml } from "./configs/yaml.mjs";
|
|
40
|
+
import { zod } from "./configs/zod.mjs";
|
|
41
|
+
import "./configs/index.mjs";
|
|
42
|
+
import preset, { ResolvedOptions, defaultPluginRenaming, defineConfig, getConfig, getOverrides, resolveSubOptions } from "./preset.mjs";
|
|
43
|
+
export { type Awaitable, type ConfigNames, type ESLintGlobalsPropValue, type OptionsBanner, type OptionsBun, type OptionsCSpell, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsGraphQL, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsJSDoc, type OptionsJavascript, type OptionsNext, type OptionsNx, type OptionsNxDependencyChecks, type OptionsNxEnforceModuleBoundaries, type OptionsOverrides, type OptionsPnpm, type OptionsProjectType, type OptionsReact, type OptionsRegExp, type OptionsStorybook, type OptionsStylistic, type OptionsTSDoc, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnicorn, type OptionsUnoCSS, type PresetConfig, type PresetResult, ResolvedOptions, type RuleOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, StylisticOptions, type TypedFlatConfigItem, type UserConfig, astro, banner, bun, cspell, defineConfig as default, defaultPluginRenaming, defineConfig, disables, formatters, getConfig, getOverrides, graphql, ignores, imports, javascript, jsdoc, jsonc, jsx, markdown, mdx, next, node, nx, perfectionist, pnpm, preset, prettier, react, reactNative, regexp, resolveSubOptions, secrets, sortPackageJson, sortTsconfig, storybook, stylistic, test, toml, tsdoc, typescript, unicorn, unocss, yaml, zod };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { astro } from "./configs/astro.mjs";
|
|
5
|
+
import { banner } from "./configs/banner.mjs";
|
|
6
|
+
import { bun } from "./configs/bun.mjs";
|
|
7
|
+
import { cspell } from "./configs/cspell.mjs";
|
|
8
|
+
import { disables } from "./configs/disables.mjs";
|
|
9
|
+
import { StylisticConfigDefaults, stylistic } from "./configs/stylistic.mjs";
|
|
10
|
+
import { formatters } from "./configs/formatters.mjs";
|
|
11
|
+
import { graphql } from "./configs/graphql.mjs";
|
|
12
|
+
import { ignores } from "./configs/ignores.mjs";
|
|
13
|
+
import { imports } from "./configs/imports.mjs";
|
|
14
|
+
import { javascript } from "./configs/javascript.mjs";
|
|
15
|
+
import { jsdoc } from "./configs/jsdoc.mjs";
|
|
16
|
+
import { jsonc } from "./configs/jsonc.mjs";
|
|
17
|
+
import { jsx } from "./configs/jsx.mjs";
|
|
18
|
+
import { markdown } from "./configs/markdown.mjs";
|
|
19
|
+
import { mdx } from "./configs/mdx.mjs";
|
|
20
|
+
import { next } from "./configs/next.mjs";
|
|
21
|
+
import { node } from "./configs/node.mjs";
|
|
22
|
+
import { nx } from "./configs/nx.mjs";
|
|
23
|
+
import { perfectionist } from "./configs/perfectionist.mjs";
|
|
24
|
+
import { pnpm } from "./configs/pnpm.mjs";
|
|
25
|
+
import { prettier } from "./configs/prettier.mjs";
|
|
26
|
+
import { react } from "./configs/react.mjs";
|
|
27
|
+
import { reactNative } from "./configs/react-native.mjs";
|
|
28
|
+
import { regexp } from "./configs/regexp.mjs";
|
|
29
|
+
import { secrets } from "./configs/secrets.mjs";
|
|
30
|
+
import { sortPackageJson, sortTsconfig } from "./configs/sort.mjs";
|
|
31
|
+
import { storybook } from "./configs/storybook.mjs";
|
|
32
|
+
import { test } from "./configs/test.mjs";
|
|
33
|
+
import { toml } from "./configs/toml.mjs";
|
|
34
|
+
import { tsdoc } from "./configs/tsdoc.mjs";
|
|
35
|
+
import { typescript } from "./configs/typescript.mjs";
|
|
36
|
+
import { unicorn } from "./configs/unicorn.mjs";
|
|
37
|
+
import { unocss } from "./configs/unocss.mjs";
|
|
38
|
+
import { yaml } from "./configs/yaml.mjs";
|
|
39
|
+
import { zod } from "./configs/zod.mjs";
|
|
40
|
+
import preset, { defaultPluginRenaming, defineConfig, getConfig, getOverrides, resolveSubOptions } from "./preset.mjs";
|
|
41
|
+
//#region src/index.ts
|
|
42
|
+
var src_default = defineConfig;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { StylisticConfigDefaults, astro, banner, bun, cspell, src_default as default, defaultPluginRenaming, defineConfig, disables, formatters, getConfig, getOverrides, graphql, ignores, imports, javascript, jsdoc, jsonc, jsx, markdown, mdx, next, node, nx, perfectionist, pnpm, preset, prettier, react, reactNative, regexp, resolveSubOptions, secrets, sortPackageJson, sortTsconfig, storybook, stylistic, test, toml, tsdoc, typescript, unicorn, unocss, yaml, zod };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import plugin from "./node_modules/.pnpm/eslint-plugin-import-x@4.17.1_patch_hash_2fde63e367ada6ae348459ff5a2b0bbc53a12189dad6a5_d74b68867cd90b11765828cea49cabce/node_modules/eslint-plugin-import-x/lib/index.mjs";
|
|
4
|
+
import importZod from "./node_modules/.pnpm/eslint-plugin-import-zod@1.2.1_@typescript-eslint_utils@8.66.0_eslint@10.8.0_jiti@2.7.0_249816da6650368ff5a8e0a19476ba2a/node_modules/eslint-plugin-import-zod/dist/index.mjs";
|
|
5
|
+
import pluginCspell from "@cspell/eslint-plugin";
|
|
6
|
+
import pluginNx from "@nx/eslint-plugin/nx";
|
|
7
|
+
import pluginVitest from "@vitest/eslint-plugin";
|
|
8
|
+
import pluginNode from "eslint-plugin-n";
|
|
9
|
+
import pluginNoOnlyTests from "eslint-plugin-no-only-tests";
|
|
10
|
+
import pluginSecrets from "eslint-plugin-no-secrets";
|
|
11
|
+
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
12
|
+
import pluginPrettier from "eslint-plugin-prettier";
|
|
13
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
14
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
15
|
+
export { pluginCspell, plugin as pluginImport, importZod as pluginImportZod, pluginNoOnlyTests, pluginNode, pluginNx, pluginPerfectionist, pluginPrettier, pluginSecrets, pluginUnicorn, pluginUnusedImports, pluginVitest };
|
package/dist/plugins.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import plugin from "./node_modules/.pnpm/eslint-plugin-import-x@4.17.1_patch_hash_2fde63e367ada6ae348459ff5a2b0bbc53a12189dad6a5_d74b68867cd90b11765828cea49cabce/node_modules/eslint-plugin-import-x/lib/index.mjs";
|
|
5
|
+
import dist_default from "./node_modules/.pnpm/eslint-plugin-import-zod@1.2.1_@typescript-eslint_utils@8.66.0_eslint@10.8.0_jiti@2.7.0_249816da6650368ff5a8e0a19476ba2a/node_modules/eslint-plugin-import-zod/dist/index.mjs";
|
|
6
|
+
import pluginCspell from "@cspell/eslint-plugin";
|
|
7
|
+
import pluginNx from "@nx/eslint-plugin/nx";
|
|
8
|
+
import pluginVitest from "@vitest/eslint-plugin";
|
|
9
|
+
import pluginNode from "eslint-plugin-n";
|
|
10
|
+
import pluginNoOnlyTests from "eslint-plugin-no-only-tests";
|
|
11
|
+
import pluginSecrets from "eslint-plugin-no-secrets";
|
|
12
|
+
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
13
|
+
import pluginPrettier from "eslint-plugin-prettier";
|
|
14
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
15
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
16
|
+
export { pluginCspell, plugin as pluginImport, dist_default as pluginImportZod, pluginNoOnlyTests, pluginNode, pluginNx, pluginPerfectionist, pluginPrettier, pluginSecrets, pluginUnicorn, pluginUnusedImports, pluginVitest };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { RuleOptions } from "./typegen.mjs";
|
|
4
|
+
import { OptionsConfig, PresetConfig, PresetResult, UserConfig } from "./types.mjs";
|
|
5
|
+
import { Linter } from "eslint";
|
|
6
|
+
//#region src/preset.d.ts
|
|
7
|
+
declare const defaultPluginRenaming: {
|
|
8
|
+
"@eslint-react": string;
|
|
9
|
+
"@eslint-react/dom": string;
|
|
10
|
+
"@eslint-react/hooks-extra": string;
|
|
11
|
+
"@eslint-react/naming-convention": string;
|
|
12
|
+
"@stylistic": string;
|
|
13
|
+
"@typescript-eslint": string;
|
|
14
|
+
"import-x": string;
|
|
15
|
+
n: string;
|
|
16
|
+
vitest: string;
|
|
17
|
+
yml: string;
|
|
18
|
+
};
|
|
19
|
+
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
20
|
+
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
21
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the ESLint configuration for a Storm workspace.
|
|
24
|
+
*
|
|
25
|
+
* @param options - The preset options.
|
|
26
|
+
* @param userConfigs - Additional ESLint configurations.
|
|
27
|
+
*/
|
|
28
|
+
declare function preset(options: PresetConfig<OptionsConfig>, ...userConfigs: UserConfig[]): PresetResult;
|
|
29
|
+
declare const getConfig: typeof preset;
|
|
30
|
+
declare const defineConfig: typeof preset;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ResolvedOptions, preset as default, preset, defaultPluginRenaming, defineConfig, getConfig, getOverrides, resolveSubOptions };
|
package/dist/preset.mjs
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { interopDefault, isInEditorEnv } from "./utils/helpers.mjs";
|
|
5
|
+
import { astro } from "./configs/astro.mjs";
|
|
6
|
+
import { banner } from "./configs/banner.mjs";
|
|
7
|
+
import { bun } from "./configs/bun.mjs";
|
|
8
|
+
import { cspell } from "./configs/cspell.mjs";
|
|
9
|
+
import { disables } from "./configs/disables.mjs";
|
|
10
|
+
import { stylistic } from "./configs/stylistic.mjs";
|
|
11
|
+
import { formatters } from "./configs/formatters.mjs";
|
|
12
|
+
import { graphql } from "./configs/graphql.mjs";
|
|
13
|
+
import { ignores } from "./configs/ignores.mjs";
|
|
14
|
+
import { imports } from "./configs/imports.mjs";
|
|
15
|
+
import { javascript } from "./configs/javascript.mjs";
|
|
16
|
+
import { jsdoc } from "./configs/jsdoc.mjs";
|
|
17
|
+
import { jsonc } from "./configs/jsonc.mjs";
|
|
18
|
+
import { jsx } from "./configs/jsx.mjs";
|
|
19
|
+
import { markdown } from "./configs/markdown.mjs";
|
|
20
|
+
import { mdx } from "./configs/mdx.mjs";
|
|
21
|
+
import { next } from "./configs/next.mjs";
|
|
22
|
+
import { node } from "./configs/node.mjs";
|
|
23
|
+
import { nx } from "./configs/nx.mjs";
|
|
24
|
+
import { perfectionist } from "./configs/perfectionist.mjs";
|
|
25
|
+
import { pnpm } from "./configs/pnpm.mjs";
|
|
26
|
+
import { prettier } from "./configs/prettier.mjs";
|
|
27
|
+
import { react } from "./configs/react.mjs";
|
|
28
|
+
import { reactNative } from "./configs/react-native.mjs";
|
|
29
|
+
import { regexp } from "./configs/regexp.mjs";
|
|
30
|
+
import { secrets } from "./configs/secrets.mjs";
|
|
31
|
+
import { sortPackageJson, sortTsconfig } from "./configs/sort.mjs";
|
|
32
|
+
import { storybook } from "./configs/storybook.mjs";
|
|
33
|
+
import { test } from "./configs/test.mjs";
|
|
34
|
+
import { toml } from "./configs/toml.mjs";
|
|
35
|
+
import { tsdoc } from "./configs/tsdoc.mjs";
|
|
36
|
+
import { typescript } from "./configs/typescript.mjs";
|
|
37
|
+
import { unicorn } from "./configs/unicorn.mjs";
|
|
38
|
+
import { unocss } from "./configs/unocss.mjs";
|
|
39
|
+
import { yaml } from "./configs/yaml.mjs";
|
|
40
|
+
import { zod } from "./configs/zod.mjs";
|
|
41
|
+
import { getTsConfigPath } from "./utils/tsconfig.mjs";
|
|
42
|
+
import { detectPackageManager } from "./utils/package-manager.mjs";
|
|
43
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
44
|
+
import { isPackageExists } from "local-pkg";
|
|
45
|
+
//#region src/preset.ts
|
|
46
|
+
const flatConfigProps = [
|
|
47
|
+
"name",
|
|
48
|
+
"languageOptions",
|
|
49
|
+
"linterOptions",
|
|
50
|
+
"processor",
|
|
51
|
+
"plugins",
|
|
52
|
+
"rules",
|
|
53
|
+
"settings"
|
|
54
|
+
];
|
|
55
|
+
const defaultPluginRenaming = {
|
|
56
|
+
"@eslint-react": "react",
|
|
57
|
+
"@eslint-react/dom": "react-dom",
|
|
58
|
+
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
59
|
+
"@eslint-react/naming-convention": "react-naming-convention",
|
|
60
|
+
"@stylistic": "style",
|
|
61
|
+
"@typescript-eslint": "ts",
|
|
62
|
+
"import-x": "import",
|
|
63
|
+
n: "node",
|
|
64
|
+
vitest: "test",
|
|
65
|
+
yml: "yaml"
|
|
66
|
+
};
|
|
67
|
+
function resolveSubOptions(options, key) {
|
|
68
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
69
|
+
}
|
|
70
|
+
function getOverrides(options, key) {
|
|
71
|
+
const sub = resolveSubOptions(options, key);
|
|
72
|
+
return "overrides" in sub ? sub.overrides : {};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the ESLint configuration for a Storm workspace.
|
|
76
|
+
*
|
|
77
|
+
* @param options - The preset options.
|
|
78
|
+
* @param userConfigs - Additional ESLint configurations.
|
|
79
|
+
*/
|
|
80
|
+
function preset(options, ...userConfigs) {
|
|
81
|
+
const { name, globals = {}, banner: enableBanner = true, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, jsx: enableJsx = true, mdx: enableMdx = false, cspell: enableCSpell = true, react: enableReact = false, "react-native": enableReactNative = false, regexp: enableRegexp = true, next: enableNext = false, graphql: enableGraphQL = false, storybook: enableStorybook = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, jsdoc: enableJSDoc = false, tsdoc: enableTSDoc = true, test: enableTest = true, unocss: enableUnoCSS = false, zod: enableZod = false, bun: enableBun, pnpm: enablePnpm } = options;
|
|
82
|
+
const packageManager = detectPackageManager();
|
|
83
|
+
let isInEditor = options.isInEditor;
|
|
84
|
+
if (!isInEditor) {
|
|
85
|
+
isInEditor = isInEditorEnv();
|
|
86
|
+
if (isInEditor) console.log("[@storm-software/eslint] Detected running in editor, some rules are disabled.");
|
|
87
|
+
}
|
|
88
|
+
const stylisticOptions = !options.stylistic ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
89
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = enableJsx;
|
|
90
|
+
const configs = [];
|
|
91
|
+
if (enableGitignore) {
|
|
92
|
+
if (typeof enableGitignore !== "boolean") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
93
|
+
name: "storm/gitignore",
|
|
94
|
+
...enableGitignore
|
|
95
|
+
})]));
|
|
96
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
97
|
+
name: "storm/gitignore",
|
|
98
|
+
strict: false
|
|
99
|
+
})]));
|
|
100
|
+
}
|
|
101
|
+
configs.push(ignores(options.ignores), javascript({
|
|
102
|
+
globals,
|
|
103
|
+
isInEditor,
|
|
104
|
+
overrides: getOverrides(options, "javascript")
|
|
105
|
+
}), node(), imports({ stylistic: stylisticOptions }), nx(resolveSubOptions(options, "nx")), perfectionist(), secrets({ json: options.jsonc !== false }));
|
|
106
|
+
let typescriptOptions = {};
|
|
107
|
+
if (enableTypeScript) {
|
|
108
|
+
typescriptOptions = resolveSubOptions(options, "typescript");
|
|
109
|
+
if (typescriptOptions.tsconfigPath !== false) typescriptOptions.tsconfigPath = getTsConfigPath(typescriptOptions.tsconfigPath, options.type);
|
|
110
|
+
}
|
|
111
|
+
if (enableTypeScript) configs.push(typescript({
|
|
112
|
+
...typescriptOptions,
|
|
113
|
+
tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
|
|
114
|
+
componentExts,
|
|
115
|
+
overrides: getOverrides(options, "typescript"),
|
|
116
|
+
type: options.type
|
|
117
|
+
}));
|
|
118
|
+
if (enableBanner) configs.push(banner({
|
|
119
|
+
...resolveSubOptions(options, "banner"),
|
|
120
|
+
name,
|
|
121
|
+
overrides: getOverrides(options, "banner")
|
|
122
|
+
}));
|
|
123
|
+
if (!stylisticOptions) configs.push(prettier());
|
|
124
|
+
if (enableCSpell) configs.push(cspell(resolveSubOptions(options, "cspell")));
|
|
125
|
+
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
126
|
+
if (enableJSDoc) configs.push(jsdoc({
|
|
127
|
+
...resolveSubOptions(options, "jsdoc"),
|
|
128
|
+
overrides: getOverrides(options, "jsdoc")
|
|
129
|
+
}));
|
|
130
|
+
if (enableTSDoc) configs.push(tsdoc({
|
|
131
|
+
...resolveSubOptions(options, "tsdoc"),
|
|
132
|
+
overrides: getOverrides(options, "tsdoc")
|
|
133
|
+
}));
|
|
134
|
+
if (enableJsx) configs.push(jsx());
|
|
135
|
+
if (enableZod) configs.push(zod({ overrides: getOverrides(options, "zod") }));
|
|
136
|
+
if (stylisticOptions) configs.push(stylistic({
|
|
137
|
+
...stylisticOptions,
|
|
138
|
+
lineEndings: stylisticOptions.lineEndings ?? "unix",
|
|
139
|
+
lessOpinionated: options.lessOpinionated,
|
|
140
|
+
overrides: getOverrides(options, "stylistic")
|
|
141
|
+
}));
|
|
142
|
+
if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
143
|
+
if (enableTest) configs.push(test({
|
|
144
|
+
isInEditor,
|
|
145
|
+
overrides: getOverrides(options, "test")
|
|
146
|
+
}));
|
|
147
|
+
if (enableGraphQL) configs.push(graphql(resolveSubOptions(options, "graphql")));
|
|
148
|
+
if (enableReact) configs.push(react({
|
|
149
|
+
...typescriptOptions,
|
|
150
|
+
tsconfigPath: typescriptOptions.tsconfigPath === false ? void 0 : typescriptOptions.tsconfigPath,
|
|
151
|
+
...typeof enableReact === "boolean" ? { strict: false } : enableReact,
|
|
152
|
+
overrides: getOverrides(options, "react")
|
|
153
|
+
}));
|
|
154
|
+
if (enableReactNative) configs.push(reactNative({
|
|
155
|
+
...resolveSubOptions(options, "react-native"),
|
|
156
|
+
overrides: getOverrides(options, "react-native")
|
|
157
|
+
}));
|
|
158
|
+
if (enableNext) configs.push(next(resolveSubOptions(options, "next")));
|
|
159
|
+
if (enableStorybook) configs.push(storybook(resolveSubOptions(options, "storybook")));
|
|
160
|
+
if (enableUnoCSS) configs.push(unocss({
|
|
161
|
+
...resolveSubOptions(options, "unocss"),
|
|
162
|
+
overrides: getOverrides(options, "unocss")
|
|
163
|
+
}));
|
|
164
|
+
if (enableAstro) configs.push(astro({
|
|
165
|
+
overrides: getOverrides(options, "astro"),
|
|
166
|
+
stylistic: stylisticOptions
|
|
167
|
+
}));
|
|
168
|
+
if (enablePnpm ?? packageManager !== "bun") configs.push(pnpm({
|
|
169
|
+
overrides: getOverrides(options, "pnpm"),
|
|
170
|
+
ignore: typeof enablePnpm !== "boolean" ? enablePnpm?.ignore : void 0
|
|
171
|
+
}));
|
|
172
|
+
if (enableBun ?? packageManager === "bun") configs.push(bun({
|
|
173
|
+
overrides: getOverrides(options, "bun"),
|
|
174
|
+
ignore: typeof enableBun !== "boolean" ? enableBun?.ignore : void 0
|
|
175
|
+
}));
|
|
176
|
+
if (options.jsonc ?? true) {
|
|
177
|
+
configs.push(jsonc({
|
|
178
|
+
overrides: getOverrides(options, "jsonc"),
|
|
179
|
+
stylistic: stylisticOptions
|
|
180
|
+
}), sortTsconfig());
|
|
181
|
+
if (stylisticOptions) configs.push(sortPackageJson());
|
|
182
|
+
}
|
|
183
|
+
if (options.yaml ?? true) configs.push(yaml({
|
|
184
|
+
overrides: getOverrides(options, "yaml"),
|
|
185
|
+
stylistic: stylisticOptions
|
|
186
|
+
}));
|
|
187
|
+
if (options.toml ?? true) configs.push(toml({
|
|
188
|
+
overrides: getOverrides(options, "toml"),
|
|
189
|
+
stylistic: stylisticOptions
|
|
190
|
+
}));
|
|
191
|
+
if (options.markdown === true) configs.push(markdown({
|
|
192
|
+
componentExts,
|
|
193
|
+
overrides: getOverrides(options, "markdown")
|
|
194
|
+
}));
|
|
195
|
+
if (enableMdx) configs.push(mdx({ overrides: getOverrides(options, "mdx") }));
|
|
196
|
+
if (options.formatters) configs.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
|
|
197
|
+
configs.push(disables());
|
|
198
|
+
if ("files" in options) throw new Error("[@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.");
|
|
199
|
+
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
200
|
+
if (key in options) acc[key] = options[key];
|
|
201
|
+
return acc;
|
|
202
|
+
}, {});
|
|
203
|
+
if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
|
|
204
|
+
let composer = new FlatConfigComposer();
|
|
205
|
+
composer = composer.append(...configs, ...userConfigs);
|
|
206
|
+
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
207
|
+
if (isInEditor) composer = composer.disableRulesFix(["test/no-only-tests"], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
|
|
208
|
+
return composer;
|
|
209
|
+
}
|
|
210
|
+
const getConfig = preset;
|
|
211
|
+
const defineConfig = preset;
|
|
212
|
+
//#endregion
|
|
213
|
+
export { preset as default, preset, defaultPluginRenaming, defineConfig, getConfig, getOverrides, resolveSubOptions };
|