From 834182a27f8c254be340fa02fc594b9d0cb00804 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Thu, 19 Sep 2024 10:05:06 +0200 Subject: [PATCH] Easy Stricter Build Requirements (#65) --- .github/workflows/pull-request.yaml | 9 +++------ src/paginator.ts | 3 +++ tsconfig.json | 20 +++++++++++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 80a2854..9715a5f 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -8,18 +8,15 @@ on: jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x, 20.x] steps: - name: Checkout code uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: "npm" - run: | yarn @@ -40,7 +37,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: 20 cache: "npm" - run: | yarn diff --git a/src/paginator.ts b/src/paginator.ts index 8aafbc5..5bb2b77 100644 --- a/src/paginator.ts +++ b/src/paginator.ts @@ -66,6 +66,7 @@ export class Paginator { return nextPage; } console.warn("You are already on the last page!"); + return; } async previousPage(): Promise { @@ -75,6 +76,7 @@ export class Paginator { return previousPage; } console.warn("You are already on the first page."); + return; } async lastPage(): Promise { @@ -106,6 +108,7 @@ export class Paginator { console.warn( `Invalid page number requested ${n}: Must be contained in [1, ${this.maxPage()}]`, ); + return; } public getCurrentPageValues(): Page { diff --git a/tsconfig.json b/tsconfig.json index 9e1c70c..377010d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,25 @@ { "compilerOptions": { "target": "ES2020", - "strict": true, + "moduleResolution": "Node", + "declaration": true, "esModuleInterop": true, "resolveJsonModule": true, - "moduleResolution": "node", - "declaration": true, + + "strict": true, + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "rootDir": "src" }, "include": ["src"],