fix: Update tsconfigs to resolve IDE type errors (#1150)

This commit is contained in:
Drew Davis 2025-09-11 08:55:14 -04:00 committed by GitHub
parent 5c88c46375
commit 45e8e1b62d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 120 additions and 75 deletions

View file

@ -0,0 +1,7 @@
---
"@hyperdx/common-utils": patch
"@hyperdx/api": patch
"@hyperdx/app": patch
---
fix: Update tsconfigs to resolve IDE type errors

View file

@ -22,10 +22,10 @@ FROM node:${NODE_VERSION}-alpine AS node_base
WORKDIR /app
COPY .yarn ./.yarn
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./tsconfig.base.json ./
COPY ./packages/common-utils ./packages/common-utils
COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/package.json ./packages/api/
COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.test.json ./packages/app/package.json ./packages/app/next.config.js ./packages/app/mdx.d.ts ./packages/app/.eslintrc.js ./packages/app/
COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/tsconfig.build.json ./packages/api/package.json ./packages/api/
COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.js ./packages/app/mdx.d.ts ./packages/app/.eslintrc.js ./packages/app/
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat

View file

@ -5,7 +5,7 @@ module.exports = {
plugins: ['@typescript-eslint', 'prettier', 'simple-import-sort'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json', './tsconfig.test.json'],
project: ['./tsconfig.json'],
},
extends: [
'eslint:recommended',

View file

@ -4,9 +4,9 @@ FROM node:22.16.0-alpine AS base
WORKDIR /app
COPY .yarn ./.yarn
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./tsconfig.base.json ./
COPY ./packages/common-utils ./packages/common-utils
COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/package.json ./packages/api/
COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/tsconfig.build.json ./packages/api/package.json ./packages/api/
RUN yarn install --mode=skip-build && yarn cache clean

View file

@ -93,7 +93,7 @@
"start": "node ./dist/index.js",
"dev": "DOTENV_CONFIG_PATH=.env.development nodemon --signal SIGTERM -e ts,json --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/index.ts",
"dev-task": "DOTENV_CONFIG_PATH=.env.development nodemon --signal SIGTERM -e ts,json --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": "tsc && tsc-alias && esbuild ../../node_modules/@hyperdx/node-opentelemetry/build/src/tracing --bundle --minify --platform=node --outfile=dist/tracing.js && esbuild ./build/src/index.js ./build/src/tasks/index.js --bundle --minify --platform=node --target=node22 --outdir=dist --alias:@='./src' && mkdir -p dist/opamp && cp -r src/opamp/proto dist/opamp/proto && rimraf ./build",
"build": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json && esbuild ../../node_modules/@hyperdx/node-opentelemetry/build/src/tracing --bundle --minify --platform=node --outfile=dist/tracing.js && esbuild ./build/src/index.js ./build/src/tasks/index.js --bundle --minify --platform=node --target=node22 --outdir=dist --alias:@='./src' && mkdir -p dist/opamp && cp -r src/opamp/proto dist/opamp/proto && rimraf ./build",
"lint": "npx eslint --quiet . --ext .ts",
"lint:fix": "npx eslint . --ext .ts --fix",
"ci:lint": "yarn lint && yarn tsc --noEmit",
@ -105,4 +105,4 @@
"dev:migrate-ch": "migrate -database 'clickhouse://localhost:9000?database=default&x-multi-statement=true' -path ./migrations/ch up",
"docgen": "ts-node scripts/generate-api-docs.ts"
}
}
}

View file

@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"include": [
"src",
"migrations",
"scripts"
],
"exclude": [
"node_modules",
"**/*.test.ts"
]
}

View file

@ -1,30 +1,21 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
"@/*": [
"./*"
]
},
"rootDir": ".",
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"lib": ["ES2022", "dom"],
"module": "Node16",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitThis": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"outDir": "build",
"skipLibCheck": false,
"sourceMap": true,
"strict": true,
"target": "ES2022"
},
"include": ["src", "migrations", "scripts"],
"exclude": ["node_modules", "**/*.test.ts"]
}
"include": [
"src",
"migrations",
"scripts"
],
"exclude": [
"node_modules"
]
}

View file

@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules"]
}

View file

@ -4,7 +4,7 @@ module.exports = {
plugins: ['simple-import-sort', '@typescript-eslint', 'prettier'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json', './tsconfig.test.json'],
project: ['./tsconfig.json'],
},
extends: [
'next',

View file

@ -5,9 +5,9 @@ RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY .yarn ./.yarn
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./tsconfig.base.json ./
COPY ./packages/common-utils ./packages/common-utils
COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.test.json ./packages/app/package.json ./packages/app/next.config.js ./packages/app/mdx.d.ts ./packages/app/.eslintrc.js ./packages/app/
COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.js ./packages/app/mdx.d.ts ./packages/app/.eslintrc.js ./packages/app/
RUN yarn install --mode=skip-build && yarn cache clean

View file

@ -21,6 +21,9 @@ module.exports = {
'@hyperdx/instrumentation-sentry-node',
],
},
typescript: {
tsconfigPath: 'tsconfig.build.json',
},
// Ignore otel pkgs warnings
// https://github.com/open-telemetry/opentelemetry-js/issues/4173#issuecomment-1822938936
webpack: (

View file

@ -0,0 +1,13 @@
{
"extends": "./tsconfig.json",
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules",
"**/*.test.ts",
"**/*.test.tsx"
]
}

View file

@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"sourceMap": true,
"skipLibCheck": true,
@ -16,13 +20,26 @@
"isolatedModules": true,
"useUnknownInCatchVariables": false,
"jsx": "preserve",
"types": ["@types/intercom-web", "jest"],
"types": [
"@types/intercom-web",
"jest"
],
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@styles/*": ["styles/*"]
"@/*": [
"src/*"
],
"@styles/*": [
"styles/*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"]
}
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}

View file

@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules"]
}

View file

@ -4,7 +4,7 @@ module.exports = {
plugins: ['@typescript-eslint', 'prettier', 'simple-import-sort'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json', './tsconfig.test.json'],
project: ['./tsconfig.json'],
},
extends: [
'eslint:recommended',

View file

@ -1,30 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
"@/*": [
"./*"
]
},
"allowSyntheticDefaultImports": true,
"declaration": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"lib": ["ES2022", "dom"],
"module": "Node16",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitThis": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"outDir": "build",
"skipLibCheck": false,
"sourceMap": true,
"strict": true,
"target": "ES2022"
},
"include": ["src"],
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"]
}
"include": [
"src"
],
"exclude": [
"node_modules"
]
}

View file

@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules"]
}

25
tsconfig.base.json Normal file
View file

@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "Node16",
"moduleResolution": "node",
"lib": [
"ES2022",
"dom"
],
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitThis": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"skipLibCheck": false,
"sourceMap": true,
"strict": true,
"target": "ES2022",
}
}