From 9d85a4f65c9ae2ab6bd3b1edaa8b99fd88504b0f Mon Sep 17 00:00:00 2001 From: Brandon Pereira Date: Fri, 14 Aug 2026 09:55:11 -0600 Subject: [PATCH 1/2] chore(api): clear remaining small ESLint warnings and enforce their rules - Merge the duplicate Express `declare global` namespace blocks in the auth middleware. The namespace + empty-interface augmentation is the required pattern for extending Express types, so it carries a scoped disable comment. - Scope `n/no-process-exit` off for the process entry points (src/index.ts, src/tasks/index.ts), where exiting with a status code on startup failure, task completion, or an uncaught-exception handler is intended. Promotes @typescript-eslint/no-namespace, no-empty-object-type, and n/no-process-exit to error, and lowers the api --max-warnings ceiling. Behavior is unchanged: tsc and knip are clean. --- .changeset/eslint-api-oneoffs.md | 12 ++++++++++++ packages/api/eslint.config.mjs | 15 ++++++++++++--- packages/api/package.json | 2 +- packages/api/src/middleware/auth.ts | 6 ++++-- 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 .changeset/eslint-api-oneoffs.md diff --git a/.changeset/eslint-api-oneoffs.md b/.changeset/eslint-api-oneoffs.md new file mode 100644 index 0000000000..681290c3f2 --- /dev/null +++ b/.changeset/eslint-api-oneoffs.md @@ -0,0 +1,12 @@ +--- +'@hyperdx/api': patch +--- + +Clear the remaining small api ESLint warnings and enforce their rules. Merges +the duplicate Express `declare global` namespace blocks in the auth middleware +(the `namespace` + empty-interface augmentation pattern is required, so it +carries a scoped disable with a comment), and scopes `n/no-process-exit` off for +the process entry points (`src/index.ts`, `src/tasks/index.ts`) where exiting +with a status code is intended. `@typescript-eslint/no-namespace`, +`no-empty-object-type`, and `n/no-process-exit` are promoted to `error` and the +api `--max-warnings` ceiling is lowered. Behavior is unchanged. diff --git a/packages/api/eslint.config.mjs b/packages/api/eslint.config.mjs index 1c7a1f91b9..e5dfaa9697 100644 --- a/packages/api/eslint.config.mjs +++ b/packages/api/eslint.config.mjs @@ -39,11 +39,11 @@ export default [ ...securityPlugin.configs['recommended-legacy'].rules, '@typescript-eslint/ban-ts-comment': 'error', '@typescript-eslint/no-empty-interface': 'off', - '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-empty-object-type': 'error', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-unsafe-type-assertion': 'warn', - '@typescript-eslint/no-namespace': 'warn', + '@typescript-eslint/no-namespace': 'error', '@typescript-eslint/no-unused-vars': [ 'error', { @@ -57,7 +57,7 @@ export default [ tryExtensions: ['.js', '.ts', '.json'], }, ], - 'n/no-process-exit': 'warn', + 'n/no-process-exit': 'error', 'n/no-missing-import': 'off', 'n/no-unpublished-import': [ 'error', @@ -114,4 +114,13 @@ export default [ }, }, }, + { + // Process entry points and the CLI task runner: exiting with a status code + // on startup failure, task completion, or a last-resort uncaught-exception + // handler is the intended behavior here. + files: ['src/index.ts', 'src/tasks/index.ts'], + rules: { + 'n/no-process-exit': 'off', + }, + }, ]; diff --git a/packages/api/package.json b/packages/api/package.json index 211af2740c..48b9dd1344 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -100,7 +100,7 @@ "dev-task": "DOTENV_CONFIG_PATH=.env.development nodemon --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/tasks/index.ts", "build": "rimraf ./build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && cp -r ./src/opamp/proto ./build/opamp/", "build:vercel": "rimraf ./build && tsc -p tsconfig.vercel.json && tsc-alias -p tsconfig.vercel.json && cp -r ./src/opamp/proto ./build/opamp/", - "lint": "npx eslint . --ext .ts --max-warnings 311", + "lint": "npx eslint . --ext .ts --max-warnings 302", "lint:fix": "npx eslint . --ext .ts --fix", "ci:lint": "yarn lint && yarn tsc --noEmit && yarn lint:openapi", "ci:unit": "jest --ci --coverage", diff --git a/packages/api/src/middleware/auth.ts b/packages/api/src/middleware/auth.ts index c96bea0559..4db9840162 100644 --- a/packages/api/src/middleware/auth.ts +++ b/packages/api/src/middleware/auth.ts @@ -12,10 +12,12 @@ import { import logger from '@/utils/logger'; declare global { + // Express type augmentation requires `namespace` + interface merging; there is + // no non-namespace / non-empty-interface equivalent for extending these types. + // eslint-disable-next-line @typescript-eslint/no-namespace namespace Express { + // eslint-disable-next-line @typescript-eslint/no-empty-object-type interface User extends UserDocument {} - } - namespace Express { interface Request { _hdx_connection?: Connection; } From 9cc72e1d87821d23e54161e87c61b4af9bf4acc6 Mon Sep 17 00:00:00 2001 From: Brandon Pereira Date: Fri, 14 Aug 2026 10:16:25 -0600 Subject: [PATCH 2/2] chore(ci): update ratchet baseline for enforced eslint rules --- scripts/ci/ratchet-baseline.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/ci/ratchet-baseline.json b/scripts/ci/ratchet-baseline.json index 2ef206ed52..bf51d83bd0 100644 --- a/scripts/ci/ratchet-baseline.json +++ b/scripts/ci/ratchet-baseline.json @@ -1,12 +1,12 @@ { "api": { - "as-any": 95, - "ts-ignore": 4, - "eslint-disable": 29 + "as-any": 94, + "ts-ignore": 0, + "eslint-disable": 31 }, "app": { "as-any": 215, - "ts-ignore": 11, + "ts-ignore": 0, "eslint-disable": 143 }, "cli": { @@ -16,7 +16,7 @@ }, "common-utils": { "as-any": 116, - "ts-ignore": 5, + "ts-ignore": 0, "eslint-disable": 39 }, "hdx-eval": {