From 683be31a787e7fbc4d833aa781be850e42ea54b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Thu, 25 Apr 2024 20:55:50 +0200 Subject: [PATCH] Enable compilerOptions noImplicitReturns and noUnusedParameters to improve type safety. (#347) --- lib/bundle.ts | 1 + lib/pointer.ts | 1 + lib/ref.ts | 1 + lib/util/plugins.ts | 1 + lib/util/url.ts | 1 + tsconfig.json | 4 +++- 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/bundle.ts b/lib/bundle.ts index 141b3aa8..92093362 100644 --- a/lib/bundle.ts +++ b/lib/bundle.ts @@ -290,6 +290,7 @@ function findInInventory(inventory: InventoryEntry[], $refParent: any, $refKey: return existingEntry; } } + return undefined } function removeFromInventory(inventory: InventoryEntry[], entry: any) { diff --git a/lib/pointer.ts b/lib/pointer.ts index df63415a..e11feb22 100644 --- a/lib/pointer.ts +++ b/lib/pointer.ts @@ -284,6 +284,7 @@ function resolveIf$Ref(pointer: any, options: any, pathFromRoot?: any) { return true; } } + return undefined } export default Pointer; diff --git a/lib/ref.ts b/lib/ref.ts index 4d8240f7..6ac269f1 100644 --- a/lib/ref.ts +++ b/lib/ref.ts @@ -195,6 +195,7 @@ class $Ref = ParserOpt return true; } } + return undefined } /** diff --git a/lib/util/plugins.ts b/lib/util/plugins.ts index f0d439a9..240cba05 100644 --- a/lib/util/plugins.ts +++ b/lib/util/plugins.ts @@ -45,6 +45,7 @@ export function sort(plugins: Plugin[]) { }); } +// @ts-ignore export interface PluginResult = ParserOptions> { plugin: Plugin; result?: string | Buffer | S; diff --git a/lib/util/url.ts b/lib/util/url.ts index 8eb7de22..8dc707d4 100644 --- a/lib/util/url.ts +++ b/lib/util/url.ts @@ -68,6 +68,7 @@ export function getProtocol(path: string | undefined) { if (match) { return match[1].toLowerCase(); } + return undefined; } /** diff --git a/tsconfig.json b/tsconfig.json index c030ddf1..875abf37 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,9 @@ "resolveJsonModule": true, "rootDir": ".", "skipLibCheck": true, - "strict": true + "strict": true, + "noImplicitReturns": true, + "noUnusedParameters": true }, "compileOnSave": false, "exclude": ["node_modules", "dist"],