@storm-software/eslint 0.169.101 → 0.169.102
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/dist/chunk-O72R6YEJ.js +43 -0
- package/dist/preset.cjs +75 -27
- package/dist/preset.js +4 -12
- package/dist/utils/tsconfig-path.cjs +161 -16
- package/dist/utils/tsconfig-path.d.cts +3 -2
- package/dist/utils/tsconfig-path.d.ts +3 -2
- package/dist/utils/tsconfig-path.js +2 -1
- package/package.json +4 -4
- package/dist/chunk-DJ2ZXQYV.js +0 -27
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { findWorkspaceRoot } from './chunk-UVJN4TQE.js';
|
|
2
|
+
import { relative, joinPaths } from './chunk-T4LUMNGJ.js';
|
|
3
|
+
import { init_esm_shims } from './chunk-PWQ34SJ2.js';
|
|
4
|
+
import { existsSync, statSync } from 'node:fs';
|
|
5
|
+
|
|
6
|
+
// src/utils/tsconfig-path.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
function getTsConfigPath(tsconfigPath, type = "app") {
|
|
9
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
10
|
+
if (tsconfigPath && existsSync(tsconfigPath) && statSync(tsconfigPath).isFile()) {
|
|
11
|
+
return relative(workspaceRoot, tsconfigPath);
|
|
12
|
+
}
|
|
13
|
+
let result = checkTsConfigPath(process.cwd());
|
|
14
|
+
if (result) {
|
|
15
|
+
return relative(workspaceRoot, joinPaths(process.cwd(), result));
|
|
16
|
+
}
|
|
17
|
+
result = checkTsConfigPath(workspaceRoot);
|
|
18
|
+
if (result) {
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
console.warn(
|
|
22
|
+
`No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
23
|
+
);
|
|
24
|
+
return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
|
|
25
|
+
}
|
|
26
|
+
function checkTsConfigPath(root) {
|
|
27
|
+
if (existsSync(joinPaths(root, "tsconfig.json"))) {
|
|
28
|
+
return "tsconfig.json";
|
|
29
|
+
} else if (existsSync(joinPaths(root, "tsconfig.base.json"))) {
|
|
30
|
+
return "tsconfig.base.json";
|
|
31
|
+
} else if (existsSync(joinPaths(root, "tsconfig.app.json"))) {
|
|
32
|
+
return "tsconfig.app.json";
|
|
33
|
+
} else if (existsSync(joinPaths(root, "tsconfig.lib.json"))) {
|
|
34
|
+
return "tsconfig.lib.json";
|
|
35
|
+
} else if (existsSync(joinPaths(root, "tsconfig.eslint.json"))) {
|
|
36
|
+
return "tsconfig.eslint.json";
|
|
37
|
+
} else if (existsSync(joinPaths(root, "tsconfig.lint.json"))) {
|
|
38
|
+
return "tsconfig.lint.json";
|
|
39
|
+
}
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { checkTsConfigPath, getTsConfigPath };
|
package/dist/preset.cjs
CHANGED
|
@@ -941,6 +941,7 @@ function normalizeWindowsPath(input = "") {
|
|
|
941
941
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
942
942
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
943
943
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
944
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
944
945
|
var correctPaths = function(path) {
|
|
945
946
|
if (!path || path.length === 0) {
|
|
946
947
|
return ".";
|
|
@@ -991,6 +992,30 @@ var joinPaths = function(...segments) {
|
|
|
991
992
|
}
|
|
992
993
|
return correctPaths(path);
|
|
993
994
|
};
|
|
995
|
+
function cwd() {
|
|
996
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
997
|
+
return process.cwd().replace(/\\/g, "/");
|
|
998
|
+
}
|
|
999
|
+
return "/";
|
|
1000
|
+
}
|
|
1001
|
+
var resolve = function(...arguments_) {
|
|
1002
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
1003
|
+
let resolvedPath = "";
|
|
1004
|
+
let resolvedAbsolute = false;
|
|
1005
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
1006
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
1007
|
+
if (!path || path.length === 0) {
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
1011
|
+
resolvedAbsolute = isAbsolute(path);
|
|
1012
|
+
}
|
|
1013
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
1014
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
1015
|
+
return `/${resolvedPath}`;
|
|
1016
|
+
}
|
|
1017
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1018
|
+
};
|
|
994
1019
|
function normalizeString(path, allowAboveRoot) {
|
|
995
1020
|
let res = "";
|
|
996
1021
|
let lastSegmentLength = 0;
|
|
@@ -1053,6 +1078,22 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
1053
1078
|
var isAbsolute = function(p) {
|
|
1054
1079
|
return _IS_ABSOLUTE_RE.test(p);
|
|
1055
1080
|
};
|
|
1081
|
+
var relative = function(from, to) {
|
|
1082
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
1083
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
1084
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
1085
|
+
return _to.join("/");
|
|
1086
|
+
}
|
|
1087
|
+
const _fromCopy = [..._from];
|
|
1088
|
+
for (const segment of _fromCopy) {
|
|
1089
|
+
if (_to[0] !== segment) {
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
_from.shift();
|
|
1093
|
+
_to.shift();
|
|
1094
|
+
}
|
|
1095
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
1096
|
+
};
|
|
1056
1097
|
|
|
1057
1098
|
// src/utils/find-workspace-root.ts
|
|
1058
1099
|
init_cjs_shims();
|
|
@@ -8622,24 +8663,39 @@ init_cjs_shims();
|
|
|
8622
8663
|
|
|
8623
8664
|
// src/utils/tsconfig-path.ts
|
|
8624
8665
|
init_cjs_shims();
|
|
8625
|
-
function getTsConfigPath(tsconfigPath
|
|
8626
|
-
|
|
8666
|
+
function getTsConfigPath(tsconfigPath, type = "app") {
|
|
8667
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
8627
8668
|
if (tsconfigPath && fs.existsSync(tsconfigPath) && fs.statSync(tsconfigPath).isFile()) {
|
|
8628
|
-
|
|
8629
|
-
} else if (tsconfigPath === workspaceRoot && fs.existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) {
|
|
8630
|
-
result = "tsconfig.base.json";
|
|
8631
|
-
} else if (fs.existsSync(joinPaths(tsconfigPath, "tsconfig.app.json"))) {
|
|
8632
|
-
result = "tsconfig.app.json";
|
|
8633
|
-
} else if (fs.existsSync(joinPaths(tsconfigPath, "tsconfig.lib.json"))) {
|
|
8634
|
-
result = "tsconfig.lib.json";
|
|
8635
|
-
} else if (fs.existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) {
|
|
8636
|
-
result = "tsconfig.base.json";
|
|
8637
|
-
} else {
|
|
8638
|
-
console.warn(
|
|
8639
|
-
`No tsconfig.json found${tsconfigPath !== "./" ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
8640
|
-
);
|
|
8669
|
+
return relative(workspaceRoot, tsconfigPath);
|
|
8641
8670
|
}
|
|
8642
|
-
|
|
8671
|
+
let result = checkTsConfigPath(process.cwd());
|
|
8672
|
+
if (result) {
|
|
8673
|
+
return relative(workspaceRoot, joinPaths(process.cwd(), result));
|
|
8674
|
+
}
|
|
8675
|
+
result = checkTsConfigPath(workspaceRoot);
|
|
8676
|
+
if (result) {
|
|
8677
|
+
return result;
|
|
8678
|
+
}
|
|
8679
|
+
console.warn(
|
|
8680
|
+
`No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
8681
|
+
);
|
|
8682
|
+
return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
|
|
8683
|
+
}
|
|
8684
|
+
function checkTsConfigPath(root) {
|
|
8685
|
+
if (fs.existsSync(joinPaths(root, "tsconfig.json"))) {
|
|
8686
|
+
return "tsconfig.json";
|
|
8687
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.base.json"))) {
|
|
8688
|
+
return "tsconfig.base.json";
|
|
8689
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.app.json"))) {
|
|
8690
|
+
return "tsconfig.app.json";
|
|
8691
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.lib.json"))) {
|
|
8692
|
+
return "tsconfig.lib.json";
|
|
8693
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.eslint.json"))) {
|
|
8694
|
+
return "tsconfig.eslint.json";
|
|
8695
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.lint.json"))) {
|
|
8696
|
+
return "tsconfig.lint.json";
|
|
8697
|
+
}
|
|
8698
|
+
return void 0;
|
|
8643
8699
|
}
|
|
8644
8700
|
|
|
8645
8701
|
// src/configs/typescript.ts
|
|
@@ -8662,11 +8718,7 @@ async function typescript(options = {}) {
|
|
|
8662
8718
|
`${GLOB_MARKDOWN}/**`,
|
|
8663
8719
|
GLOB_ASTRO_TS
|
|
8664
8720
|
];
|
|
8665
|
-
const
|
|
8666
|
-
const tsconfigPath = getTsConfigPath(
|
|
8667
|
-
options?.tsconfigPath || workspaceRoot,
|
|
8668
|
-
workspaceRoot
|
|
8669
|
-
);
|
|
8721
|
+
const tsconfigPath = getTsConfigPath(options?.tsconfigPath, type);
|
|
8670
8722
|
const typeAwareRules = {
|
|
8671
8723
|
"dot-notation": "off",
|
|
8672
8724
|
"no-implied-eval": "off",
|
|
@@ -8709,7 +8761,7 @@ async function typescript(options = {}) {
|
|
|
8709
8761
|
allowDefaultProject: ["./*.js", "./*.ts"],
|
|
8710
8762
|
defaultProject: tsconfigPath
|
|
8711
8763
|
},
|
|
8712
|
-
tsconfigRootDir:
|
|
8764
|
+
tsconfigRootDir: findWorkspaceRoot()
|
|
8713
8765
|
} : {},
|
|
8714
8766
|
...parserOptions
|
|
8715
8767
|
}
|
|
@@ -9162,10 +9214,6 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
9162
9214
|
}
|
|
9163
9215
|
}
|
|
9164
9216
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
9165
|
-
let tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
9166
|
-
if (!tsconfigPath) {
|
|
9167
|
-
tsconfigPath = getTsConfigPath();
|
|
9168
|
-
}
|
|
9169
9217
|
configs3.push(
|
|
9170
9218
|
ignores(options.ignores),
|
|
9171
9219
|
javascript({
|
|
@@ -9251,7 +9299,7 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
9251
9299
|
react({
|
|
9252
9300
|
...typescriptOptions,
|
|
9253
9301
|
overrides: getOverrides(options, "react"),
|
|
9254
|
-
tsconfigPath
|
|
9302
|
+
tsconfigPath: "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0
|
|
9255
9303
|
})
|
|
9256
9304
|
);
|
|
9257
9305
|
}
|
package/dist/preset.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isInEditorEnv, interopDefault, ensurePackages, renameRules, parserPlain, isPackageInScope } from './chunk-IWQLEJ77.js';
|
|
2
|
-
import { getTsConfigPath } from './chunk-
|
|
2
|
+
import { getTsConfigPath } from './chunk-O72R6YEJ.js';
|
|
3
3
|
import { banner_plugin_default } from './chunk-SHDRQRAZ.js';
|
|
4
4
|
import { getFileBanner } from './chunk-UDXTXTFI.js';
|
|
5
5
|
import { GLOB_EXCLUDE, GLOB_TS, GLOB_TSX, GLOB_JSX, GLOB_MARKDOWN, GLOB_ASTRO_TS, GLOB_SRC, GLOB_TESTS, GLOB_ASTRO, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_MDX, GLOB_CSS, GLOB_POSTCSS, GLOB_SCSS, GLOB_LESS, GLOB_HTML, GLOB_XML, GLOB_SVG, GLOB_GRAPHQL, GLOB_SRC_EXT } from './chunk-L3LWC2Q2.js';
|
|
@@ -7714,11 +7714,7 @@ async function typescript(options = {}) {
|
|
|
7714
7714
|
`${GLOB_MARKDOWN}/**`,
|
|
7715
7715
|
GLOB_ASTRO_TS
|
|
7716
7716
|
];
|
|
7717
|
-
const
|
|
7718
|
-
const tsconfigPath = getTsConfigPath(
|
|
7719
|
-
options?.tsconfigPath || workspaceRoot,
|
|
7720
|
-
workspaceRoot
|
|
7721
|
-
);
|
|
7717
|
+
const tsconfigPath = getTsConfigPath(options?.tsconfigPath, type);
|
|
7722
7718
|
const typeAwareRules = {
|
|
7723
7719
|
"dot-notation": "off",
|
|
7724
7720
|
"no-implied-eval": "off",
|
|
@@ -7761,7 +7757,7 @@ async function typescript(options = {}) {
|
|
|
7761
7757
|
allowDefaultProject: ["./*.js", "./*.ts"],
|
|
7762
7758
|
defaultProject: tsconfigPath
|
|
7763
7759
|
},
|
|
7764
|
-
tsconfigRootDir:
|
|
7760
|
+
tsconfigRootDir: findWorkspaceRoot()
|
|
7765
7761
|
} : {},
|
|
7766
7762
|
...parserOptions
|
|
7767
7763
|
}
|
|
@@ -8214,10 +8210,6 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
8214
8210
|
}
|
|
8215
8211
|
}
|
|
8216
8212
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
8217
|
-
let tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
8218
|
-
if (!tsconfigPath) {
|
|
8219
|
-
tsconfigPath = getTsConfigPath();
|
|
8220
|
-
}
|
|
8221
8213
|
configs3.push(
|
|
8222
8214
|
ignores(options.ignores),
|
|
8223
8215
|
javascript({
|
|
@@ -8303,7 +8295,7 @@ function getStormConfig(options, ...userConfigs) {
|
|
|
8303
8295
|
react({
|
|
8304
8296
|
...typescriptOptions,
|
|
8305
8297
|
overrides: getOverrides(options, "react"),
|
|
8306
|
-
tsconfigPath
|
|
8298
|
+
tsconfigPath: "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0
|
|
8307
8299
|
})
|
|
8308
8300
|
);
|
|
8309
8301
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var fs = require('fs');
|
|
4
|
+
var path = require('path');
|
|
4
5
|
|
|
5
6
|
// src/utils/tsconfig-path.ts
|
|
6
7
|
|
|
@@ -15,6 +16,7 @@ function normalizeWindowsPath(input = "") {
|
|
|
15
16
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
16
17
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
17
18
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
19
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
18
20
|
var correctPaths = function(path) {
|
|
19
21
|
if (!path || path.length === 0) {
|
|
20
22
|
return ".";
|
|
@@ -65,6 +67,30 @@ var joinPaths = function(...segments) {
|
|
|
65
67
|
}
|
|
66
68
|
return correctPaths(path);
|
|
67
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
|
+
};
|
|
68
94
|
function normalizeString(path, allowAboveRoot) {
|
|
69
95
|
let res = "";
|
|
70
96
|
let lastSegmentLength = 0;
|
|
@@ -127,26 +153,145 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
127
153
|
var isAbsolute = function(p) {
|
|
128
154
|
return _IS_ABSOLUTE_RE.test(p);
|
|
129
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
|
+
}
|
|
130
259
|
|
|
131
260
|
// src/utils/tsconfig-path.ts
|
|
132
|
-
function getTsConfigPath(tsconfigPath
|
|
133
|
-
|
|
261
|
+
function getTsConfigPath(tsconfigPath, type = "app") {
|
|
262
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
134
263
|
if (tsconfigPath && fs.existsSync(tsconfigPath) && fs.statSync(tsconfigPath).isFile()) {
|
|
135
|
-
|
|
136
|
-
} else if (tsconfigPath === workspaceRoot && fs.existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) {
|
|
137
|
-
result = "tsconfig.base.json";
|
|
138
|
-
} else if (fs.existsSync(joinPaths(tsconfigPath, "tsconfig.app.json"))) {
|
|
139
|
-
result = "tsconfig.app.json";
|
|
140
|
-
} else if (fs.existsSync(joinPaths(tsconfigPath, "tsconfig.lib.json"))) {
|
|
141
|
-
result = "tsconfig.lib.json";
|
|
142
|
-
} else if (fs.existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) {
|
|
143
|
-
result = "tsconfig.base.json";
|
|
144
|
-
} else {
|
|
145
|
-
console.warn(
|
|
146
|
-
`No tsconfig.json found${tsconfigPath !== "./" ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
147
|
-
);
|
|
264
|
+
return relative(workspaceRoot, tsconfigPath);
|
|
148
265
|
}
|
|
149
|
-
|
|
266
|
+
let result = checkTsConfigPath(process.cwd());
|
|
267
|
+
if (result) {
|
|
268
|
+
return relative(workspaceRoot, joinPaths(process.cwd(), result));
|
|
269
|
+
}
|
|
270
|
+
result = checkTsConfigPath(workspaceRoot);
|
|
271
|
+
if (result) {
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
console.warn(
|
|
275
|
+
`No tsconfig.json found${tsconfigPath ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
276
|
+
);
|
|
277
|
+
return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : `tsconfig.${type}.json`;
|
|
278
|
+
}
|
|
279
|
+
function checkTsConfigPath(root) {
|
|
280
|
+
if (fs.existsSync(joinPaths(root, "tsconfig.json"))) {
|
|
281
|
+
return "tsconfig.json";
|
|
282
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.base.json"))) {
|
|
283
|
+
return "tsconfig.base.json";
|
|
284
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.app.json"))) {
|
|
285
|
+
return "tsconfig.app.json";
|
|
286
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.lib.json"))) {
|
|
287
|
+
return "tsconfig.lib.json";
|
|
288
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.eslint.json"))) {
|
|
289
|
+
return "tsconfig.eslint.json";
|
|
290
|
+
} else if (fs.existsSync(joinPaths(root, "tsconfig.lint.json"))) {
|
|
291
|
+
return "tsconfig.lint.json";
|
|
292
|
+
}
|
|
293
|
+
return void 0;
|
|
150
294
|
}
|
|
151
295
|
|
|
296
|
+
exports.checkTsConfigPath = checkTsConfigPath;
|
|
152
297
|
exports.getTsConfigPath = getTsConfigPath;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
declare function getTsConfigPath(tsconfigPath?: string,
|
|
1
|
+
declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
|
|
2
|
+
declare function checkTsConfigPath(root: string): string | undefined;
|
|
2
3
|
|
|
3
|
-
export { getTsConfigPath };
|
|
4
|
+
export { checkTsConfigPath, getTsConfigPath };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
declare function getTsConfigPath(tsconfigPath?: string,
|
|
1
|
+
declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
|
|
2
|
+
declare function checkTsConfigPath(root: string): string | undefined;
|
|
2
3
|
|
|
3
|
-
export { getTsConfigPath };
|
|
4
|
+
export { checkTsConfigPath, getTsConfigPath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/eslint",
|
|
3
|
-
"version": "0.169.
|
|
3
|
+
"version": "0.169.102",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the base ESLint configuration used by Storm Software across many projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -141,8 +141,8 @@
|
|
|
141
141
|
"@eslint/eslintrc": "^3.3.3",
|
|
142
142
|
"@eslint/markdown": "^6.6.0",
|
|
143
143
|
"@nx/eslint-plugin": "22.5.1",
|
|
144
|
-
"@storm-software/config": "^1.135.
|
|
145
|
-
"@storm-software/config-tools": "^1.189.
|
|
144
|
+
"@storm-software/config": "^1.135.15",
|
|
145
|
+
"@storm-software/config-tools": "^1.189.14",
|
|
146
146
|
"@stylistic/eslint-plugin": "^4.4.1",
|
|
147
147
|
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
148
148
|
"@typescript-eslint/parser": "^8.56.0",
|
|
@@ -239,5 +239,5 @@
|
|
|
239
239
|
"prettier-plugin-astro": "^0.14.0"
|
|
240
240
|
},
|
|
241
241
|
"publishConfig": { "access": "public" },
|
|
242
|
-
"gitHead": "
|
|
242
|
+
"gitHead": "c9ce65613cbc87d3299de84eb37a22f34a61c973"
|
|
243
243
|
}
|
package/dist/chunk-DJ2ZXQYV.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { joinPaths } from './chunk-T4LUMNGJ.js';
|
|
2
|
-
import { init_esm_shims } from './chunk-PWQ34SJ2.js';
|
|
3
|
-
import { existsSync, statSync } from 'node:fs';
|
|
4
|
-
|
|
5
|
-
// src/utils/tsconfig-path.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
function getTsConfigPath(tsconfigPath = "./", workspaceRoot = "./") {
|
|
8
|
-
let result = "tsconfig.json";
|
|
9
|
-
if (tsconfigPath && existsSync(tsconfigPath) && statSync(tsconfigPath).isFile()) {
|
|
10
|
-
result = tsconfigPath;
|
|
11
|
-
} else if (tsconfigPath === workspaceRoot && existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) {
|
|
12
|
-
result = "tsconfig.base.json";
|
|
13
|
-
} else if (existsSync(joinPaths(tsconfigPath, "tsconfig.app.json"))) {
|
|
14
|
-
result = "tsconfig.app.json";
|
|
15
|
-
} else if (existsSync(joinPaths(tsconfigPath, "tsconfig.lib.json"))) {
|
|
16
|
-
result = "tsconfig.lib.json";
|
|
17
|
-
} else if (existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) {
|
|
18
|
-
result = "tsconfig.base.json";
|
|
19
|
-
} else {
|
|
20
|
-
console.warn(
|
|
21
|
-
`No tsconfig.json found${tsconfigPath !== "./" ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.`
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { getTsConfigPath };
|