Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/eslint-api-oneoffs.md
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 12 additions & 3 deletions packages/api/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
{
Expand All @@ -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',
Expand Down Expand Up @@ -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',
},
},
];
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions packages/api/src/middleware/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions scripts/ci/ratchet-baseline.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -16,7 +16,7 @@
},
"common-utils": {
"as-any": 116,
"ts-ignore": 5,
"ts-ignore": 0,
"eslint-disable": 39
},
"hdx-eval": {
Expand Down
Loading