Skip to content

Commit 3085872

Browse files
author
Suh Donghwi
committed
make private functions non exported
1 parent 1e4e43c commit 3085872

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

sources/utils/validation.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,6 @@ import { configReader } from "../configuration";
55
import { findAllGroupsWithSpecificDependency } from "./resolution";
66
import { CATALOG_PROTOCOL } from "../constants";
77

8-
/**
9-
* Get validation level for a specific group (considering inheritance)
10-
*/
11-
export async function getGroupValidationLevel(
12-
workspace: Workspace,
13-
groupName: string,
14-
): Promise<ValidationLevel> {
15-
const config = await configReader.readConfiguration(workspace.project);
16-
const validationConfig = config.options?.validation || "warn";
17-
18-
if (typeof validationConfig === "string") {
19-
return validationConfig;
20-
}
21-
22-
// Search inheritance chain for explicit validation setting
23-
const inheritanceChain = getInheritanceChain(groupName);
24-
25-
for (let i = inheritanceChain.length - 1; i >= 0; i--) {
26-
const currentGroup = inheritanceChain[i];
27-
if (validationConfig[currentGroup] !== undefined) {
28-
return validationConfig[currentGroup];
29-
}
30-
}
31-
32-
return "warn"; // Default fallback
33-
}
34-
35-
/**
36-
* Get the strictest validation level for a package across all accessible groups
37-
*/
38-
export async function getPackageVaidationLevel(
39-
workspace: Workspace,
40-
descriptor: Descriptor,
41-
): Promise<ValidationLevel> {
42-
const accessibleGroups = (
43-
await findAllGroupsWithSpecificDependency(workspace.project, descriptor)
44-
).map(({ groupName }) => groupName);
45-
46-
if (accessibleGroups.length === 0) {
47-
return "off";
48-
}
49-
50-
const validationLevels: ValidationLevel[] = [];
51-
for (const groupName of accessibleGroups) {
52-
const level = await getGroupValidationLevel(workspace, groupName);
53-
validationLevels.push(level);
54-
}
55-
56-
// Return the strictest level (strict > warn > off)
57-
if (validationLevels.includes("strict")) return "strict";
58-
if (validationLevels.includes("warn")) return "warn";
59-
return "off";
60-
}
61-
628
/**
639
* Check if a package can be used with the catalog protocol
6410
*/
@@ -135,3 +81,57 @@ export async function validateWorkspaceCatalogUsability(
13581

13682
return results;
13783
}
84+
85+
/**
86+
* Get validation level for a specific group (considering inheritance)
87+
*/
88+
async function getGroupValidationLevel(
89+
workspace: Workspace,
90+
groupName: string,
91+
): Promise<ValidationLevel> {
92+
const config = await configReader.readConfiguration(workspace.project);
93+
const validationConfig = config.options?.validation || "warn";
94+
95+
if (typeof validationConfig === "string") {
96+
return validationConfig;
97+
}
98+
99+
// Search inheritance chain for explicit validation setting
100+
const inheritanceChain = getInheritanceChain(groupName);
101+
102+
for (let i = inheritanceChain.length - 1; i >= 0; i--) {
103+
const currentGroup = inheritanceChain[i];
104+
if (validationConfig[currentGroup] !== undefined) {
105+
return validationConfig[currentGroup];
106+
}
107+
}
108+
109+
return "warn"; // Default fallback
110+
}
111+
112+
/**
113+
* Get the strictest validation level for a package across all accessible groups
114+
*/
115+
async function getPackageVaidationLevel(
116+
workspace: Workspace,
117+
descriptor: Descriptor,
118+
): Promise<ValidationLevel> {
119+
const accessibleGroups = (
120+
await findAllGroupsWithSpecificDependency(workspace.project, descriptor)
121+
).map(({ groupName }) => groupName);
122+
123+
if (accessibleGroups.length === 0) {
124+
return "off";
125+
}
126+
127+
const validationLevels: ValidationLevel[] = [];
128+
for (const groupName of accessibleGroups) {
129+
const level = await getGroupValidationLevel(workspace, groupName);
130+
validationLevels.push(level);
131+
}
132+
133+
// Return the strictest level (strict > warn > off)
134+
if (validationLevels.includes("strict")) return "strict";
135+
if (validationLevels.includes("warn")) return "warn";
136+
return "off";
137+
}

0 commit comments

Comments
 (0)