@storm-software/eslint 0.138.0 → 0.139.0
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/chunk-7JRBTALJ.js +91 -0
- package/dist/{chunk-GXNMSXDL.js → chunk-D3EN5HD2.js} +7 -4
- package/dist/{chunk-BXVDD33Y.js → chunk-VMGPCABA.js} +3 -3
- package/dist/{chunk-KDHZD7SF.js → chunk-ZUIV57VZ.js} +8 -8
- package/dist/preset.d.ts +1 -1
- package/dist/preset.js +81 -28
- package/dist/types.d.ts +62 -2
- package/dist/utils/banner-plugin.js +2 -2
- package/dist/utils/find-workspace-root.d.ts +16 -0
- package/dist/utils/find-workspace-root.js +10 -0
- package/dist/utils/get-file-banner.d.ts +2 -2
- package/dist/utils/get-file-banner.js +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/tsconfig-path.d.ts +1 -1
- package/dist/utils/tsconfig-path.js +2 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
correctPaths
|
|
3
|
+
} from "./chunk-G7QVU75O.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-SHUYVCID.js";
|
|
7
|
+
|
|
8
|
+
// src/utils/find-workspace-root.ts
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
12
|
+
var depth = 0;
|
|
13
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
14
|
+
const _startPath = startPath ?? process.cwd();
|
|
15
|
+
if (endDirectoryNames.some((endDirName) => existsSync(join(_startPath, endDirName)))) {
|
|
16
|
+
return _startPath;
|
|
17
|
+
}
|
|
18
|
+
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
|
|
19
|
+
return _startPath;
|
|
20
|
+
}
|
|
21
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
22
|
+
const parent = join(_startPath, "..");
|
|
23
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
24
|
+
}
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
__name(findFolderUp, "findFolderUp");
|
|
28
|
+
var rootFiles = [
|
|
29
|
+
"storm-workspace.json",
|
|
30
|
+
"storm-workspace.json",
|
|
31
|
+
"storm-workspace.yaml",
|
|
32
|
+
"storm-workspace.yml",
|
|
33
|
+
"storm-workspace.js",
|
|
34
|
+
"storm-workspace.ts",
|
|
35
|
+
".storm-workspace.json",
|
|
36
|
+
".storm-workspace.yaml",
|
|
37
|
+
".storm-workspace.yml",
|
|
38
|
+
".storm-workspace.js",
|
|
39
|
+
".storm-workspace.ts",
|
|
40
|
+
"lerna.json",
|
|
41
|
+
"nx.json",
|
|
42
|
+
"turbo.json",
|
|
43
|
+
"npm-workspace.json",
|
|
44
|
+
"yarn-workspace.json",
|
|
45
|
+
"pnpm-workspace.json",
|
|
46
|
+
"npm-workspace.yaml",
|
|
47
|
+
"yarn-workspace.yaml",
|
|
48
|
+
"pnpm-workspace.yaml",
|
|
49
|
+
"npm-workspace.yml",
|
|
50
|
+
"yarn-workspace.yml",
|
|
51
|
+
"pnpm-workspace.yml",
|
|
52
|
+
"npm-lock.json",
|
|
53
|
+
"yarn-lock.json",
|
|
54
|
+
"pnpm-lock.json",
|
|
55
|
+
"npm-lock.yaml",
|
|
56
|
+
"yarn-lock.yaml",
|
|
57
|
+
"pnpm-lock.yaml",
|
|
58
|
+
"npm-lock.yml",
|
|
59
|
+
"yarn-lock.yml",
|
|
60
|
+
"pnpm-lock.yml",
|
|
61
|
+
"bun.lockb"
|
|
62
|
+
];
|
|
63
|
+
var rootDirectories = [
|
|
64
|
+
".storm-workspace",
|
|
65
|
+
".nx",
|
|
66
|
+
".github",
|
|
67
|
+
".vscode",
|
|
68
|
+
".verdaccio"
|
|
69
|
+
];
|
|
70
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
71
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
72
|
+
return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
73
|
+
}
|
|
74
|
+
return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
75
|
+
}
|
|
76
|
+
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
77
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
78
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
79
|
+
if (!result) {
|
|
80
|
+
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
81
|
+
${rootFiles.join("\n")}
|
|
82
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
findWorkspaceRootSafe,
|
|
90
|
+
findWorkspaceRoot
|
|
91
|
+
};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
joinPaths
|
|
3
|
+
} from "./chunk-G7QVU75O.js";
|
|
1
4
|
import {
|
|
2
5
|
__name
|
|
3
6
|
} from "./chunk-SHUYVCID.js";
|
|
4
7
|
|
|
5
8
|
// src/utils/tsconfig-path.ts
|
|
6
9
|
import { existsSync } from "node:fs";
|
|
7
|
-
function getTsConfigPath() {
|
|
10
|
+
function getTsConfigPath(basePath = "./") {
|
|
8
11
|
let tsconfigPath = "tsconfig.json";
|
|
9
|
-
if (existsSync("tsconfig.base.json")) {
|
|
12
|
+
if (existsSync(joinPaths(basePath, "tsconfig.base.json"))) {
|
|
10
13
|
tsconfigPath = "tsconfig.base.json";
|
|
11
|
-
} else if (existsSync("tsconfig.app.json")) {
|
|
14
|
+
} else if (existsSync(joinPaths(basePath, "tsconfig.app.json"))) {
|
|
12
15
|
tsconfigPath = "tsconfig.app.json";
|
|
13
|
-
} else if (existsSync("tsconfig.lib.json")) {
|
|
16
|
+
} else if (existsSync(joinPaths(basePath, "tsconfig.lib.json"))) {
|
|
14
17
|
tsconfigPath = "tsconfig.lib.json";
|
|
15
18
|
} else {
|
|
16
19
|
console.warn("No tsconfig.json found. Consider adding a tsconfig.json file to your project's ESLint configuration.");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getFileBanner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZUIV57VZ.js";
|
|
4
4
|
import {
|
|
5
5
|
GLOB_SRC
|
|
6
6
|
} from "./chunk-AIKLBIPC.js";
|
|
@@ -166,11 +166,11 @@ var bannerRule = ESLintUtils.RuleCreator(() => `https://docs.stormsoftware.com/e
|
|
|
166
166
|
{
|
|
167
167
|
repositoryName: "",
|
|
168
168
|
commentType: "block",
|
|
169
|
-
numNewlines:
|
|
169
|
+
numNewlines: 2,
|
|
170
170
|
lineEndings: "unix"
|
|
171
171
|
}
|
|
172
172
|
],
|
|
173
|
-
create(context, [{ banner, repositoryName = "", commentType = "block", numNewlines =
|
|
173
|
+
create(context, [{ banner, repositoryName = "", commentType = "block", numNewlines = 2, lineEndings = "unix" }]) {
|
|
174
174
|
if (!banner) {
|
|
175
175
|
banner = getFileBanner(repositoryName);
|
|
176
176
|
}
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-SHUYVCID.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/get-file-banner.ts
|
|
9
|
-
var getFileBanner = /* @__PURE__ */ __name((
|
|
10
|
-
if (!
|
|
11
|
-
|
|
9
|
+
var getFileBanner = /* @__PURE__ */ __name((repositoryName = "") => {
|
|
10
|
+
if (!repositoryName) {
|
|
11
|
+
repositoryName = process.env.STORM_NAME || "";
|
|
12
12
|
}
|
|
13
13
|
let padding = " ";
|
|
14
|
-
for (let i = 0; i <
|
|
14
|
+
for (let i = 0; i < repositoryName.length + 2 && padding.length > 4; i++) {
|
|
15
15
|
padding = padding.slice(0, -1);
|
|
16
16
|
}
|
|
17
|
-
let titleName =
|
|
17
|
+
let titleName = repositoryName;
|
|
18
18
|
if (titleName) {
|
|
19
19
|
if (titleName?.startsWith("@")) {
|
|
20
20
|
titleName = titleName.slice(1);
|
|
@@ -36,10 +36,10 @@ ${padding}\u26A1 Storm Software ${titleName ? `- ${titleName}` : ""}
|
|
|
36
36
|
our licensing page.
|
|
37
37
|
|
|
38
38
|
Website: ${process.env.STORM_HOMEPAGE ?? "https://stormsoftware.com"}
|
|
39
|
-
Repository: ${process.env.STORM_REPOSITORY ?? `https://github.com/storm-software${
|
|
40
|
-
Documentation: ${process.env.STORM_DOCS ? process.env.STORM_DOCS : `https://stormsoftware.com/${
|
|
39
|
+
Repository: ${process.env.STORM_REPOSITORY ?? `https://github.com/storm-software${repositoryName ? `/${repositoryName}` : ""}`}
|
|
40
|
+
Documentation: ${process.env.STORM_DOCS ? process.env.STORM_DOCS : `https://stormsoftware.com/${repositoryName ? `projects/${repositoryName}/` : ""}docs`}
|
|
41
41
|
Contact: ${process.env.STORM_HOMEPAGE ? process.env.STORM_HOMEPAGE.endsWith("/") ? process.env.STORM_HOMEPAGE.slice(-1) : process.env.STORM_HOMEPAGE : "https://stormsoftware.com"}/contact
|
|
42
|
-
License: ${process.env.STORM_LICENSING ? process.env.STORM_LICENSING : `https://stormsoftware.com/${
|
|
42
|
+
License: ${process.env.STORM_LICENSING ? process.env.STORM_LICENSING : `https://stormsoftware.com/${repositoryName ? `projects/${repositoryName}/` : ""}license`}
|
|
43
43
|
|
|
44
44
|
------------------------------------------------------------------- `;
|
|
45
45
|
}, "getFileBanner");
|
package/dist/preset.d.ts
CHANGED
|
@@ -27,6 +27,6 @@ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsCon
|
|
|
27
27
|
* @param options - The preset options.
|
|
28
28
|
* @param userConfigs - Additional ESLint configurations.
|
|
29
29
|
*/
|
|
30
|
-
declare function getStormConfig(options: OptionsConfig & Omit<TypedFlatConfigItem, "files">, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<
|
|
30
|
+
declare function getStormConfig(options: OptionsConfig & Omit<TypedFlatConfigItem, "files">, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<object, string> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
31
31
|
|
|
32
32
|
export { type ResolvedOptions, getStormConfig as default, defaultPluginRenaming, getOverrides, getStormConfig, resolveSubOptions };
|
package/dist/preset.js
CHANGED
|
@@ -8,14 +8,11 @@ import {
|
|
|
8
8
|
} from "./chunk-7NZUDX62.js";
|
|
9
9
|
import {
|
|
10
10
|
getTsConfigPath
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-D3EN5HD2.js";
|
|
12
12
|
import {
|
|
13
13
|
banner_plugin_default
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import
|
|
16
|
-
joinPaths
|
|
17
|
-
} from "./chunk-G7QVU75O.js";
|
|
18
|
-
import "./chunk-KDHZD7SF.js";
|
|
14
|
+
} from "./chunk-VMGPCABA.js";
|
|
15
|
+
import "./chunk-ZUIV57VZ.js";
|
|
19
16
|
import {
|
|
20
17
|
GLOB_ASTRO,
|
|
21
18
|
GLOB_ASTRO_TS,
|
|
@@ -44,6 +41,12 @@ import {
|
|
|
44
41
|
GLOB_XML,
|
|
45
42
|
GLOB_YAML
|
|
46
43
|
} from "./chunk-AIKLBIPC.js";
|
|
44
|
+
import {
|
|
45
|
+
findWorkspaceRoot
|
|
46
|
+
} from "./chunk-7JRBTALJ.js";
|
|
47
|
+
import {
|
|
48
|
+
joinPaths
|
|
49
|
+
} from "./chunk-G7QVU75O.js";
|
|
47
50
|
import {
|
|
48
51
|
__name
|
|
49
52
|
} from "./chunk-SHUYVCID.js";
|
|
@@ -113,10 +116,6 @@ __name(astro, "astro");
|
|
|
113
116
|
import cspellConfig from "@cspell/eslint-plugin/recommended";
|
|
114
117
|
async function cspell(options = {}) {
|
|
115
118
|
const { configFile = "./.vscode/cspell.json", overrides = {} } = options;
|
|
116
|
-
let workspaceConfigFile = configFile;
|
|
117
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
118
|
-
workspaceConfigFile = joinPaths(process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH || "./", configFile);
|
|
119
|
-
}
|
|
120
119
|
return [
|
|
121
120
|
{
|
|
122
121
|
name: "storm/cspell/rules",
|
|
@@ -126,7 +125,7 @@ async function cspell(options = {}) {
|
|
|
126
125
|
"@cspell/spellchecker": [
|
|
127
126
|
"warn",
|
|
128
127
|
{
|
|
129
|
-
configFile:
|
|
128
|
+
configFile: joinPaths(findWorkspaceRoot(), configFile),
|
|
130
129
|
generateSuggestions: true,
|
|
131
130
|
numSuggestions: 10,
|
|
132
131
|
autoFix: true
|
|
@@ -853,7 +852,7 @@ __name(imports, "imports");
|
|
|
853
852
|
import defu2 from "defu";
|
|
854
853
|
import globalsLib from "globals";
|
|
855
854
|
async function javascript(options = {}) {
|
|
856
|
-
const { lineEndings = "unix", overrides = {},
|
|
855
|
+
const { lineEndings = "unix", overrides = {}, repositoryName, globals = {} } = options;
|
|
857
856
|
return [
|
|
858
857
|
{
|
|
859
858
|
name: "storm/javascript/setup",
|
|
@@ -890,8 +889,8 @@ async function javascript(options = {}) {
|
|
|
890
889
|
"error",
|
|
891
890
|
{
|
|
892
891
|
commentType: "block",
|
|
893
|
-
numNewlines:
|
|
894
|
-
repositoryName
|
|
892
|
+
numNewlines: 2,
|
|
893
|
+
repositoryName,
|
|
895
894
|
lineEndings
|
|
896
895
|
}
|
|
897
896
|
]
|
|
@@ -2423,6 +2422,7 @@ async function markdown(options = {}) {
|
|
|
2423
2422
|
name: "storm/markdown/disables",
|
|
2424
2423
|
rules: {
|
|
2425
2424
|
"import/newline-after-import": "off",
|
|
2425
|
+
"banner/banner": "off",
|
|
2426
2426
|
"no-alert": "off",
|
|
2427
2427
|
"no-console": "off",
|
|
2428
2428
|
"no-labels": "off",
|
|
@@ -2703,6 +2703,44 @@ async function perfectionist() {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
__name(perfectionist, "perfectionist");
|
|
2705
2705
|
|
|
2706
|
+
// src/configs/pnpm.ts
|
|
2707
|
+
async function pnpm(options = {}) {
|
|
2708
|
+
const { overrides = {} } = options;
|
|
2709
|
+
const [pluginPnpm, parserJsonc] = await Promise.all([
|
|
2710
|
+
interopDefault(import("eslint-plugin-pnpm")),
|
|
2711
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
2712
|
+
]);
|
|
2713
|
+
return [
|
|
2714
|
+
{
|
|
2715
|
+
name: "storm/pnpm/setup",
|
|
2716
|
+
plugins: {
|
|
2717
|
+
pnpm: pluginPnpm
|
|
2718
|
+
},
|
|
2719
|
+
ignores: [
|
|
2720
|
+
"**/node_modules/**",
|
|
2721
|
+
"**/dist/**"
|
|
2722
|
+
],
|
|
2723
|
+
files: [
|
|
2724
|
+
"package.json",
|
|
2725
|
+
"**/package.json"
|
|
2726
|
+
],
|
|
2727
|
+
languageOptions: {
|
|
2728
|
+
parser: parserJsonc
|
|
2729
|
+
}
|
|
2730
|
+
},
|
|
2731
|
+
{
|
|
2732
|
+
name: "storm/pnpm/rules",
|
|
2733
|
+
rules: {
|
|
2734
|
+
"pnpm/enforce-catalog": "error",
|
|
2735
|
+
"pnpm/valid-catalog": "error",
|
|
2736
|
+
"pnpm/prefer-workspace-settings": "error",
|
|
2737
|
+
...overrides
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
];
|
|
2741
|
+
}
|
|
2742
|
+
__name(pnpm, "pnpm");
|
|
2743
|
+
|
|
2706
2744
|
// src/configs/prettier.ts
|
|
2707
2745
|
import config from "eslint-config-prettier";
|
|
2708
2746
|
async function prettier() {
|
|
@@ -3412,11 +3450,7 @@ __name(toml, "toml");
|
|
|
3412
3450
|
|
|
3413
3451
|
// src/configs/typescript.ts
|
|
3414
3452
|
async function typescript(options = {}) {
|
|
3415
|
-
const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
|
|
3416
|
-
let tsconfigRootDir = process.cwd();
|
|
3417
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
3418
|
-
tsconfigRootDir = process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
|
|
3419
|
-
}
|
|
3453
|
+
const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, tsdoc = "warn", type = "app" } = options;
|
|
3420
3454
|
const files = options.files ?? [
|
|
3421
3455
|
GLOB_TS,
|
|
3422
3456
|
GLOB_TSX,
|
|
@@ -3430,10 +3464,8 @@ async function typescript(options = {}) {
|
|
|
3430
3464
|
`${GLOB_MARKDOWN}/**`,
|
|
3431
3465
|
GLOB_ASTRO_TS
|
|
3432
3466
|
];
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
tsconfigPath = getTsConfigPath();
|
|
3436
|
-
}
|
|
3467
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
3468
|
+
const tsconfigPath = getTsConfigPath(options?.tsconfigPath ?? workspaceRoot);
|
|
3437
3469
|
const isTypeAware = !!tsconfigPath;
|
|
3438
3470
|
const typeAwareRules = {
|
|
3439
3471
|
"dot-notation": "off",
|
|
@@ -3470,6 +3502,10 @@ async function typescript(options = {}) {
|
|
|
3470
3502
|
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
3471
3503
|
interopDefault(import("@typescript-eslint/parser"))
|
|
3472
3504
|
]);
|
|
3505
|
+
let pluginTsdoc;
|
|
3506
|
+
if (tsdoc !== false && tsdoc !== "off") {
|
|
3507
|
+
pluginTsdoc = await interopDefault(import("eslint-plugin-tsdoc"));
|
|
3508
|
+
}
|
|
3473
3509
|
function makeParser(typeAware, files2, ignores2) {
|
|
3474
3510
|
return {
|
|
3475
3511
|
files: files2,
|
|
@@ -3489,7 +3525,7 @@ async function typescript(options = {}) {
|
|
|
3489
3525
|
],
|
|
3490
3526
|
defaultProject: tsconfigPath
|
|
3491
3527
|
},
|
|
3492
|
-
tsconfigRootDir
|
|
3528
|
+
tsconfigRootDir: workspaceRoot
|
|
3493
3529
|
} : {},
|
|
3494
3530
|
...parserOptions
|
|
3495
3531
|
}
|
|
@@ -3660,6 +3696,16 @@ async function typescript(options = {}) {
|
|
|
3660
3696
|
...overrides
|
|
3661
3697
|
}
|
|
3662
3698
|
},
|
|
3699
|
+
pluginTsdoc && {
|
|
3700
|
+
files,
|
|
3701
|
+
name: "storm/typescript/rules-tsdoc",
|
|
3702
|
+
plugins: {
|
|
3703
|
+
tsdoc: pluginTsdoc
|
|
3704
|
+
},
|
|
3705
|
+
rules: {
|
|
3706
|
+
"tsdoc/syntax": tsdoc
|
|
3707
|
+
}
|
|
3708
|
+
},
|
|
3663
3709
|
...isTypeAware ? [
|
|
3664
3710
|
{
|
|
3665
3711
|
files: filesTypeAware,
|
|
@@ -3671,7 +3717,7 @@ async function typescript(options = {}) {
|
|
|
3671
3717
|
}
|
|
3672
3718
|
}
|
|
3673
3719
|
] : []
|
|
3674
|
-
];
|
|
3720
|
+
].filter(Boolean);
|
|
3675
3721
|
}
|
|
3676
3722
|
__name(typescript, "typescript");
|
|
3677
3723
|
|
|
@@ -3851,7 +3897,7 @@ function getOverrides(options, key) {
|
|
|
3851
3897
|
}
|
|
3852
3898
|
__name(getOverrides, "getOverrides");
|
|
3853
3899
|
function getStormConfig(options, ...userConfigs) {
|
|
3854
|
-
const {
|
|
3900
|
+
const { repositoryName, globals = {}, lineEndings = "unix", astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, jsx: enableJsx = true, cspell: enableCSpell = true, react: enableReact = false, "react-native": enableReactNative = false, regexp: enableRegexp = true, next: enableNext = false, graphql: enableGraphQL = false, storybook: enableStorybook = false, typescript: enableTypeScript = isPackageExists2("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false } = options;
|
|
3855
3901
|
let isInEditor = options.isInEditor;
|
|
3856
3902
|
if (isInEditor == null) {
|
|
3857
3903
|
isInEditor = isInEditorEnv();
|
|
@@ -3884,7 +3930,7 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
3884
3930
|
tsconfigPath = getTsConfigPath();
|
|
3885
3931
|
}
|
|
3886
3932
|
configs2.push(ignores(options.ignores), javascript({
|
|
3887
|
-
|
|
3933
|
+
repositoryName,
|
|
3888
3934
|
globals,
|
|
3889
3935
|
lineEndings,
|
|
3890
3936
|
isInEditor,
|
|
@@ -3967,6 +4013,11 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
3967
4013
|
stylistic: stylisticOptions
|
|
3968
4014
|
}));
|
|
3969
4015
|
}
|
|
4016
|
+
if (options.pnpm ?? true) {
|
|
4017
|
+
configs2.push(pnpm({
|
|
4018
|
+
overrides: getOverrides(options, "pnpm")
|
|
4019
|
+
}));
|
|
4020
|
+
}
|
|
3970
4021
|
if (options.jsonc ?? true) {
|
|
3971
4022
|
configs2.push(jsonc({
|
|
3972
4023
|
overrides: getOverrides(options, "jsonc"),
|
|
@@ -4007,7 +4058,9 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
4007
4058
|
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.');
|
|
4008
4059
|
}
|
|
4009
4060
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
4010
|
-
if (key in options)
|
|
4061
|
+
if (key in options) {
|
|
4062
|
+
acc[key] = options[key];
|
|
4063
|
+
}
|
|
4011
4064
|
return acc;
|
|
4012
4065
|
}, {});
|
|
4013
4066
|
if (Object.keys(fusedConfig).length) configs2.push([
|
package/dist/types.d.ts
CHANGED
|
@@ -3740,6 +3740,21 @@ Backward pagination arguments
|
|
|
3740
3740
|
* @see https://perfectionist.dev/rules/sort-variable-declarations
|
|
3741
3741
|
*/
|
|
3742
3742
|
'perfectionist/sort-variable-declarations'?: Linter.RuleEntry<PerfectionistSortVariableDeclarations>
|
|
3743
|
+
/**
|
|
3744
|
+
* Enforce using "catalog:" in `package.json`
|
|
3745
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/enforce-catalog.test.ts
|
|
3746
|
+
*/
|
|
3747
|
+
'pnpm/enforce-catalog'?: Linter.RuleEntry<PnpmEnforceCatalog>
|
|
3748
|
+
/**
|
|
3749
|
+
* Prefer having pnpm settings in `pnpm-workspace.yaml` instead of `package.json`. This would requires pnpm v10.6+, see https://github.com/orgs/pnpm/discussions/9037.
|
|
3750
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/prefer-workspace-settings.test.ts
|
|
3751
|
+
*/
|
|
3752
|
+
'pnpm/prefer-workspace-settings'?: Linter.RuleEntry<PnpmPreferWorkspaceSettings>
|
|
3753
|
+
/**
|
|
3754
|
+
* Enforce using valid catalog in `package.json`
|
|
3755
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/valid-catalog.test.ts
|
|
3756
|
+
*/
|
|
3757
|
+
'pnpm/valid-catalog'?: Linter.RuleEntry<PnpmValidCatalog>
|
|
3743
3758
|
/**
|
|
3744
3759
|
* Require using arrow functions for callbacks
|
|
3745
3760
|
* @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
|
|
@@ -6498,6 +6513,11 @@ Backward pagination arguments
|
|
|
6498
6513
|
* @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
6499
6514
|
*/
|
|
6500
6515
|
'ts/use-unknown-in-catch-callback-variable'?: Linter.RuleEntry<[]>
|
|
6516
|
+
/**
|
|
6517
|
+
* Validates that TypeScript documentation comments conform to the TSDoc standard
|
|
6518
|
+
* @see https://tsdoc.org/pages/packages/eslint-plugin-tsdoc
|
|
6519
|
+
*/
|
|
6520
|
+
'tsdoc/syntax'?: Linter.RuleEntry<[]>
|
|
6501
6521
|
/**
|
|
6502
6522
|
* Require or disallow Unicode byte order mark (BOM)
|
|
6503
6523
|
* @see https://eslint.org/docs/latest/rules/unicode-bom
|
|
@@ -12687,6 +12707,30 @@ type PerfectionistSortVariableDeclarations = []|[{
|
|
|
12687
12707
|
|
|
12688
12708
|
partitionByNewLine?: boolean
|
|
12689
12709
|
}]
|
|
12710
|
+
// ----- pnpm/enforce-catalog -----
|
|
12711
|
+
type PnpmEnforceCatalog = []|[{
|
|
12712
|
+
|
|
12713
|
+
allowedProtocols?: string[]
|
|
12714
|
+
|
|
12715
|
+
autofix?: boolean
|
|
12716
|
+
|
|
12717
|
+
defaultCatalog?: string
|
|
12718
|
+
|
|
12719
|
+
reuseExistingCatalog?: boolean
|
|
12720
|
+
}]
|
|
12721
|
+
// ----- pnpm/prefer-workspace-settings -----
|
|
12722
|
+
type PnpmPreferWorkspaceSettings = []|[{
|
|
12723
|
+
autofix?: boolean
|
|
12724
|
+
}]
|
|
12725
|
+
// ----- pnpm/valid-catalog -----
|
|
12726
|
+
type PnpmValidCatalog = []|[{
|
|
12727
|
+
|
|
12728
|
+
autoInsert?: boolean
|
|
12729
|
+
|
|
12730
|
+
autoInsertDefaultSpecifier?: string
|
|
12731
|
+
|
|
12732
|
+
autofix?: boolean
|
|
12733
|
+
}]
|
|
12690
12734
|
// ----- prefer-arrow-callback -----
|
|
12691
12735
|
type PreferArrowCallback = []|[{
|
|
12692
12736
|
allowNamedFunctions?: boolean
|
|
@@ -16285,7 +16329,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
16285
16329
|
onlyEquality?: boolean
|
|
16286
16330
|
}]
|
|
16287
16331
|
// Names of all the configs
|
|
16288
|
-
type ConfigNames = 'storm/cspell/rules' | 'storm/astro/setup' | 'storm/astro/rules' | 'storm/formatter/setup' | 'storm/imports/rules' | 'storm/graphql/setup' | 'storm/graphql/rules' | 'storm/graphql/relay' | 'storm/javascript/setup' | 'storm/javascript/banner' | 'storm/javascript/rules' | 'storm/jsx/rules' | 'storm/jsdoc/rules' | 'storm/jsonc/setup' | 'storm/jsonc/rules' | 'storm/markdown/setup' | 'storm/markdown/processor' | 'storm/markdown/parser' | 'storm/markdown/disables' | 'storm/mdx/setup' | 'storm/node/rules' | 'storm/nx/setup' | 'storm/nx/schema' | 'storm/nx/dependency-check' | 'storm/nx/module-boundaries' | 'storm/next/rules' | 'storm/prettier/rules' | 'storm/perfectionist/rules' | 'storm/react/setup' | 'storm/react/rules' | 'storm/react-native/rules' | 'storm/sort/package-json' | 'storm/stylistic/rules' | 'storm/secrets/rules' | 'storm/storybook/setup' | 'storm/storybook/rules' | 'storm/storybook/main' | 'storm/test/setup' | 'storm/test/rules' | 'storm/toml/setup' | 'storm/toml/rules' | 'storm/regexp/rules' | 'storm/typescript/setup' | 'storm/typescript/parser' | 'storm/typescript/type-aware-parser' | 'storm/typescript/rules' | 'storm/typescript/rules-type-aware' | 'storm/unicorn/rules' | 'storm/unocss' | 'storm/yaml/setup' | 'storm/yaml/rules'
|
|
16332
|
+
type ConfigNames = 'storm/cspell/rules' | 'storm/astro/setup' | 'storm/astro/rules' | 'storm/formatter/setup' | 'storm/imports/rules' | 'storm/graphql/setup' | 'storm/graphql/rules' | 'storm/graphql/relay' | 'storm/javascript/setup' | 'storm/javascript/banner' | 'storm/javascript/rules' | 'storm/jsx/rules' | 'storm/jsdoc/rules' | 'storm/jsonc/setup' | 'storm/jsonc/rules' | 'storm/markdown/setup' | 'storm/markdown/processor' | 'storm/markdown/parser' | 'storm/markdown/disables' | 'storm/mdx/setup' | 'storm/node/rules' | 'storm/nx/setup' | 'storm/nx/schema' | 'storm/nx/dependency-check' | 'storm/nx/module-boundaries' | 'storm/next/rules' | 'storm/prettier/rules' | 'storm/perfectionist/rules' | 'storm/pnpm/setup' | 'storm/pnpm/rules' | 'storm/react/setup' | 'storm/react/rules' | 'storm/react-native/rules' | 'storm/sort/package-json' | 'storm/stylistic/rules' | 'storm/secrets/rules' | 'storm/storybook/setup' | 'storm/storybook/rules' | 'storm/storybook/main' | 'storm/test/setup' | 'storm/test/rules' | 'storm/toml/setup' | 'storm/toml/rules' | 'storm/regexp/rules' | 'storm/typescript/setup' | 'storm/typescript/parser' | 'storm/typescript/type-aware-parser' | 'storm/typescript/rules' | 'storm/typescript/rules-tsdoc' | 'storm/typescript/rules-type-aware' | 'storm/unicorn/rules' | 'storm/unocss' | 'storm/yaml/setup' | 'storm/yaml/rules'
|
|
16289
16333
|
|
|
16290
16334
|
/**
|
|
16291
16335
|
* Vendor types from Prettier so we don't rely on the dependency.
|
|
@@ -16523,6 +16567,14 @@ interface OptionsTypeScriptWithTypes {
|
|
|
16523
16567
|
* Override type aware rules.
|
|
16524
16568
|
*/
|
|
16525
16569
|
overridesTypeAware?: TypedFlatConfigItem["rules"];
|
|
16570
|
+
/**
|
|
16571
|
+
* The rule to use for eslint-plugin-tsdoc syntax checking. If set to `false`, it will disable the plugin.
|
|
16572
|
+
*
|
|
16573
|
+
* @see https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
16574
|
+
*
|
|
16575
|
+
* @defaultValue 'warn'
|
|
16576
|
+
*/
|
|
16577
|
+
tsdoc?: "warn" | "error" | "off" | false;
|
|
16526
16578
|
}
|
|
16527
16579
|
interface OptionsHasTypeScript {
|
|
16528
16580
|
typescript?: boolean;
|
|
@@ -16770,7 +16822,7 @@ interface OptionsJavascript {
|
|
|
16770
16822
|
/**
|
|
16771
16823
|
* The name of the repository used in adding the banner comments
|
|
16772
16824
|
*/
|
|
16773
|
-
|
|
16825
|
+
repositoryName?: string;
|
|
16774
16826
|
/**
|
|
16775
16827
|
* An object containing a list of extra global variables to include in the configuration.
|
|
16776
16828
|
*/
|
|
@@ -16823,6 +16875,14 @@ interface OptionsConfig extends OptionsComponentExts, OptionsJavascript, Options
|
|
|
16823
16875
|
* Enable Nx monorepo support.
|
|
16824
16876
|
*/
|
|
16825
16877
|
nx?: OptionsNx;
|
|
16878
|
+
/**
|
|
16879
|
+
* Enable PNPM related rules.
|
|
16880
|
+
*
|
|
16881
|
+
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm
|
|
16882
|
+
*
|
|
16883
|
+
* @defaultValue true
|
|
16884
|
+
*/
|
|
16885
|
+
pnpm?: boolean | OptionsOverrides;
|
|
16826
16886
|
/**
|
|
16827
16887
|
* Enable JSX related rules.
|
|
16828
16888
|
*
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
3
|
+
*
|
|
4
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
5
|
+
* @returns The monorepo root directory
|
|
6
|
+
*/
|
|
7
|
+
declare function findWorkspaceRootSafe(pathInsideMonorepo?: string): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
10
|
+
*
|
|
11
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
12
|
+
* @returns The monorepo root directory
|
|
13
|
+
*/
|
|
14
|
+
declare function findWorkspaceRoot(pathInsideMonorepo?: string): string;
|
|
15
|
+
|
|
16
|
+
export { findWorkspaceRoot, findWorkspaceRootSafe };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a banner header to display at the top of a file
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
4
|
+
* @param repositoryName - The name to use in the display
|
|
5
5
|
* @returns The banner header
|
|
6
6
|
*/
|
|
7
|
-
declare const getFileBanner: (
|
|
7
|
+
declare const getFileBanner: (repositoryName?: string) => string;
|
|
8
8
|
|
|
9
9
|
export { getFileBanner };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_IGNORES
|
|
3
3
|
} from "../chunk-NXBMVNV2.js";
|
|
4
|
-
import {
|
|
5
|
-
formatConfig
|
|
6
|
-
} from "../chunk-FTXILLLE.js";
|
|
7
4
|
import {
|
|
8
5
|
ACRONYMS_LIST,
|
|
9
6
|
GLOB_ALL_SRC,
|
|
@@ -40,6 +37,9 @@ import {
|
|
|
40
37
|
GLOB_XML,
|
|
41
38
|
GLOB_YAML
|
|
42
39
|
} from "../chunk-AIKLBIPC.js";
|
|
40
|
+
import {
|
|
41
|
+
formatConfig
|
|
42
|
+
} from "../chunk-FTXILLLE.js";
|
|
43
43
|
import "../chunk-SHUYVCID.js";
|
|
44
44
|
export {
|
|
45
45
|
ACRONYMS_LIST,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/eslint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.139.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "⚡ A package containing the base ESLint configuration used by Storm Software across many projects.",
|
|
6
6
|
"repository": {
|
|
@@ -186,6 +186,7 @@
|
|
|
186
186
|
"eslint-plugin-no-secrets": "^2.2.1",
|
|
187
187
|
"eslint-plugin-paths": "^1.1.0",
|
|
188
188
|
"eslint-plugin-perfectionist": "^4.9.0",
|
|
189
|
+
"eslint-plugin-pnpm": "^0.1.2",
|
|
189
190
|
"eslint-plugin-prettier": "^5.2.3",
|
|
190
191
|
"eslint-plugin-regexp": "^2.7.0",
|
|
191
192
|
"eslint-plugin-toml": "^0.12.0",
|