@storm-software/eslint 0.170.155 → 0.170.156
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.cjs +12 -21953
- package/dist/index.js +3 -11
- package/dist/preset.cjs +81 -21649
- package/dist/preset.js +344 -8
- package/dist/types.cjs +10 -0
- package/dist/types.js +1 -4
- package/dist/utils/combine.cjs +0 -1
- package/dist/utils/combine.js +0 -4
- package/dist/utils/correct-paths.cjs +19 -20
- package/dist/utils/correct-paths.js +216 -2
- package/dist/utils/find-workspace-root.cjs +12 -117
- package/dist/utils/find-workspace-root.js +93 -3
- package/dist/utils/format-config.cjs +1 -2
- package/dist/utils/format-config.js +1 -5
- package/dist/utils/helpers.cjs +5 -6
- package/dist/utils/helpers.js +72 -2
- package/dist/utils/package-manager.cjs +6 -187
- package/dist/utils/package-manager.js +16 -4
- package/dist/utils/tsconfig.cjs +14 -268
- package/dist/utils/tsconfig.js +40 -4
- package/package.json +10 -10
- package/dist/chunk-2TYJ2VM7.js +0 -46
- package/dist/chunk-F7ZJ6N35.js +0 -43
- package/dist/chunk-I4ZWVHOG.js +0 -220
- package/dist/chunk-JBIA43L4.js +0 -75
- package/dist/chunk-T6GDWDAB.js +0 -167
- package/dist/chunk-XFFMMX6A.js +0 -96
- package/dist/chunk-XSM4AYON.js +0 -19822
- package/dist/chunk-Y5JY2DPL.js +0 -19
- package/dist/src-TAWYAYRW.js +0 -887
- package/dist/src-XRFRLUCW.js +0 -57
- package/dist/src-YPCQHGJY.js +0 -91
|
@@ -1,196 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var node_fs = require('node:fs');
|
|
4
|
+
var node_path = require('node:path');
|
|
5
|
+
var findWorkspaceRoot = require('./find-workspace-root');
|
|
5
6
|
|
|
6
|
-
// src/utils/package-manager.ts
|
|
7
|
-
|
|
8
|
-
// src/utils/correct-paths.ts
|
|
9
|
-
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
10
|
-
function normalizeWindowsPath(input = "") {
|
|
11
|
-
if (!input) {
|
|
12
|
-
return input;
|
|
13
|
-
}
|
|
14
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
15
|
-
}
|
|
16
|
-
var _UNC_REGEX = /^[/\\]{2}/;
|
|
17
|
-
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
18
|
-
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
19
|
-
var correctPaths = function(path) {
|
|
20
|
-
if (!path || path.length === 0) {
|
|
21
|
-
return ".";
|
|
22
|
-
}
|
|
23
|
-
path = normalizeWindowsPath(path);
|
|
24
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
|
25
|
-
const isPathAbsolute = isAbsolute(path);
|
|
26
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
|
27
|
-
path = normalizeString(path, !isPathAbsolute);
|
|
28
|
-
if (path.length === 0) {
|
|
29
|
-
if (isPathAbsolute) {
|
|
30
|
-
return "/";
|
|
31
|
-
}
|
|
32
|
-
return trailingSeparator ? "./" : ".";
|
|
33
|
-
}
|
|
34
|
-
if (trailingSeparator) {
|
|
35
|
-
path += "/";
|
|
36
|
-
}
|
|
37
|
-
if (_DRIVE_LETTER_RE.test(path)) {
|
|
38
|
-
path += "/";
|
|
39
|
-
}
|
|
40
|
-
if (isUNCPath) {
|
|
41
|
-
if (!isPathAbsolute) {
|
|
42
|
-
return `//./${path}`;
|
|
43
|
-
}
|
|
44
|
-
return `//${path}`;
|
|
45
|
-
}
|
|
46
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
47
|
-
};
|
|
48
|
-
function normalizeString(path, allowAboveRoot) {
|
|
49
|
-
let res = "";
|
|
50
|
-
let lastSegmentLength = 0;
|
|
51
|
-
let lastSlash = -1;
|
|
52
|
-
let dots = 0;
|
|
53
|
-
let char = null;
|
|
54
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
55
|
-
if (index < path.length) {
|
|
56
|
-
char = path[index];
|
|
57
|
-
} else if (char === "/") {
|
|
58
|
-
break;
|
|
59
|
-
} else {
|
|
60
|
-
char = "/";
|
|
61
|
-
}
|
|
62
|
-
if (char === "/") {
|
|
63
|
-
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
|
|
64
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
65
|
-
if (res.length > 2) {
|
|
66
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
67
|
-
if (lastSlashIndex === -1) {
|
|
68
|
-
res = "";
|
|
69
|
-
lastSegmentLength = 0;
|
|
70
|
-
} else {
|
|
71
|
-
res = res.slice(0, lastSlashIndex);
|
|
72
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
73
|
-
}
|
|
74
|
-
lastSlash = index;
|
|
75
|
-
dots = 0;
|
|
76
|
-
continue;
|
|
77
|
-
} else if (res.length > 0) {
|
|
78
|
-
res = "";
|
|
79
|
-
lastSegmentLength = 0;
|
|
80
|
-
lastSlash = index;
|
|
81
|
-
dots = 0;
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (allowAboveRoot) {
|
|
86
|
-
res += res.length > 0 ? "/.." : "..";
|
|
87
|
-
lastSegmentLength = 2;
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
if (res.length > 0) {
|
|
91
|
-
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
92
|
-
} else {
|
|
93
|
-
res = path.slice(lastSlash + 1, index);
|
|
94
|
-
}
|
|
95
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
96
|
-
}
|
|
97
|
-
lastSlash = index;
|
|
98
|
-
dots = 0;
|
|
99
|
-
} else if (char === "." && dots !== -1) {
|
|
100
|
-
++dots;
|
|
101
|
-
} else {
|
|
102
|
-
dots = -1;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return res;
|
|
106
|
-
}
|
|
107
|
-
var isAbsolute = function(p) {
|
|
108
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// src/utils/find-workspace-root.ts
|
|
112
|
-
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
113
|
-
var depth = 0;
|
|
114
|
-
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
115
|
-
const _startPath = startPath ?? process.cwd();
|
|
116
|
-
if (endDirectoryNames.some(
|
|
117
|
-
(endDirName) => fs.existsSync(path.join(_startPath, endDirName))
|
|
118
|
-
)) {
|
|
119
|
-
return _startPath;
|
|
120
|
-
}
|
|
121
|
-
if (endFileNames.some((endFileName) => fs.existsSync(path.join(_startPath, endFileName)))) {
|
|
122
|
-
return _startPath;
|
|
123
|
-
}
|
|
124
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
125
|
-
const parent = path.join(_startPath, "..");
|
|
126
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
127
|
-
}
|
|
128
|
-
return void 0;
|
|
129
|
-
}
|
|
130
|
-
var rootFiles = [
|
|
131
|
-
"storm-workspace.json",
|
|
132
|
-
"storm-workspace.json",
|
|
133
|
-
"storm-workspace.yaml",
|
|
134
|
-
"storm-workspace.yml",
|
|
135
|
-
"storm-workspace.js",
|
|
136
|
-
"storm-workspace.ts",
|
|
137
|
-
".storm-workspace.json",
|
|
138
|
-
".storm-workspace.yaml",
|
|
139
|
-
".storm-workspace.yml",
|
|
140
|
-
".storm-workspace.js",
|
|
141
|
-
".storm-workspace.ts",
|
|
142
|
-
"lerna.json",
|
|
143
|
-
"nx.json",
|
|
144
|
-
"turbo.json",
|
|
145
|
-
"npm-workspace.json",
|
|
146
|
-
"yarn-workspace.json",
|
|
147
|
-
"pnpm-workspace.json",
|
|
148
|
-
"npm-workspace.yaml",
|
|
149
|
-
"yarn-workspace.yaml",
|
|
150
|
-
"pnpm-workspace.yaml",
|
|
151
|
-
"npm-workspace.yml",
|
|
152
|
-
"yarn-workspace.yml",
|
|
153
|
-
"pnpm-workspace.yml",
|
|
154
|
-
"npm-lock.json",
|
|
155
|
-
"yarn-lock.json",
|
|
156
|
-
"pnpm-lock.json",
|
|
157
|
-
"npm-lock.yaml",
|
|
158
|
-
"yarn-lock.yaml",
|
|
159
|
-
"pnpm-lock.yaml",
|
|
160
|
-
"npm-lock.yml",
|
|
161
|
-
"yarn-lock.yml",
|
|
162
|
-
"pnpm-lock.yml",
|
|
163
|
-
"bun.lockb"
|
|
164
|
-
];
|
|
165
|
-
var rootDirectories = [
|
|
166
|
-
".storm-workspace",
|
|
167
|
-
".nx",
|
|
168
|
-
".github",
|
|
169
|
-
".vscode",
|
|
170
|
-
".verdaccio"
|
|
171
|
-
];
|
|
172
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
173
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
174
|
-
return correctPaths(
|
|
175
|
-
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
return correctPaths(
|
|
179
|
-
findFolderUp(
|
|
180
|
-
process.cwd(),
|
|
181
|
-
rootFiles,
|
|
182
|
-
rootDirectories
|
|
183
|
-
)
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// src/utils/package-manager.ts
|
|
188
7
|
function detectPackageManager() {
|
|
189
|
-
const workspaceRoot = findWorkspaceRootSafe() ?? process.cwd();
|
|
190
|
-
if (
|
|
8
|
+
const workspaceRoot = findWorkspaceRoot.findWorkspaceRootSafe() ?? process.cwd();
|
|
9
|
+
if (node_fs.existsSync(node_path.join(workspaceRoot, "bun.lockb")) || node_fs.existsSync(node_path.join(workspaceRoot, "bun.lock")) || node_fs.existsSync(node_path.join(workspaceRoot, "bunfig.toml")) || node_fs.existsSync(node_path.join(workspaceRoot, "bunfig.yml"))) {
|
|
191
10
|
return "bun";
|
|
192
11
|
}
|
|
193
|
-
if (
|
|
12
|
+
if (node_fs.existsSync(node_path.join(workspaceRoot, "pnpm-lock.yaml")) || node_fs.existsSync(node_path.join(workspaceRoot, "pnpm-lock.yml")) || node_fs.existsSync(node_path.join(workspaceRoot, "pnpm-workpace.yaml"))) {
|
|
194
13
|
return "pnpm";
|
|
195
14
|
}
|
|
196
15
|
return "npm";
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { findWorkspaceRootSafe } from './find-workspace-root';
|
|
4
|
+
|
|
5
|
+
function detectPackageManager() {
|
|
6
|
+
const workspaceRoot = findWorkspaceRootSafe() ?? process.cwd();
|
|
7
|
+
if (existsSync(join(workspaceRoot, "bun.lockb")) || existsSync(join(workspaceRoot, "bun.lock")) || existsSync(join(workspaceRoot, "bunfig.toml")) || existsSync(join(workspaceRoot, "bunfig.yml"))) {
|
|
8
|
+
return "bun";
|
|
9
|
+
}
|
|
10
|
+
if (existsSync(join(workspaceRoot, "pnpm-lock.yaml")) || existsSync(join(workspaceRoot, "pnpm-lock.yml")) || existsSync(join(workspaceRoot, "pnpm-workpace.yaml"))) {
|
|
11
|
+
return "pnpm";
|
|
12
|
+
}
|
|
13
|
+
return "npm";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { detectPackageManager };
|
package/dist/utils/tsconfig.cjs
CHANGED
|
@@ -1,275 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var node_fs = require('node:fs');
|
|
4
|
+
var correctPaths = require('./correct-paths');
|
|
5
|
+
var findWorkspaceRoot = require('./find-workspace-root');
|
|
5
6
|
|
|
6
|
-
// src/utils/tsconfig.ts
|
|
7
|
-
|
|
8
|
-
// src/utils/correct-paths.ts
|
|
9
|
-
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
10
|
-
function normalizeWindowsPath(input = "") {
|
|
11
|
-
if (!input) {
|
|
12
|
-
return input;
|
|
13
|
-
}
|
|
14
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
15
|
-
}
|
|
16
|
-
var _UNC_REGEX = /^[/\\]{2}/;
|
|
17
|
-
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
18
|
-
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
19
|
-
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
20
|
-
var correctPaths = function(path) {
|
|
21
|
-
if (!path || path.length === 0) {
|
|
22
|
-
return ".";
|
|
23
|
-
}
|
|
24
|
-
path = normalizeWindowsPath(path);
|
|
25
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
|
26
|
-
const isPathAbsolute = isAbsolute(path);
|
|
27
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
|
28
|
-
path = normalizeString(path, !isPathAbsolute);
|
|
29
|
-
if (path.length === 0) {
|
|
30
|
-
if (isPathAbsolute) {
|
|
31
|
-
return "/";
|
|
32
|
-
}
|
|
33
|
-
return trailingSeparator ? "./" : ".";
|
|
34
|
-
}
|
|
35
|
-
if (trailingSeparator) {
|
|
36
|
-
path += "/";
|
|
37
|
-
}
|
|
38
|
-
if (_DRIVE_LETTER_RE.test(path)) {
|
|
39
|
-
path += "/";
|
|
40
|
-
}
|
|
41
|
-
if (isUNCPath) {
|
|
42
|
-
if (!isPathAbsolute) {
|
|
43
|
-
return `//./${path}`;
|
|
44
|
-
}
|
|
45
|
-
return `//${path}`;
|
|
46
|
-
}
|
|
47
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
48
|
-
};
|
|
49
|
-
var joinPaths = function(...segments) {
|
|
50
|
-
let path = "";
|
|
51
|
-
for (const seg of segments) {
|
|
52
|
-
if (!seg) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (path.length > 0) {
|
|
56
|
-
const pathTrailing = path[path.length - 1] === "/";
|
|
57
|
-
const segLeading = seg[0] === "/";
|
|
58
|
-
const both = pathTrailing && segLeading;
|
|
59
|
-
if (both) {
|
|
60
|
-
path += seg.slice(1);
|
|
61
|
-
} else {
|
|
62
|
-
path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
path += seg;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return correctPaths(path);
|
|
69
|
-
};
|
|
70
|
-
function cwd() {
|
|
71
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
72
|
-
return process.cwd().replace(/\\/g, "/");
|
|
73
|
-
}
|
|
74
|
-
return "/";
|
|
75
|
-
}
|
|
76
|
-
var resolve = function(...arguments_) {
|
|
77
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
78
|
-
let resolvedPath = "";
|
|
79
|
-
let resolvedAbsolute = false;
|
|
80
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
81
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
|
82
|
-
if (!path || path.length === 0) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
|
86
|
-
resolvedAbsolute = isAbsolute(path);
|
|
87
|
-
}
|
|
88
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
89
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
90
|
-
return `/${resolvedPath}`;
|
|
91
|
-
}
|
|
92
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
93
|
-
};
|
|
94
|
-
function normalizeString(path, allowAboveRoot) {
|
|
95
|
-
let res = "";
|
|
96
|
-
let lastSegmentLength = 0;
|
|
97
|
-
let lastSlash = -1;
|
|
98
|
-
let dots = 0;
|
|
99
|
-
let char = null;
|
|
100
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
101
|
-
if (index < path.length) {
|
|
102
|
-
char = path[index];
|
|
103
|
-
} else if (char === "/") {
|
|
104
|
-
break;
|
|
105
|
-
} else {
|
|
106
|
-
char = "/";
|
|
107
|
-
}
|
|
108
|
-
if (char === "/") {
|
|
109
|
-
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
|
|
110
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
111
|
-
if (res.length > 2) {
|
|
112
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
113
|
-
if (lastSlashIndex === -1) {
|
|
114
|
-
res = "";
|
|
115
|
-
lastSegmentLength = 0;
|
|
116
|
-
} else {
|
|
117
|
-
res = res.slice(0, lastSlashIndex);
|
|
118
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
119
|
-
}
|
|
120
|
-
lastSlash = index;
|
|
121
|
-
dots = 0;
|
|
122
|
-
continue;
|
|
123
|
-
} else if (res.length > 0) {
|
|
124
|
-
res = "";
|
|
125
|
-
lastSegmentLength = 0;
|
|
126
|
-
lastSlash = index;
|
|
127
|
-
dots = 0;
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (allowAboveRoot) {
|
|
132
|
-
res += res.length > 0 ? "/.." : "..";
|
|
133
|
-
lastSegmentLength = 2;
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
if (res.length > 0) {
|
|
137
|
-
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
138
|
-
} else {
|
|
139
|
-
res = path.slice(lastSlash + 1, index);
|
|
140
|
-
}
|
|
141
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
142
|
-
}
|
|
143
|
-
lastSlash = index;
|
|
144
|
-
dots = 0;
|
|
145
|
-
} else if (char === "." && dots !== -1) {
|
|
146
|
-
++dots;
|
|
147
|
-
} else {
|
|
148
|
-
dots = -1;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return res;
|
|
152
|
-
}
|
|
153
|
-
var isAbsolute = function(p) {
|
|
154
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
155
|
-
};
|
|
156
|
-
var relative = function(from, to) {
|
|
157
|
-
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
158
|
-
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
159
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
160
|
-
return _to.join("/");
|
|
161
|
-
}
|
|
162
|
-
const _fromCopy = [..._from];
|
|
163
|
-
for (const segment of _fromCopy) {
|
|
164
|
-
if (_to[0] !== segment) {
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
_from.shift();
|
|
168
|
-
_to.shift();
|
|
169
|
-
}
|
|
170
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
171
|
-
};
|
|
172
|
-
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
173
|
-
var depth = 0;
|
|
174
|
-
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
175
|
-
const _startPath = startPath ?? process.cwd();
|
|
176
|
-
if (endDirectoryNames.some(
|
|
177
|
-
(endDirName) => fs.existsSync(path.join(_startPath, endDirName))
|
|
178
|
-
)) {
|
|
179
|
-
return _startPath;
|
|
180
|
-
}
|
|
181
|
-
if (endFileNames.some((endFileName) => fs.existsSync(path.join(_startPath, endFileName)))) {
|
|
182
|
-
return _startPath;
|
|
183
|
-
}
|
|
184
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
185
|
-
const parent = path.join(_startPath, "..");
|
|
186
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
187
|
-
}
|
|
188
|
-
return void 0;
|
|
189
|
-
}
|
|
190
|
-
var rootFiles = [
|
|
191
|
-
"storm-workspace.json",
|
|
192
|
-
"storm-workspace.json",
|
|
193
|
-
"storm-workspace.yaml",
|
|
194
|
-
"storm-workspace.yml",
|
|
195
|
-
"storm-workspace.js",
|
|
196
|
-
"storm-workspace.ts",
|
|
197
|
-
".storm-workspace.json",
|
|
198
|
-
".storm-workspace.yaml",
|
|
199
|
-
".storm-workspace.yml",
|
|
200
|
-
".storm-workspace.js",
|
|
201
|
-
".storm-workspace.ts",
|
|
202
|
-
"lerna.json",
|
|
203
|
-
"nx.json",
|
|
204
|
-
"turbo.json",
|
|
205
|
-
"npm-workspace.json",
|
|
206
|
-
"yarn-workspace.json",
|
|
207
|
-
"pnpm-workspace.json",
|
|
208
|
-
"npm-workspace.yaml",
|
|
209
|
-
"yarn-workspace.yaml",
|
|
210
|
-
"pnpm-workspace.yaml",
|
|
211
|
-
"npm-workspace.yml",
|
|
212
|
-
"yarn-workspace.yml",
|
|
213
|
-
"pnpm-workspace.yml",
|
|
214
|
-
"npm-lock.json",
|
|
215
|
-
"yarn-lock.json",
|
|
216
|
-
"pnpm-lock.json",
|
|
217
|
-
"npm-lock.yaml",
|
|
218
|
-
"yarn-lock.yaml",
|
|
219
|
-
"pnpm-lock.yaml",
|
|
220
|
-
"npm-lock.yml",
|
|
221
|
-
"yarn-lock.yml",
|
|
222
|
-
"pnpm-lock.yml",
|
|
223
|
-
"bun.lockb"
|
|
224
|
-
];
|
|
225
|
-
var rootDirectories = [
|
|
226
|
-
".storm-workspace",
|
|
227
|
-
".nx",
|
|
228
|
-
".github",
|
|
229
|
-
".vscode",
|
|
230
|
-
".verdaccio"
|
|
231
|
-
];
|
|
232
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
233
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
234
|
-
return correctPaths(
|
|
235
|
-
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
return correctPaths(
|
|
239
|
-
findFolderUp(
|
|
240
|
-
process.cwd(),
|
|
241
|
-
rootFiles,
|
|
242
|
-
rootDirectories
|
|
243
|
-
)
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
247
|
-
const result = findWorkspaceRootSafe();
|
|
248
|
-
if (!result) {
|
|
249
|
-
throw new Error(
|
|
250
|
-
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
251
|
-
${rootFiles.join(
|
|
252
|
-
"\n"
|
|
253
|
-
)}
|
|
254
|
-
Path: ${process.cwd()}`
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
return result;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// src/utils/tsconfig.ts
|
|
261
7
|
function getTsConfigPath(tsconfigPath, type) {
|
|
262
|
-
const workspaceRoot = findWorkspaceRoot();
|
|
263
|
-
if (tsconfigPath &&
|
|
264
|
-
return relative(workspaceRoot, tsconfigPath);
|
|
8
|
+
const workspaceRoot = findWorkspaceRoot.findWorkspaceRoot();
|
|
9
|
+
if (tsconfigPath && node_fs.existsSync(tsconfigPath) && node_fs.statSync(tsconfigPath).isFile()) {
|
|
10
|
+
return correctPaths.relative(workspaceRoot, tsconfigPath);
|
|
265
11
|
}
|
|
266
12
|
let result = checkTsConfigPath(process.cwd());
|
|
267
13
|
if (result) {
|
|
268
|
-
return relative(workspaceRoot, joinPaths(process.cwd(), result));
|
|
14
|
+
return correctPaths.relative(workspaceRoot, correctPaths.joinPaths(process.cwd(), result));
|
|
269
15
|
}
|
|
270
16
|
result = checkTsConfigPath(workspaceRoot);
|
|
271
17
|
if (result) {
|
|
272
|
-
return relative(workspaceRoot, joinPaths(workspaceRoot, result));
|
|
18
|
+
return correctPaths.relative(workspaceRoot, correctPaths.joinPaths(workspaceRoot, result));
|
|
273
19
|
}
|
|
274
20
|
console.warn(
|
|
275
21
|
`No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
@@ -277,17 +23,17 @@ function getTsConfigPath(tsconfigPath, type) {
|
|
|
277
23
|
return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : type ? `tsconfig.${type}.json` : "tsconfig.json";
|
|
278
24
|
}
|
|
279
25
|
function checkTsConfigPath(root) {
|
|
280
|
-
if (
|
|
26
|
+
if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.json"))) {
|
|
281
27
|
return "tsconfig.json";
|
|
282
|
-
} else if (
|
|
28
|
+
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.base.json"))) {
|
|
283
29
|
return "tsconfig.base.json";
|
|
284
|
-
} else if (
|
|
30
|
+
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.app.json"))) {
|
|
285
31
|
return "tsconfig.app.json";
|
|
286
|
-
} else if (
|
|
32
|
+
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.lib.json"))) {
|
|
287
33
|
return "tsconfig.lib.json";
|
|
288
|
-
} else if (
|
|
34
|
+
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.eslint.json"))) {
|
|
289
35
|
return "tsconfig.eslint.json";
|
|
290
|
-
} else if (
|
|
36
|
+
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.lint.json"))) {
|
|
291
37
|
return "tsconfig.lint.json";
|
|
292
38
|
}
|
|
293
39
|
return void 0;
|
package/dist/utils/tsconfig.js
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
|
|
1
|
+
import { existsSync, statSync } from 'node:fs';
|
|
2
|
+
import { relative, joinPaths } from './correct-paths';
|
|
3
|
+
import { findWorkspaceRoot } from './find-workspace-root';
|
|
4
|
+
|
|
5
|
+
function getTsConfigPath(tsconfigPath, type) {
|
|
6
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
7
|
+
if (tsconfigPath && existsSync(tsconfigPath) && statSync(tsconfigPath).isFile()) {
|
|
8
|
+
return relative(workspaceRoot, tsconfigPath);
|
|
9
|
+
}
|
|
10
|
+
let result = checkTsConfigPath(process.cwd());
|
|
11
|
+
if (result) {
|
|
12
|
+
return relative(workspaceRoot, joinPaths(process.cwd(), result));
|
|
13
|
+
}
|
|
14
|
+
result = checkTsConfigPath(workspaceRoot);
|
|
15
|
+
if (result) {
|
|
16
|
+
return relative(workspaceRoot, joinPaths(workspaceRoot, result));
|
|
17
|
+
}
|
|
18
|
+
console.warn(
|
|
19
|
+
`No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
20
|
+
);
|
|
21
|
+
return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : type ? `tsconfig.${type}.json` : "tsconfig.json";
|
|
22
|
+
}
|
|
23
|
+
function checkTsConfigPath(root) {
|
|
24
|
+
if (existsSync(joinPaths(root, "tsconfig.json"))) {
|
|
25
|
+
return "tsconfig.json";
|
|
26
|
+
} else if (existsSync(joinPaths(root, "tsconfig.base.json"))) {
|
|
27
|
+
return "tsconfig.base.json";
|
|
28
|
+
} else if (existsSync(joinPaths(root, "tsconfig.app.json"))) {
|
|
29
|
+
return "tsconfig.app.json";
|
|
30
|
+
} else if (existsSync(joinPaths(root, "tsconfig.lib.json"))) {
|
|
31
|
+
return "tsconfig.lib.json";
|
|
32
|
+
} else if (existsSync(joinPaths(root, "tsconfig.eslint.json"))) {
|
|
33
|
+
return "tsconfig.eslint.json";
|
|
34
|
+
} else if (existsSync(joinPaths(root, "tsconfig.lint.json"))) {
|
|
35
|
+
return "tsconfig.lint.json";
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { checkTsConfigPath, getTsConfigPath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/eslint",
|
|
3
|
-
"version": "0.170.
|
|
3
|
+
"version": "0.170.156",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the base ESLint configuration used by Storm Software across many projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -129,9 +129,11 @@
|
|
|
129
129
|
"@eslint/eslintrc": "^3.3.6",
|
|
130
130
|
"@eslint/markdown": "^6.6.0",
|
|
131
131
|
"@nx/eslint-plugin": "23.1.1",
|
|
132
|
-
"@storm-software/config": "1.138.
|
|
133
|
-
"@storm-software/config-tools": "1.190.
|
|
134
|
-
"@storm-software/
|
|
132
|
+
"@storm-software/config": "1.138.59",
|
|
133
|
+
"@storm-software/config-tools": "1.190.122",
|
|
134
|
+
"@storm-software/eslint-plugin-banner": "0.0.87",
|
|
135
|
+
"@storm-software/eslint-plugin-tsdoc": "0.0.85",
|
|
136
|
+
"@storm-software/package-constants": "0.1.135",
|
|
135
137
|
"@stylistic/eslint-plugin": "^4.4.1",
|
|
136
138
|
"@typescript-eslint/eslint-plugin": "^8.66.0",
|
|
137
139
|
"@typescript-eslint/parser": "^8.66.0",
|
|
@@ -187,11 +189,9 @@
|
|
|
187
189
|
"@next/eslint-plugin-next": "^15.5.23",
|
|
188
190
|
"@nx/eslint": "23.1.1",
|
|
189
191
|
"@prettier/plugin-xml": "^3.4.2",
|
|
190
|
-
"@storm-software/eslint-plugin-
|
|
191
|
-
"@storm-software/eslint-plugin-
|
|
192
|
-
"@storm-software/
|
|
193
|
-
"@storm-software/eslint-plugin-tsdoc": "0.0.84",
|
|
194
|
-
"@storm-software/tsdoc": "0.13.274",
|
|
192
|
+
"@storm-software/eslint-plugin-bun": "0.0.10",
|
|
193
|
+
"@storm-software/eslint-plugin-pnpm": "0.0.85",
|
|
194
|
+
"@storm-software/tsdoc": "0.13.275",
|
|
195
195
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
196
196
|
"@types/eslint": "^9.6.1",
|
|
197
197
|
"@types/eslint__js": "^8.42.3",
|
|
@@ -289,5 +289,5 @@
|
|
|
289
289
|
"zod": { "optional": true }
|
|
290
290
|
},
|
|
291
291
|
"publishConfig": { "access": "public" },
|
|
292
|
-
"gitHead": "
|
|
292
|
+
"gitHead": "0be9a37f594450158c976638a8d496232ba3178a"
|
|
293
293
|
}
|
package/dist/chunk-2TYJ2VM7.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'url';
|
|
2
|
-
import 'path';
|
|
3
|
-
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
12
|
-
}) : x)(function(x) {
|
|
13
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
|
-
});
|
|
16
|
-
var __esm = (fn, res) => function __init() {
|
|
17
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
-
};
|
|
19
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
20
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
21
|
-
};
|
|
22
|
-
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (let key of __getOwnPropNames(from))
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
-
}
|
|
28
|
-
return to;
|
|
29
|
-
};
|
|
30
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
-
mod
|
|
37
|
-
));
|
|
38
|
-
var getFilename, __filename$1;
|
|
39
|
-
var init_esm_shims = __esm({
|
|
40
|
-
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=a9def7e06ce25c19654987ab91979289197bf4d3e7e124c514a4487c3e8d68c6__c60dfe8a33249c9fe1a3f42b452f3236/node_modules/tsup/assets/esm_shims.js"() {
|
|
41
|
-
getFilename = () => fileURLToPath(import.meta.url);
|
|
42
|
-
__filename$1 = /* @__PURE__ */ getFilename();
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export { __commonJS, __filename$1 as __filename, __require, __toESM, init_esm_shims };
|