Skip to content

Commit ed4d045

Browse files
Fix typescript errors and consolidate dependencies (#56)
1 parent f456655 commit ed4d045

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
"prepare": "husky install"
2222
},
2323
"dependencies": {
24+
"@types/debug": "^4.1.12",
25+
"@types/js-yaml": "^4.0.2",
26+
"@types/jsonld": "^1.5.15",
27+
"@types/markdown-table": "2.0.0",
2428
"axios": "^1.13.5",
2529
"commander": "^14.0.3",
2630
"debug": "^4.4.3",
@@ -41,11 +45,7 @@
4145
},
4246
"devDependencies": {
4347
"@fastify/pre-commit": "^2.2.1",
44-
"@types/debug": "^4.1.12",
4548
"@types/jest": "^29.5.1",
46-
"@types/js-yaml": "^4.0.2",
47-
"@types/jsonld": "^1.5.15",
48-
"@types/markdown-table": "2.0.0",
4949
"@types/node": "^25.2.0",
5050
"@types/unist": "^2.0.6",
5151
"@typescript-eslint/eslint-plugin": "^4.28.3",

src/implementations-update.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function cliProgram({
2828
const implementationMappings = await createImplementationMappings(
2929
implementationPath,
3030
outDir,
31-
testCaseJson
31+
testCaseJson,
3232
);
3333

3434
for (const ruleId of getRuleIds(testCaseJson)) {
@@ -41,7 +41,7 @@ export async function cliProgram({
4141
async function createImplementationMappings(
4242
implementationPath: string,
4343
outDir: string,
44-
testCasesJson: TestCaseJson
44+
testCasesJson: TestCaseJson,
4545
): Promise<ActImplementationReport[]> {
4646
const implementations = loadImplementations(implementationPath);
4747
const implementationMappings: ActImplementationReport[] = [];
@@ -54,7 +54,7 @@ async function createImplementationMappings(
5454
{
5555
name,
5656
vendor,
57-
}
57+
},
5858
);
5959
const filePath = path.resolve(outDir, `${filenameEscape(name)}.json`);
6060
console.log(`Writing file ${filePath}`);
@@ -69,8 +69,14 @@ function loadImplementations(implementationPath: string): Implementation[] {
6969
if (typeof yamlData !== "object" || yamlData === null) {
7070
return [];
7171
}
72+
const yamlRecord = yamlData as Record<string, unknown>;
7273
const implementations: Implementation[] = [];
73-
Object.entries(yamlData).forEach(([name, { vendor, report }]) => {
74+
Object.entries(yamlRecord).forEach(([name, entry]) => {
75+
if (typeof entry !== "object" || entry === null) {
76+
console.warn(`Failed to load ${name}. Properties missing or invalid`);
77+
return;
78+
}
79+
const { vendor, report } = entry as Record<string, unknown>;
7480
if (typeof vendor === "string" && typeof report === "string") {
7581
implementations.push({ name, vendor, report });
7682
} else {

0 commit comments

Comments
 (0)