From 475853fb14ad00e3dd14b684f9b9d462e159924c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 1 Jan 2023 23:44:15 +0100 Subject: [PATCH] web: update tsconfig strictness Signed-off-by: Jens Langhammer --- web/package.json | 2 +- web/src/elements/charts/Chart.ts | 4 ++-- web/src/elements/router/RouterOutlet.ts | 1 + web/src/elements/sidebar/SidebarItem.ts | 1 + web/src/user/user-settings/UserSettingsPage.ts | 1 + web/tsconfig.json | 10 ++++++++++ 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/package.json b/web/package.json index 38878fcd2..4f78a86d6 100644 --- a/web/package.json +++ b/web/package.json @@ -12,7 +12,7 @@ "lit-analyse": "lit-analyzer src", "prettier-check": "prettier --check .", "prettier": "prettier --write .", - "tsc": "lingui compile && tsc --strict --noEmit", + "tsc": "lingui compile && tsc --noEmit -p .", "background-image": "npx @squoosh/cli -d src/assets/images --resize '{\"enabled\":true,\"width\":2560,\"method\":\"lanczos3\",\"fitMethod\":\"contain\",\"premultiply\":true,\"linearRGB\":true}' --mozjpeg '{\"quality\":75,\"baseline\":false,\"arithmetic\":false,\"progressive\":true,\"optimize_coding\":true,\"smoothing\":0,\"color_space\":3,\"quant_table\":3,\"trellis_multipass\":false,\"trellis_opt_zero\":false,\"trellis_opt_table\":false,\"trellis_loops\":1,\"auto_subsample\":true,\"chroma_subsample\":2,\"separate_chroma_quality\":false,\"chroma_quality\":75}' src/assets/images/flow_background.jpg" }, "lingui": { diff --git a/web/src/elements/charts/Chart.ts b/web/src/elements/charts/Chart.ts index c0eaabc4b..f1c9c42b6 100644 --- a/web/src/elements/charts/Chart.ts +++ b/web/src/elements/charts/Chart.ts @@ -108,12 +108,12 @@ export abstract class AKChart extends AKElement { const canvas = this.shadowRoot?.querySelector("canvas"); if (!canvas) { console.warn("Failed to get canvas element"); - return false; + return; } const ctx = canvas.getContext("2d"); if (!ctx) { console.warn("failed to get 2d context"); - return false; + return; } this.chart = this.configureChart(r, ctx); }); diff --git a/web/src/elements/router/RouterOutlet.ts b/web/src/elements/router/RouterOutlet.ts index 215b57227..3d738168f 100644 --- a/web/src/elements/router/RouterOutlet.ts +++ b/web/src/elements/router/RouterOutlet.ts @@ -101,6 +101,7 @@ export class RouterOutlet extends AKElement { console.debug("authentik/router: found match ", matchedRoute); return true; } + return false; }); if (!matchedRoute) { console.debug(`authentik/router: route "${activeUrl}" not defined`); diff --git a/web/src/elements/sidebar/SidebarItem.ts b/web/src/elements/sidebar/SidebarItem.ts index da2af9643..a8df29cef 100644 --- a/web/src/elements/sidebar/SidebarItem.ts +++ b/web/src/elements/sidebar/SidebarItem.ts @@ -134,6 +134,7 @@ export class SidebarItem extends AKElement { if (match !== null) { return true; } + return false; }); } diff --git a/web/src/user/user-settings/UserSettingsPage.ts b/web/src/user/user-settings/UserSettingsPage.ts index 1f14e623e..bc71cad75 100644 --- a/web/src/user/user-settings/UserSettingsPage.ts +++ b/web/src/user/user-settings/UserSettingsPage.ts @@ -102,6 +102,7 @@ export class UserSettingsPage extends AKElement { configureUrl=${ifDefined(pwStage[0].configureUrl)} >`; } + return html``; }), )} diff --git a/web/tsconfig.json b/web/tsconfig.json index 0f5b7dd0e..40cff7530 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -33,6 +33,16 @@ "DOM.Iterable", "WebWorker" ], + "noUnusedLocals": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "alwaysStrict": true, + "noImplicitAny": true, "plugins": [ { "name": "ts-lit-plugin",