mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Unfuck tsconfigs + VS Code + eslint + tsc, fix type errors
This commit is contained in:
parent
288a3197d2
commit
498eb4f3fc
10 changed files with 83 additions and 67 deletions
|
|
@ -14,7 +14,7 @@ module.exports = tseslint.config(
|
||||||
files: ['src/**/*.ts', 'src/**/*.tsx'],
|
files: ['src/**/*.ts', 'src/**/*.tsx'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ['./tsconfig.json', './tsconfig.client.json', './tsconfig.sw.json', './tsconfig.test.json'],
|
project: ['./tsconfig.server.json', './tsconfig.client.json', './tsconfig.sw.json', './tsconfig.test.json'],
|
||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"build:ci": "node scripts/build-ci.js",
|
"build:ci": "node scripts/build-ci.js",
|
||||||
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
||||||
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
|
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
|
||||||
"typecheck": "tsc --noEmit && tsc --noEmit --project tsconfig.client.json && tsc --noEmit --project tsconfig.sw.json",
|
"typecheck": "tsc --noEmit --project tsconfig.server.json && tsc --noEmit --project tsconfig.client.json && tsc --noEmit --project tsconfig.sw.json",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"test:ci": "vitest run --reporter=verbose",
|
"test:ci": "vitest run --reporter=verbose",
|
||||||
"format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,css,md}'",
|
"format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,css,md}'",
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ export function createSessionRoutes(config: SessionRoutesConfig): Router {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const remoteSessions = await response.json();
|
const remoteSessions = (await response.json()) as Session[];
|
||||||
logger.debug(`got ${remoteSessions.length} sessions from remote ${remote.name}`);
|
logger.debug(`got ${remoteSessions.length} sessions from remote ${remote.name}`);
|
||||||
|
|
||||||
// Track session IDs for this remote
|
// Track session IDs for this remote
|
||||||
|
|
@ -169,7 +169,7 @@ export function createSessionRoutes(config: SessionRoutesConfig): Router {
|
||||||
return res.status(response.status).json(error);
|
return res.status(response.status).json(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = (await response.json()) as { sessionId: string };
|
||||||
logger.debug(`remote session creation took ${Date.now() - startTime}ms`);
|
logger.debug(`remote session creation took ${Date.now() - startTime}ms`);
|
||||||
|
|
||||||
// Track the session in the remote's sessionIds
|
// Track the session in the remote's sessionIds
|
||||||
|
|
@ -543,7 +543,7 @@ export function createSessionRoutes(config: SessionRoutesConfig): Router {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const result = await response.json();
|
const result = (await response.json()) as { cleanedSessions: string[] };
|
||||||
const cleanedSessionIds = result.cleanedSessions || [];
|
const cleanedSessionIds = result.cleanedSessions || [];
|
||||||
const cleanedCount = cleanedSessionIds.length;
|
const cleanedCount = cleanedSessionIds.length;
|
||||||
totalCleaned += cleanedCount;
|
totalCleaned += cleanedCount;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,9 @@ export class HQClient {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorBody = await response.json().catch(() => ({ error: response.statusText }));
|
const errorBody = (await response.json().catch(() => ({ error: response.statusText }))) as {
|
||||||
|
error: string;
|
||||||
|
};
|
||||||
logger.debug(`registration failed with status ${response.status}`, errorBody);
|
logger.debug(`registration failed with status ${response.status}`, errorBody);
|
||||||
throw new Error(`Registration failed: ${errorBody.error || response.statusText}`);
|
throw new Error(`Registration failed: ${errorBody.error || response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
web/tsconfig.base.json
Normal file
18
web/tsconfig.base.json
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"typeRoots": ["./node_modules/@types"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,32 +1,26 @@
|
||||||
{
|
{
|
||||||
|
"extends": "./tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
|
||||||
"module": "ES2020",
|
"module": "ES2020",
|
||||||
"lib": ["ES2020", "dom", "dom.iterable"],
|
"lib": ["ES2020", "dom", "dom.iterable"],
|
||||||
"outDir": "./public",
|
"outDir": "./public",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"inlineSourceMap": false,
|
"inlineSourceMap": false,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
"declaration": false,
|
"declaration": true,
|
||||||
"experimentalDecorators": true,
|
|
||||||
"emitDecoratorMetadata": true,
|
|
||||||
"useDefineForClassFields": false,
|
|
||||||
"composite": true
|
"composite": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/client/**/*"
|
"src/client/**/*",
|
||||||
|
"src/shared/**/*",
|
||||||
|
"src/types/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"dist",
|
"dist",
|
||||||
"src/cli.ts",
|
"src/cli.ts",
|
||||||
"src/client/sw.ts"
|
"src/client/sw.ts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1,37 +1,8 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"files": [],
|
||||||
"target": "ES2020",
|
|
||||||
"module": "CommonJS",
|
|
||||||
"lib": ["ES2020", "dom"],
|
|
||||||
"outDir": "./dist",
|
|
||||||
"rootDir": "./src",
|
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"declaration": false,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"emitDecoratorMetadata": true,
|
|
||||||
"useDefineForClassFields": false,
|
|
||||||
"typeRoots": ["./node_modules/@types"]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src/server/**/*",
|
|
||||||
"src/shared/**/*",
|
|
||||||
"src/types/**/*",
|
|
||||||
"src/cli.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist",
|
|
||||||
"public",
|
|
||||||
"src/client/**/*"
|
|
||||||
],
|
|
||||||
"references": [
|
"references": [
|
||||||
|
{ "path": "./tsconfig.server.json" },
|
||||||
{ "path": "./tsconfig.client.json" },
|
{ "path": "./tsconfig.client.json" },
|
||||||
|
{ "path": "./tsconfig.sw.json" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
27
web/tsconfig.server.json
Normal file
27
web/tsconfig.server.json
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "CommonJS",
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"declaration": true,
|
||||||
|
"types": ["node"],
|
||||||
|
"composite": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/server/**/*",
|
||||||
|
"src/shared/**/*",
|
||||||
|
"src/types/**/*",
|
||||||
|
"src/cli.ts",
|
||||||
|
"src/index.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"public",
|
||||||
|
"src/client/**/*",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -1,25 +1,18 @@
|
||||||
{
|
{
|
||||||
|
"extends": "./tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
|
||||||
"module": "ES2020",
|
"module": "ES2020",
|
||||||
"lib": ["ES2020", "webworker", "webworker.iterable"],
|
"lib": ["ES2020", "webworker", "webworker.iterable"],
|
||||||
"outDir": "./public",
|
"outDir": "./public",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"inlineSourceMap": false,
|
"inlineSourceMap": false,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
"declaration": false,
|
"declaration": true
|
||||||
"experimentalDecorators": true,
|
|
||||||
"useDefineForClassFields": false
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/client/sw.ts"
|
"src/client/sw.ts",
|
||||||
|
"src/shared/**/*",
|
||||||
|
"src/types/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,22 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"types": ["vitest/globals"]
|
"module": "ES2020",
|
||||||
|
"lib": ["ES2020", "dom"],
|
||||||
|
"types": ["vitest/globals", "node"]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.test.ts",
|
"src/**/*.test.ts",
|
||||||
"src/**/*.spec.ts",
|
"src/**/*.spec.ts",
|
||||||
"src/test/**/*"
|
"src/test/**/*",
|
||||||
|
"src/server/**/*",
|
||||||
|
"src/client/**/*",
|
||||||
|
"src/shared/**/*",
|
||||||
|
"src/types/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"public"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue