chore(tsconfig): ensure complete TypeScript coverage for all project files (#5655)

## Summary
- Added missing directories and files to tsconfig.json to ensure
complete TypeScript type checking coverage
- Expanded config file patterns to include all .mts configuration files
- Verified all 908 TypeScript files in the project are now properly
covered

## Changes
- Added `scripts/**/*.ts` to cover all TypeScript files in scripts
directory (i18n collection, CI/CD scripts)
- Added `build/**/*.ts` to cover customIconCollection.ts and future
build scripts
- Changed `vite.config.mts` to `*.config.mts` to include all vite config
files (vite.electron.config.mts, vite.types.config.mts)

## Test plan
- [x] Run `pnpm typecheck` to verify no TypeScript errors
- [x] Verified all TypeScript files are covered by tsconfig patterns
- [x] browser_tests/ directory confirmed to have its own extending
tsconfig

🤖 Generated with [Claude Code](https://claude.ai/code)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5655-chore-tsconfig-ensure-complete-TypeScript-coverage-for-all-project-files-2736d73d36508103acbadc53ca2b2913)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alexander Brown <drjkl@comfy.org>
Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
snomiao
2025-09-24 01:31:30 +09:00
committed by GitHub
parent d0aee031e9
commit c004a2b8bd
8 changed files with 58 additions and 11 deletions

View File

@@ -3,7 +3,6 @@
"compilerOptions": { "compilerOptions": {
/* Test files should not be compiled */ /* Test files should not be compiled */
"noEmit": true, "noEmit": true,
// "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"resolveJsonModule": true "resolveJsonModule": true

17
build/tsconfig.json Normal file
View File

@@ -0,0 +1,17 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
/* Build scripts configuration */
"noEmit": true,
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true
},
"include": [
"**/*.ts"
]
}

View File

@@ -33,7 +33,13 @@ export default defineConfig([
}, },
parserOptions: { parserOptions: {
parser: tseslint.parser, parser: tseslint.parser,
projectService: true, projectService: {
allowDefaultProject: [
'vite.config.mts',
'vite.electron.config.mts',
'vite.types.config.mts'
]
},
tsConfigRootDir: import.meta.dirname, tsConfigRootDir: import.meta.dirname,
ecmaVersion: 2020, ecmaVersion: 2020,
sourceType: 'module', sourceType: 'module',

View File

@@ -9,9 +9,18 @@ import { normalizeI18nKey } from '../src/utils/formatUtil'
const localePath = './src/locales/en/main.json' const localePath = './src/locales/en/main.json'
const nodeDefsPath = './src/locales/en/nodeDefs.json' const nodeDefsPath = './src/locales/en/nodeDefs.json'
interface WidgetInfo {
name?: string
label?: string
}
interface WidgetLabels {
[key: string]: Record<string, { name: string }>
}
test('collect-i18n-node-defs', async ({ comfyPage }) => { test('collect-i18n-node-defs', async ({ comfyPage }) => {
// Mock view route // Mock view route
comfyPage.page.route('**/view**', async (route) => { await comfyPage.page.route('**/view**', async (route) => {
await route.fulfill({ await route.fulfill({
body: JSON.stringify({}) body: JSON.stringify({})
}) })
@@ -20,6 +29,7 @@ test('collect-i18n-node-defs', async ({ comfyPage }) => {
const nodeDefs: ComfyNodeDefImpl[] = ( const nodeDefs: ComfyNodeDefImpl[] = (
Object.values( Object.values(
await comfyPage.page.evaluate(async () => { await comfyPage.page.evaluate(async () => {
// @ts-expect-error - app is dynamically added to window
const api = window['app'].api as ComfyApi const api = window['app'].api as ComfyApi
return await api.getNodeDefs() return await api.getNodeDefs()
}) })
@@ -52,7 +62,7 @@ test('collect-i18n-node-defs', async ({ comfyPage }) => {
) )
async function extractWidgetLabels() { async function extractWidgetLabels() {
const nodeLabels = {} const nodeLabels: WidgetLabels = {}
for (const nodeDef of nodeDefs) { for (const nodeDef of nodeDefs) {
const inputNames = Object.values(nodeDef.inputs).map( const inputNames = Object.values(nodeDef.inputs).map(
@@ -65,12 +75,15 @@ test('collect-i18n-node-defs', async ({ comfyPage }) => {
const widgetsMappings = await comfyPage.page.evaluate( const widgetsMappings = await comfyPage.page.evaluate(
(args) => { (args) => {
const [nodeName, displayName, inputNames] = args const [nodeName, displayName, inputNames] = args
// @ts-expect-error - LiteGraph is dynamically added to window
const node = window['LiteGraph'].createNode(nodeName, displayName) const node = window['LiteGraph'].createNode(nodeName, displayName)
if (!node.widgets?.length) return {} if (!node.widgets?.length) return {}
return Object.fromEntries( return Object.fromEntries(
node.widgets node.widgets
.filter((w) => w?.name && !inputNames.includes(w.name)) .filter(
.map((w) => [w.name, w.label]) (w: WidgetInfo) => w?.name && !inputNames.includes(w.name)
)
.map((w: WidgetInfo) => [w.name, w.label])
) )
}, },
[nodeDef.name, nodeDef.display_name, inputNames] [nodeDef.name, nodeDef.display_name, inputNames]

View File

@@ -72,7 +72,7 @@ function capture(srcLocaleDir: string, tempBaseDir: string) {
const relativePath = file.replace(srcLocaleDir, '') const relativePath = file.replace(srcLocaleDir, '')
const targetPath = join(tempBaseDir, relativePath) const targetPath = join(tempBaseDir, relativePath)
ensureDir(dirname(targetPath)) ensureDir(dirname(targetPath))
writeFileSync(targetPath, readFileSync(file)) writeFileSync(targetPath, readFileSync(file, 'utf8'))
} }
console.log('Captured current locale files to temp/base/') console.log('Captured current locale files to temp/base/')
} }

14
scripts/tsconfig.json Normal file
View File

@@ -0,0 +1,14 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
/* Script files configuration */
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true
},
"include": [
"**/*.ts"
]
}

View File

@@ -37,7 +37,5 @@
"src/**/*", "src/**/*",
"src/types/**/*.d.ts", "src/types/**/*.d.ts",
"tests-ui/**/*", "tests-ui/**/*",
"vite.config.mts",
"vitest.config.ts",
] ]
} }

View File

@@ -1,5 +1,5 @@
import { Plugin, defineConfig } from 'vite' import { defineConfig, mergeConfig } from 'vite'
import { mergeConfig } from 'vite' import type { Plugin } from 'vite'
import baseConfig from './vite.config.mts' import baseConfig from './vite.config.mts'