@storm-software/eslint 0.170.158 → 0.170.160

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.170.158",
3
+ "version": "0.170.160",
4
4
  "private": false,
5
5
  "description": "A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "keywords": [
@@ -51,55 +51,12 @@
51
51
  "sideEffects": false,
52
52
  "type": "module",
53
53
  "exports": {
54
- ".": "./dist/index.mjs",
55
- "./configs": "./dist/configs/index.mjs",
56
- "./configs/astro": "./dist/configs/astro.mjs",
57
- "./configs/banner": "./dist/configs/banner.mjs",
58
- "./configs/bun": "./dist/configs/bun.mjs",
59
- "./configs/cspell": "./dist/configs/cspell.mjs",
60
- "./configs/disables": "./dist/configs/disables.mjs",
61
- "./configs/formatters": "./dist/configs/formatters.mjs",
62
- "./configs/graphql": "./dist/configs/graphql.mjs",
63
- "./configs/ignores": "./dist/configs/ignores.mjs",
64
- "./configs/imports": "./dist/configs/imports.mjs",
65
- "./configs/javascript": "./dist/configs/javascript.mjs",
66
- "./configs/jsdoc": "./dist/configs/jsdoc.mjs",
67
- "./configs/jsonc": "./dist/configs/jsonc.mjs",
68
- "./configs/jsx": "./dist/configs/jsx.mjs",
69
- "./configs/markdown": "./dist/configs/markdown.mjs",
70
- "./configs/mdx": "./dist/configs/mdx.mjs",
71
- "./configs/next": "./dist/configs/next.mjs",
72
- "./configs/node": "./dist/configs/node.mjs",
73
- "./configs/nx": "./dist/configs/nx.mjs",
74
- "./configs/perfectionist": "./dist/configs/perfectionist.mjs",
75
- "./configs/pnpm": "./dist/configs/pnpm.mjs",
76
- "./configs/prettier": "./dist/configs/prettier.mjs",
77
- "./configs/react": "./dist/configs/react.mjs",
78
- "./configs/react-native": "./dist/configs/react-native.mjs",
79
- "./configs/regexp": "./dist/configs/regexp.mjs",
80
- "./configs/secrets": "./dist/configs/secrets.mjs",
81
- "./configs/sort": "./dist/configs/sort.mjs",
82
- "./configs/storybook": "./dist/configs/storybook.mjs",
83
- "./configs/stylistic": "./dist/configs/stylistic.mjs",
84
- "./configs/test": "./dist/configs/test.mjs",
85
- "./configs/toml": "./dist/configs/toml.mjs",
86
- "./configs/tsdoc": "./dist/configs/tsdoc.mjs",
87
- "./configs/typescript": "./dist/configs/typescript.mjs",
88
- "./configs/unicorn": "./dist/configs/unicorn.mjs",
89
- "./configs/unocss": "./dist/configs/unocss.mjs",
90
- "./configs/yaml": "./dist/configs/yaml.mjs",
91
- "./configs/zod": "./dist/configs/zod.mjs",
92
- "./plugins": "./dist/plugins.mjs",
93
- "./preset": "./dist/preset.mjs",
94
- "./types": "./dist/types.mjs",
95
- "./utils/correct-paths": "./dist/utils/correct-paths.mjs",
96
- "./utils/find-workspace-root": "./dist/utils/find-workspace-root.mjs",
97
- "./utils/helpers": "./dist/utils/helpers.mjs",
98
- "./utils/package-manager": "./dist/utils/package-manager.mjs",
99
- "./utils/tsconfig": "./dist/utils/tsconfig.mjs",
54
+ ".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
100
55
  "./*": "./*"
101
56
  },
102
- "types": "./dist/index.d.ts",
57
+ "main": "./dist/index.cjs",
58
+ "module": "./dist/index.mjs",
59
+ "types": "./dist/index.d.cts",
103
60
  "files": ["dist"],
104
61
  "dependencies": {
105
62
  "@antfu/install-pkg": "^1.1.0",
@@ -108,11 +65,11 @@
108
65
  "@eslint/eslintrc": "^3.3.6",
109
66
  "@eslint/markdown": "^6.6.0",
110
67
  "@nx/eslint-plugin": "23.1.1",
111
- "@storm-software/config": "1.138.61",
112
- "@storm-software/config-tools": "1.190.124",
113
- "@storm-software/eslint-plugin-banner": "0.0.89",
114
- "@storm-software/eslint-plugin-tsdoc": "0.0.87",
115
- "@storm-software/package-constants": "0.1.137",
68
+ "@storm-software/config": "1.138.63",
69
+ "@storm-software/config-tools": "1.190.126",
70
+ "@storm-software/eslint-plugin-banner": "0.0.91",
71
+ "@storm-software/eslint-plugin-tsdoc": "0.0.89",
72
+ "@storm-software/package-constants": "0.1.139",
116
73
  "@stylistic/eslint-plugin": "^4.4.1",
117
74
  "@typescript-eslint/eslint-plugin": "^8.66.0",
118
75
  "@typescript-eslint/parser": "^8.66.0",
@@ -123,7 +80,7 @@
123
80
  "cross-spawn": "^7.0.6",
124
81
  "debug": "^4.4.3",
125
82
  "defu": "^6.1.7",
126
- "eslint": "^10.8.0",
83
+ "eslint": "^10.8.1",
127
84
  "eslint-config-flat-gitignore": "^2.3.0",
128
85
  "eslint-config-prettier": "^10.1.8",
129
86
  "eslint-flat-config-utils": "^2.1.4",
@@ -168,9 +125,9 @@
168
125
  "@next/eslint-plugin-next": "^15.5.23",
169
126
  "@nx/eslint": "23.1.1",
170
127
  "@prettier/plugin-xml": "^3.4.2",
171
- "@storm-software/eslint-plugin-bun": "0.0.12",
172
- "@storm-software/eslint-plugin-pnpm": "0.0.87",
173
- "@storm-software/tsdoc": "0.13.277",
128
+ "@storm-software/eslint-plugin-bun": "0.0.14",
129
+ "@storm-software/eslint-plugin-pnpm": "0.0.89",
130
+ "@storm-software/tsdoc": "0.13.279",
174
131
  "@stylistic/eslint-plugin-migrate": "^4.4.1",
175
132
  "@types/eslint": "^9.6.1",
176
133
  "@types/eslint__js": "^8.42.3",
@@ -202,7 +159,7 @@
202
159
  "minimatch": "^10.2.6",
203
160
  "prettier-plugin-astro": "^0.14.1",
204
161
  "tsdown": "^0.22.14",
205
- "tsx": "^4.23.10",
162
+ "tsx": "^4.23.11",
206
163
  "typescript": "^6.0.3",
207
164
  "zod": "^4.4.3"
208
165
  },
@@ -268,5 +225,5 @@
268
225
  "zod": { "optional": true }
269
226
  },
270
227
  "publishConfig": { "access": "public" },
271
- "gitHead": "88e28b2c74d1a37c7f613a2e4cb0bbfb20f785aa"
228
+ "gitHead": "2421b5038a6045f6d516d3737c5209be1264ba21"
272
229
  }
@@ -1,15 +0,0 @@
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 DELETED
@@ -1,16 +0,0 @@
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 };
package/dist/preset.d.mts DELETED
@@ -1,32 +0,0 @@
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 DELETED
@@ -1,213 +0,0 @@
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 };