Skip to content

Commit 1f4a181

Browse files
committed
fix(): address comments feedback
1 parent 7674b0f commit 1f4a181

File tree

4 files changed

+1
-10
lines changed

4 files changed

+1
-10
lines changed

packages/angular-mcp-server/src/lib/tools/ds/component/utils/deprecated-css-helpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export async function getDeprecatedCssClasses(
3333

3434
const module = await import(absPath);
3535

36-
// Pure ESM: use export default
3736
const dsComponents = module.default;
3837

3938
if (!Array.isArray(dsComponents)) {

packages/angular-mcp-server/src/lib/validation/ds-components-file-loader.validation.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ export function validateDsComponent(rawComponent: unknown): DsComponent {
2121
}
2222

2323
export function validateDsComponentsArray(rawData: unknown): DsComponentsArray {
24-
// First check if it's an array
2524
if (!Array.isArray(rawData)) {
2625
throw new Error(`Expected array of components, received ${typeof rawData}`);
2726
}
2827

29-
// Validate each component individually for better error messages
3028
const validatedComponents: DsComponent[] = [];
3129
for (let i = 0; i < rawData.length; i++) {
3230
try {
@@ -37,7 +35,6 @@ export function validateDsComponentsArray(rawData: unknown): DsComponentsArray {
3735
}
3836
}
3937

40-
// Final validation with the array schema for completeness
4138
const arrayValidation =
4239
DsComponentsArraySchema.safeParse(validatedComponents);
4340
if (!arrayValidation.success) {
@@ -71,10 +68,8 @@ export async function loadAndValidateDsComponentsFile(
7168
const fileUrl = pathToFileURL(absPath).toString();
7269
const module = await import(fileUrl);
7370

74-
// Pure ESM: use export default
7571
const rawData = module.default;
7672

77-
// Use the granular validation functions
7873
return validateDsComponentsArray(rawData);
7974
} catch (ctx) {
8075
if (
@@ -83,7 +78,7 @@ export async function loadAndValidateDsComponentsFile(
8378
ctx.message.includes('Expected array of components') ||
8479
ctx.message.includes('Component at index'))
8580
) {
86-
throw ctx; // Re-throw validation errors as-is
81+
throw ctx;
8782
}
8883
throw new Error(
8984
`Failed to load configuration file: ${(ctx as Error).message}`,

packages/angular-mcp-server/src/lib/validation/ds-components-file.validation.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export async function validateDeprecatedCssClassesFile(
1616
const fileUrl = pathToFileURL(deprecatedCssClassesAbsPath).toString();
1717
const module = await import(fileUrl);
1818

19-
// Pure ESM: use export default
2019
dsComponents = module.default;
2120
} catch (ctx) {
2221
throw new Error(
@@ -29,7 +28,6 @@ export async function validateDeprecatedCssClassesFile(
2928
);
3029
}
3130

32-
// Validate the schema
3331
const validation = DsComponentsArraySchema.safeParse(dsComponents);
3432
if (!validation.success) {
3533
const actualType = Array.isArray(dsComponents)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from './lib/constants.js';
22
export * from './lib/utils.js';
33

4-
// Explicit exports for commonly used functions
54
export { removeQuotes } from './lib/utils.js';
65
export { QUOTE_REGEX } from './lib/constants.js';

0 commit comments

Comments
 (0)