diff --git a/.github/workflows/lint-ts.yml b/.github/workflows/lint-ts.yml index 99fdef5c6d..73231d450c 100644 --- a/.github/workflows/lint-ts.yml +++ b/.github/workflows/lint-ts.yml @@ -20,8 +20,24 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@v4 + + - uses: ./.github/workflows/lint-ts + with: + package-folder: ./node + name: lint node + + - uses: ./.github/workflows/lint-ts + with: + package-folder: ./benchmarks/node + name: lint benchmark + + - uses: ./.github/workflows/lint-ts + with: + package-folder: ./benchmarks/utilities + name: lint benchmark utilities + - name: lint ts run: | - npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-tsdoc eslint typescript + npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-tsdoc eslint typescript eslint-plugin-import@latest eslint-config-prettier npm i - npx eslint . --max-warnings=0 + npx eslint . diff --git a/.github/workflows/lint-ts/action.yml b/.github/workflows/lint-ts/action.yml new file mode 100644 index 0000000000..d2eff7f9e3 --- /dev/null +++ b/.github/workflows/lint-ts/action.yml @@ -0,0 +1,23 @@ +name: Lint TypeScript + +inputs: + package-folder: + description: "folder that contains the target Cargo.toml file" + required: true + type: string + +runs: + using: "composite" + + steps: + - uses: actions/checkout@v4 + + - run: cp .eslintrc.cjs ${{ inputs.package-folder }} + shell: bash + + - run: | + npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-tsdoc eslint typescript eslint-plugin-import@latest eslint-config-prettier + npm i + npx eslint . --max-warnings=0 + working-directory: ${{ inputs.package-folder }} + shell: bash diff --git a/node/tests/RedisClientInternals.test.ts b/node/tests/RedisClientInternals.test.ts index 5b122c3475..a85ab1ac44 100644 --- a/node/tests/RedisClientInternals.test.ts +++ b/node/tests/RedisClientInternals.test.ts @@ -50,7 +50,7 @@ function sendResponse( const new_response = response.Response.create(); new_response.callbackIdx = callbackIndex; if (responseType == ResponseType.Value) { - const pointer = createLeakedValue(message!); + const pointer = createLeakedValue(message ?? "fake value"); const pointer_number = Number(pointer.toString()); new_response.respPointer = pointer_number; } else if (responseType == ResponseType.ClosingError) { @@ -86,9 +86,7 @@ function getConnectionAndSocket( path.join(os.tmpdir(), `socket_listener`) ); const socketName = path.join(temporaryFolder, "read"); - let connectionPromise: - | Promise - | undefined = undefined; + let connectionPromise: Promise; // eslint-disable-line prefer-const const server = net .createServer(async (socket) => { socket.once("data", (data) => { @@ -105,7 +103,11 @@ function getConnectionAndSocket( sendResponse(socket, ResponseType.Null, 0); }); - const connection = await connectionPromise!; + if (!connectionPromise) { + throw new Error("connectionPromise wasn't set"); + } + + const connection = await connectionPromise; resolve({ connection, socket,