@storm-software/eslint 0.170.156 → 0.170.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +43 -0
- package/dist/index.mjs +44 -0
- package/dist/plugins.d.mts +15 -0
- package/dist/plugins.mjs +16 -0
- package/dist/preset.d.mts +32 -0
- package/dist/preset.mjs +213 -0
- package/dist/{types.d.cts → typegen.d.mts} +8538 -11156
- package/dist/types.d.mts +735 -0
- package/dist/types.mjs +5 -0
- package/dist/utils/correct-paths.mjs +136 -0
- package/dist/utils/find-workspace-root.mjs +83 -0
- package/dist/utils/helpers.mjs +75 -0
- package/dist/utils/package-manager.mjs +20 -0
- package/dist/utils/tsconfig.mjs +48 -0
- package/package.json +58 -79
- package/dist/index.cjs +0 -24
- package/dist/index.d.cts +0 -127
- package/dist/index.d.ts +0 -127
- package/dist/index.js +0 -7
- package/dist/preset.cjs +0 -354
- package/dist/preset.d.cts +0 -34
- package/dist/preset.d.ts +0 -34
- package/dist/preset.js +0 -344
- package/dist/types.cjs +0 -12
- package/dist/types.d.ts +0 -19537
- package/dist/types.js +0 -1
- package/dist/utils/combine.cjs +0 -8
- package/dist/utils/combine.d.cts +0 -14
- package/dist/utils/combine.d.ts +0 -14
- package/dist/utils/combine.js +0 -6
- package/dist/utils/correct-paths.cjs +0 -231
- package/dist/utils/correct-paths.d.cts +0 -30
- package/dist/utils/correct-paths.d.ts +0 -30
- package/dist/utils/correct-paths.js +0 -216
- package/dist/utils/find-workspace-root.cjs +0 -96
- package/dist/utils/find-workspace-root.d.cts +0 -16
- package/dist/utils/find-workspace-root.d.ts +0 -16
- package/dist/utils/find-workspace-root.js +0 -93
- package/dist/utils/format-config.cjs +0 -19
- package/dist/utils/format-config.d.cts +0 -5
- package/dist/utils/format-config.d.ts +0 -5
- package/dist/utils/format-config.js +0 -17
- package/dist/utils/helpers.cjs +0 -86
- package/dist/utils/helpers.d.cts +0 -55
- package/dist/utils/helpers.d.ts +0 -55
- package/dist/utils/helpers.js +0 -72
- package/dist/utils/package-manager.cjs +0 -18
- package/dist/utils/package-manager.d.cts +0 -8
- package/dist/utils/package-manager.d.ts +0 -8
- package/dist/utils/package-manager.js +0 -16
- package/dist/utils/tsconfig.cjs +0 -43
- package/dist/utils/tsconfig.d.cts +0 -25
- package/dist/utils/tsconfig.d.ts +0 -25
- package/dist/utils/tsconfig.js +0 -40
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { correctPaths } from './correct-paths';
|
|
4
|
-
|
|
5
|
-
const MAX_PATH_SEARCH_DEPTH = 30;
|
|
6
|
-
let depth = 0;
|
|
7
|
-
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
8
|
-
const _startPath = startPath ?? process.cwd();
|
|
9
|
-
if (endDirectoryNames.some(
|
|
10
|
-
(endDirName) => existsSync(join(_startPath, endDirName))
|
|
11
|
-
)) {
|
|
12
|
-
return _startPath;
|
|
13
|
-
}
|
|
14
|
-
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
|
|
15
|
-
return _startPath;
|
|
16
|
-
}
|
|
17
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
18
|
-
const parent = join(_startPath, "..");
|
|
19
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
20
|
-
}
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
const rootFiles = [
|
|
24
|
-
"storm-workspace.json",
|
|
25
|
-
"storm-workspace.json",
|
|
26
|
-
"storm-workspace.yaml",
|
|
27
|
-
"storm-workspace.yml",
|
|
28
|
-
"storm-workspace.js",
|
|
29
|
-
"storm-workspace.ts",
|
|
30
|
-
".storm-workspace.json",
|
|
31
|
-
".storm-workspace.yaml",
|
|
32
|
-
".storm-workspace.yml",
|
|
33
|
-
".storm-workspace.js",
|
|
34
|
-
".storm-workspace.ts",
|
|
35
|
-
"lerna.json",
|
|
36
|
-
"nx.json",
|
|
37
|
-
"turbo.json",
|
|
38
|
-
"npm-workspace.json",
|
|
39
|
-
"yarn-workspace.json",
|
|
40
|
-
"pnpm-workspace.json",
|
|
41
|
-
"npm-workspace.yaml",
|
|
42
|
-
"yarn-workspace.yaml",
|
|
43
|
-
"pnpm-workspace.yaml",
|
|
44
|
-
"npm-workspace.yml",
|
|
45
|
-
"yarn-workspace.yml",
|
|
46
|
-
"pnpm-workspace.yml",
|
|
47
|
-
"npm-lock.json",
|
|
48
|
-
"yarn-lock.json",
|
|
49
|
-
"pnpm-lock.json",
|
|
50
|
-
"npm-lock.yaml",
|
|
51
|
-
"yarn-lock.yaml",
|
|
52
|
-
"pnpm-lock.yaml",
|
|
53
|
-
"npm-lock.yml",
|
|
54
|
-
"yarn-lock.yml",
|
|
55
|
-
"pnpm-lock.yml",
|
|
56
|
-
"bun.lockb"
|
|
57
|
-
];
|
|
58
|
-
const rootDirectories = [
|
|
59
|
-
".storm-workspace",
|
|
60
|
-
".nx",
|
|
61
|
-
".github",
|
|
62
|
-
".vscode",
|
|
63
|
-
".verdaccio"
|
|
64
|
-
];
|
|
65
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
66
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
67
|
-
return correctPaths(
|
|
68
|
-
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return correctPaths(
|
|
72
|
-
findFolderUp(
|
|
73
|
-
pathInsideMonorepo ?? process.cwd(),
|
|
74
|
-
rootFiles,
|
|
75
|
-
rootDirectories
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
80
|
-
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
81
|
-
if (!result) {
|
|
82
|
-
throw new Error(
|
|
83
|
-
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
84
|
-
${rootFiles.join(
|
|
85
|
-
"\n"
|
|
86
|
-
)}
|
|
87
|
-
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export { findWorkspaceRoot, findWorkspaceRootSafe };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const formatConfig = (name, config = []) => {
|
|
4
|
-
return config.map((config2, index) => {
|
|
5
|
-
if (!config2 || config2.name) {
|
|
6
|
-
return config2 ?? {};
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
...config2,
|
|
10
|
-
name: `Storm Software (${config2.name ? config2.name : name}) #${index + 1}`,
|
|
11
|
-
settings: {
|
|
12
|
-
"import/resolver": "node",
|
|
13
|
-
...config2.settings ?? {}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.formatConfig = formatConfig;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const formatConfig = (name, config = []) => {
|
|
2
|
-
return config.map((config2, index) => {
|
|
3
|
-
if (!config2 || config2.name) {
|
|
4
|
-
return config2 ?? {};
|
|
5
|
-
}
|
|
6
|
-
return {
|
|
7
|
-
...config2,
|
|
8
|
-
name: `Storm Software (${config2.name ? config2.name : name}) #${index + 1}`,
|
|
9
|
-
settings: {
|
|
10
|
-
"import/resolver": "node",
|
|
11
|
-
...config2.settings ?? {}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { formatConfig };
|
package/dist/utils/helpers.cjs
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var localPkg = require('local-pkg');
|
|
4
|
-
var process = require('node:process');
|
|
5
|
-
var node_url = require('node:url');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
10
|
-
|
|
11
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
12
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
13
|
-
const scopeUrl = node_url.fileURLToPath(new URL(".", importMetaUrl));
|
|
14
|
-
const isCwdInScope = localPkg.isPackageExists("@storm-software/eslint");
|
|
15
|
-
const parserPlain = {
|
|
16
|
-
meta: {
|
|
17
|
-
name: "parser-plain"
|
|
18
|
-
},
|
|
19
|
-
parseForESLint: (code) => ({
|
|
20
|
-
ast: {
|
|
21
|
-
body: [],
|
|
22
|
-
comments: [],
|
|
23
|
-
loc: { end: code.length, start: 0 },
|
|
24
|
-
range: [0, code.length],
|
|
25
|
-
tokens: [],
|
|
26
|
-
type: "Program"
|
|
27
|
-
},
|
|
28
|
-
scopeManager: null,
|
|
29
|
-
services: { isPlain: true },
|
|
30
|
-
visitorKeys: {
|
|
31
|
-
Program: []
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
function isInGitHooksOrLintStaged() {
|
|
36
|
-
return !!(process__default.default.env.GIT_PARAMS || process__default.default.env.VSCODE_GIT_COMMAND || process__default.default.env.npm_lifecycle_script?.startsWith("lint-staged") || process__default.default.env.npm_lifecycle_script?.startsWith("lefthook") || process__default.default.env.npm_lifecycle_script === "push");
|
|
37
|
-
}
|
|
38
|
-
function isInEditorEnv() {
|
|
39
|
-
if (process__default.default.env.CI) return false;
|
|
40
|
-
if (isInGitHooksOrLintStaged()) return false;
|
|
41
|
-
return !!(process__default.default.env.VSCODE_PID || process__default.default.env.VSCODE_CWD || process__default.default.env.JETBRAINS_IDE || process__default.default.env.VIM || process__default.default.env.NVIM);
|
|
42
|
-
}
|
|
43
|
-
async function interopDefault(m) {
|
|
44
|
-
const resolved = await m;
|
|
45
|
-
return resolved.default || resolved;
|
|
46
|
-
}
|
|
47
|
-
function isPackageInScope(name) {
|
|
48
|
-
return localPkg.isPackageExists(name, { paths: [scopeUrl] });
|
|
49
|
-
}
|
|
50
|
-
async function ensurePackages(packages) {
|
|
51
|
-
if (process__default.default.env.CI || process__default.default.stdout.isTTY === false || isCwdInScope === false)
|
|
52
|
-
return;
|
|
53
|
-
const nonExistingPackages = packages.filter(
|
|
54
|
-
(i) => i && !isPackageInScope(i)
|
|
55
|
-
);
|
|
56
|
-
if (nonExistingPackages.length === 0) return;
|
|
57
|
-
const p = await import('@clack/prompts');
|
|
58
|
-
const result = await p.confirm({
|
|
59
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(
|
|
60
|
-
", "
|
|
61
|
-
)}. Do you want to install them?`
|
|
62
|
-
});
|
|
63
|
-
if (result)
|
|
64
|
-
await import('@antfu/install-pkg').then(
|
|
65
|
-
(i) => i.installPackage(nonExistingPackages, { dev: true })
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
function renameRules(rules, map) {
|
|
69
|
-
return Object.fromEntries(
|
|
70
|
-
Object.entries(rules).map(([key, value]) => {
|
|
71
|
-
for (const [from, to] of Object.entries(map)) {
|
|
72
|
-
if (key.startsWith(`${from}/`))
|
|
73
|
-
return [to + key.slice(from.length), value];
|
|
74
|
-
}
|
|
75
|
-
return [key, value];
|
|
76
|
-
})
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
exports.ensurePackages = ensurePackages;
|
|
81
|
-
exports.interopDefault = interopDefault;
|
|
82
|
-
exports.isInEditorEnv = isInEditorEnv;
|
|
83
|
-
exports.isInGitHooksOrLintStaged = isInGitHooksOrLintStaged;
|
|
84
|
-
exports.isPackageInScope = isPackageInScope;
|
|
85
|
-
exports.parserPlain = parserPlain;
|
|
86
|
-
exports.renameRules = renameRules;
|
package/dist/utils/helpers.d.cts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Awaitable } from 'eslint-flat-config-utils';
|
|
2
|
-
|
|
3
|
-
declare const parserPlain: {
|
|
4
|
-
meta: {
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
parseForESLint: (code: string) => {
|
|
8
|
-
ast: {
|
|
9
|
-
body: never[];
|
|
10
|
-
comments: never[];
|
|
11
|
-
loc: {
|
|
12
|
-
end: number;
|
|
13
|
-
start: number;
|
|
14
|
-
};
|
|
15
|
-
range: number[];
|
|
16
|
-
tokens: never[];
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
scopeManager: null;
|
|
20
|
-
services: {
|
|
21
|
-
isPlain: boolean;
|
|
22
|
-
};
|
|
23
|
-
visitorKeys: {
|
|
24
|
-
Program: never[];
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
declare function isInGitHooksOrLintStaged(): boolean;
|
|
29
|
-
declare function isInEditorEnv(): boolean;
|
|
30
|
-
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
31
|
-
default: infer U;
|
|
32
|
-
} ? U : T>;
|
|
33
|
-
declare function isPackageInScope(name: string): boolean;
|
|
34
|
-
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Rename plugin prefixes in a rule object.
|
|
37
|
-
* Accepts a map of prefixes to rename.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* import { renameRules } from '@storm-software/eslint'
|
|
42
|
-
*
|
|
43
|
-
* export default [{
|
|
44
|
-
* rules: renameRules(
|
|
45
|
-
* {
|
|
46
|
-
* '@typescript-eslint/indent': 'error'
|
|
47
|
-
* },
|
|
48
|
-
* { '@typescript-eslint': 'ts' }
|
|
49
|
-
* )
|
|
50
|
-
* }]
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
54
|
-
|
|
55
|
-
export { ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, renameRules };
|
package/dist/utils/helpers.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Awaitable } from 'eslint-flat-config-utils';
|
|
2
|
-
|
|
3
|
-
declare const parserPlain: {
|
|
4
|
-
meta: {
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
parseForESLint: (code: string) => {
|
|
8
|
-
ast: {
|
|
9
|
-
body: never[];
|
|
10
|
-
comments: never[];
|
|
11
|
-
loc: {
|
|
12
|
-
end: number;
|
|
13
|
-
start: number;
|
|
14
|
-
};
|
|
15
|
-
range: number[];
|
|
16
|
-
tokens: never[];
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
scopeManager: null;
|
|
20
|
-
services: {
|
|
21
|
-
isPlain: boolean;
|
|
22
|
-
};
|
|
23
|
-
visitorKeys: {
|
|
24
|
-
Program: never[];
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
declare function isInGitHooksOrLintStaged(): boolean;
|
|
29
|
-
declare function isInEditorEnv(): boolean;
|
|
30
|
-
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
31
|
-
default: infer U;
|
|
32
|
-
} ? U : T>;
|
|
33
|
-
declare function isPackageInScope(name: string): boolean;
|
|
34
|
-
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Rename plugin prefixes in a rule object.
|
|
37
|
-
* Accepts a map of prefixes to rename.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* import { renameRules } from '@storm-software/eslint'
|
|
42
|
-
*
|
|
43
|
-
* export default [{
|
|
44
|
-
* rules: renameRules(
|
|
45
|
-
* {
|
|
46
|
-
* '@typescript-eslint/indent': 'error'
|
|
47
|
-
* },
|
|
48
|
-
* { '@typescript-eslint': 'ts' }
|
|
49
|
-
* )
|
|
50
|
-
* }]
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
54
|
-
|
|
55
|
-
export { ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, renameRules };
|
package/dist/utils/helpers.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { isPackageExists } from 'local-pkg';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
|
|
5
|
-
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
6
|
-
const isCwdInScope = isPackageExists("@storm-software/eslint");
|
|
7
|
-
const parserPlain = {
|
|
8
|
-
meta: {
|
|
9
|
-
name: "parser-plain"
|
|
10
|
-
},
|
|
11
|
-
parseForESLint: (code) => ({
|
|
12
|
-
ast: {
|
|
13
|
-
body: [],
|
|
14
|
-
comments: [],
|
|
15
|
-
loc: { end: code.length, start: 0 },
|
|
16
|
-
range: [0, code.length],
|
|
17
|
-
tokens: [],
|
|
18
|
-
type: "Program"
|
|
19
|
-
},
|
|
20
|
-
scopeManager: null,
|
|
21
|
-
services: { isPlain: true },
|
|
22
|
-
visitorKeys: {
|
|
23
|
-
Program: []
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
};
|
|
27
|
-
function isInGitHooksOrLintStaged() {
|
|
28
|
-
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged") || process.env.npm_lifecycle_script?.startsWith("lefthook") || process.env.npm_lifecycle_script === "push");
|
|
29
|
-
}
|
|
30
|
-
function isInEditorEnv() {
|
|
31
|
-
if (process.env.CI) return false;
|
|
32
|
-
if (isInGitHooksOrLintStaged()) return false;
|
|
33
|
-
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
34
|
-
}
|
|
35
|
-
async function interopDefault(m) {
|
|
36
|
-
const resolved = await m;
|
|
37
|
-
return resolved.default || resolved;
|
|
38
|
-
}
|
|
39
|
-
function isPackageInScope(name) {
|
|
40
|
-
return isPackageExists(name, { paths: [scopeUrl] });
|
|
41
|
-
}
|
|
42
|
-
async function ensurePackages(packages) {
|
|
43
|
-
if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false)
|
|
44
|
-
return;
|
|
45
|
-
const nonExistingPackages = packages.filter(
|
|
46
|
-
(i) => i && !isPackageInScope(i)
|
|
47
|
-
);
|
|
48
|
-
if (nonExistingPackages.length === 0) return;
|
|
49
|
-
const p = await import('@clack/prompts');
|
|
50
|
-
const result = await p.confirm({
|
|
51
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(
|
|
52
|
-
", "
|
|
53
|
-
)}. Do you want to install them?`
|
|
54
|
-
});
|
|
55
|
-
if (result)
|
|
56
|
-
await import('@antfu/install-pkg').then(
|
|
57
|
-
(i) => i.installPackage(nonExistingPackages, { dev: true })
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function renameRules(rules, map) {
|
|
61
|
-
return Object.fromEntries(
|
|
62
|
-
Object.entries(rules).map(([key, value]) => {
|
|
63
|
-
for (const [from, to] of Object.entries(map)) {
|
|
64
|
-
if (key.startsWith(`${from}/`))
|
|
65
|
-
return [to + key.slice(from.length), value];
|
|
66
|
-
}
|
|
67
|
-
return [key, value];
|
|
68
|
-
})
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, renameRules };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var node_fs = require('node:fs');
|
|
4
|
-
var node_path = require('node:path');
|
|
5
|
-
var findWorkspaceRoot = require('./find-workspace-root');
|
|
6
|
-
|
|
7
|
-
function detectPackageManager() {
|
|
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"))) {
|
|
10
|
-
return "bun";
|
|
11
|
-
}
|
|
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"))) {
|
|
13
|
-
return "pnpm";
|
|
14
|
-
}
|
|
15
|
-
return "npm";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exports.detectPackageManager = detectPackageManager;
|
|
@@ -1,16 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var node_fs = require('node:fs');
|
|
4
|
-
var correctPaths = require('./correct-paths');
|
|
5
|
-
var findWorkspaceRoot = require('./find-workspace-root');
|
|
6
|
-
|
|
7
|
-
function getTsConfigPath(tsconfigPath, type) {
|
|
8
|
-
const workspaceRoot = findWorkspaceRoot.findWorkspaceRoot();
|
|
9
|
-
if (tsconfigPath && node_fs.existsSync(tsconfigPath) && node_fs.statSync(tsconfigPath).isFile()) {
|
|
10
|
-
return correctPaths.relative(workspaceRoot, tsconfigPath);
|
|
11
|
-
}
|
|
12
|
-
let result = checkTsConfigPath(process.cwd());
|
|
13
|
-
if (result) {
|
|
14
|
-
return correctPaths.relative(workspaceRoot, correctPaths.joinPaths(process.cwd(), result));
|
|
15
|
-
}
|
|
16
|
-
result = checkTsConfigPath(workspaceRoot);
|
|
17
|
-
if (result) {
|
|
18
|
-
return correctPaths.relative(workspaceRoot, correctPaths.joinPaths(workspaceRoot, result));
|
|
19
|
-
}
|
|
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
|
-
return workspaceRoot?.replace(/\\/g, "/").replaceAll(/\/$/g, "") === process.cwd().replace(/\\/g, "/").replaceAll(/\/$/g, "") ? "tsconfig.base.json" : type ? `tsconfig.${type}.json` : "tsconfig.json";
|
|
24
|
-
}
|
|
25
|
-
function checkTsConfigPath(root) {
|
|
26
|
-
if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.json"))) {
|
|
27
|
-
return "tsconfig.json";
|
|
28
|
-
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.base.json"))) {
|
|
29
|
-
return "tsconfig.base.json";
|
|
30
|
-
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.app.json"))) {
|
|
31
|
-
return "tsconfig.app.json";
|
|
32
|
-
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.lib.json"))) {
|
|
33
|
-
return "tsconfig.lib.json";
|
|
34
|
-
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.eslint.json"))) {
|
|
35
|
-
return "tsconfig.eslint.json";
|
|
36
|
-
} else if (node_fs.existsSync(correctPaths.joinPaths(root, "tsconfig.lint.json"))) {
|
|
37
|
-
return "tsconfig.lint.json";
|
|
38
|
-
}
|
|
39
|
-
return void 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
exports.checkTsConfigPath = checkTsConfigPath;
|
|
43
|
-
exports.getTsConfigPath = getTsConfigPath;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the path to the nearest tsconfig file by walking up from start path.
|
|
3
|
-
*
|
|
4
|
-
* The search order is as follows:
|
|
5
|
-
* 1. If `tsconfigPath` is provided and exists, it will be used.
|
|
6
|
-
* 2. If a tsconfig file is found in the current working directory, it will be used.
|
|
7
|
-
* 3. If a tsconfig file is found in the workspace root, it will be used.
|
|
8
|
-
* 4. If no tsconfig file is found, a warning will be logged and a default path will be returned based on the project type (app or lib).
|
|
9
|
-
*
|
|
10
|
-
* The function checks for the following tsconfig file names in order:
|
|
11
|
-
* - tsconfig.json
|
|
12
|
-
* - tsconfig.base.json
|
|
13
|
-
* - tsconfig.app.json
|
|
14
|
-
* - tsconfig.lib.json
|
|
15
|
-
* - tsconfig.eslint.json
|
|
16
|
-
* - tsconfig.lint.json
|
|
17
|
-
*
|
|
18
|
-
* @param tsconfigPath Optional path to a tsconfig file. If provided, it will be used if it exists.
|
|
19
|
-
* @param type The type of project (app or lib) to determine the default tsconfig file name if no tsconfig file is found. Default is "app".
|
|
20
|
-
* @returns The path to the nearest tsconfig file relative to the workspace root.
|
|
21
|
-
*/
|
|
22
|
-
declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
|
|
23
|
-
declare function checkTsConfigPath(root: string): string | undefined;
|
|
24
|
-
|
|
25
|
-
export { checkTsConfigPath, getTsConfigPath };
|
package/dist/utils/tsconfig.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the path to the nearest tsconfig file by walking up from start path.
|
|
3
|
-
*
|
|
4
|
-
* The search order is as follows:
|
|
5
|
-
* 1. If `tsconfigPath` is provided and exists, it will be used.
|
|
6
|
-
* 2. If a tsconfig file is found in the current working directory, it will be used.
|
|
7
|
-
* 3. If a tsconfig file is found in the workspace root, it will be used.
|
|
8
|
-
* 4. If no tsconfig file is found, a warning will be logged and a default path will be returned based on the project type (app or lib).
|
|
9
|
-
*
|
|
10
|
-
* The function checks for the following tsconfig file names in order:
|
|
11
|
-
* - tsconfig.json
|
|
12
|
-
* - tsconfig.base.json
|
|
13
|
-
* - tsconfig.app.json
|
|
14
|
-
* - tsconfig.lib.json
|
|
15
|
-
* - tsconfig.eslint.json
|
|
16
|
-
* - tsconfig.lint.json
|
|
17
|
-
*
|
|
18
|
-
* @param tsconfigPath Optional path to a tsconfig file. If provided, it will be used if it exists.
|
|
19
|
-
* @param type The type of project (app or lib) to determine the default tsconfig file name if no tsconfig file is found. Default is "app".
|
|
20
|
-
* @returns The path to the nearest tsconfig file relative to the workspace root.
|
|
21
|
-
*/
|
|
22
|
-
declare function getTsConfigPath(tsconfigPath?: string, type?: "app" | "lib"): string;
|
|
23
|
-
declare function checkTsConfigPath(root: string): string | undefined;
|
|
24
|
-
|
|
25
|
-
export { checkTsConfigPath, getTsConfigPath };
|
package/dist/utils/tsconfig.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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 };
|