From 1ab93f45fb80ff065a3746349c898e97592599f4 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 18:09:46 +0000 Subject: [PATCH 1/2] chore: expand lint coverage to cli and config files - Remove global ignores for CLI and config files in eslint.config.js. - Add Node-specific ESLint configuration for CLI and config files. - Scope browser/React rules to src/ directory. - Update tsconfig.json to include CLI and root config files. - Fix linting errors in cli/index.ts. - Add 'globals' package to devDependencies. Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com> --- cli/index.ts | 26 +++++++++++---- eslint.config.js | 85 ++++++++++++++++++++++++++++++++--------------- package-lock.json | 20 +++++++++-- package.json | 1 + tsconfig.json | 15 +++++++-- 5 files changed, 110 insertions(+), 37 deletions(-) diff --git a/cli/index.ts b/cli/index.ts index 24e63fc..fd18017 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -28,7 +28,7 @@ program .command('sync') .description('Sync Markdown files to DB') .argument('', 'directory') - .action(async (dir) => { + .action(async (dir: string) => { console.log(`Syncing from "${dir}"...`); if (!fs.existsSync(dir)) { console.error('Directory not found'); @@ -57,12 +57,17 @@ program console.log('Sync complete.'); }); +interface ExportOptions { + format: string; + output: string; +} + program .command('export') .description('Export data (md, json, site)') .option('-f, --format ', 'format', 'md') .option('-o, --output ', 'output directory', './export') - .action(async (options) => { + .action(async (options: ExportOptions) => { const outDir = options.output; if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true }); @@ -194,13 +199,18 @@ async function exportSite(outDir: string) { fs.writeFileSync(path.join(outDir, 'index.html'), html); } +interface EntityCreateOptions { + type: string; + description?: string; +} + program .command('entity-create') .description('Create entity') .argument('') .option('-t, --type ', 'type', 'concept') .option('-d, --description ', 'description') - .action(async (name, options) => { + .action(async (name: string, options: EntityCreateOptions) => { await ensureDb(); try { const entity = await repository.createEntity({ @@ -210,7 +220,7 @@ program }); console.log(`Created: ${entity.name} [${entity.type}] (ID: ${entity.id})`); } catch (err) { - console.error(`Failed to create entity: ${err}`); + console.error(`Failed to create entity: ${String(err)}`); } }); @@ -229,13 +239,17 @@ program } }); +interface ClaimCreateOptions { + confidence: string; +} + program .command('claim-create') .description('Create claim for entity') .argument('') .argument('') .option('-c, --confidence ', 'confidence', '1.0') - .action(async (entityName, statement, options) => { + .action(async (entityName: string, statement: string, options: ClaimCreateOptions) => { await ensureDb(); const entity = await repository.getEntityByName(entityName); if (!entity || !entity.id) { @@ -250,7 +264,7 @@ program }); console.log(`Claim added to ${entity.name}: ${claim.statement}`); } catch (err) { - console.error(`Failed to create claim: ${err}`); + console.error(`Failed to create claim: ${String(err)}`); } }); diff --git a/eslint.config.js b/eslint.config.js index 43cb6fb..e7234ea 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,6 +4,7 @@ import reactHooks from 'eslint-plugin-react-hooks'; import react from 'eslint-plugin-react'; import jsxA11y from 'eslint-plugin-jsx-a11y'; import reactRefresh from 'eslint-plugin-react-refresh'; +import globals from 'globals'; export default tseslint.config( { @@ -13,18 +14,69 @@ export default tseslint.config( 'playwright-report', 'test-results', '.agents', - 'cli', - '*.cjs', - '*.config.*', ], }, js.configs.recommended, ...tseslint.configs.recommendedTypeChecked, - react.configs.flat.recommended, - react.configs.flat['jsx-runtime'], - jsxA11y.flatConfigs.recommended, + + // App-specific configuration (React) + { + files: ['src/**/*.{ts,tsx}'], + ...react.configs.flat.recommended, + ...react.configs.flat['jsx-runtime'], + plugins: { + ...react.configs.flat.recommended.plugins, + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + 'jsx-a11y': jsxA11y, + }, + rules: { + ...react.configs.flat.recommended.rules, + ...react.configs.flat['jsx-runtime'].rules, + ...reactHooks.configs.recommended.rules, + ...jsxA11y.flatConfigs.recommended.rules, + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], + 'jsx-a11y/click-events-have-key-events': 'warn', + 'jsx-a11y/no-static-element-interactions': 'warn', + 'jsx-a11y/no-noninteractive-element-interactions': 'warn', + 'jsx-a11y/interactive-supports-focus': 'warn', + 'jsx-a11y/role-has-required-aria-props': 'warn', + 'jsx-a11y/role-supports-aria-props': 'warn', + 'jsx-a11y/no-autofocus': 'warn', + 'react/no-unescaped-entities': 'warn', + }, + settings: { + react: { + version: 'detect', + }, + }, + }, + + // CLI and Config Files (Node) { - files: ['**/*.{ts,tsx}'], + files: [ + 'cli/**/*.ts', + '*.config.{js,ts,cjs}', + 'scripts/**/*.ts', + 'vite.config.ts', + 'vitest.config.ts', + 'playwright.config.ts', + ], + languageOptions: { + globals: { + ...globals.node, + }, + }, + rules: { + // Node-specific rule overrides can go here + '@typescript-eslint/no-unsafe-assignment': 'warn', + '@typescript-eslint/no-unsafe-call': 'warn', + '@typescript-eslint/no-unsafe-member-access': 'warn', + } + }, + + { + files: ['**/*.{js,ts,tsx,cjs}'], languageOptions: { parserOptions: { project: ['./tsconfig.json'], @@ -33,13 +85,7 @@ export default tseslint.config( }, }, { - plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, - }, rules: { - ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], '@typescript-eslint/no-non-null-assertion': 'off', @@ -57,19 +103,6 @@ export default tseslint.config( '@typescript-eslint/no-unnecessary-type-assertion': 'warn', '@typescript-eslint/unbound-method': 'warn', '@typescript-eslint/require-await': 'warn', - 'jsx-a11y/click-events-have-key-events': 'warn', - 'jsx-a11y/no-static-element-interactions': 'warn', - 'jsx-a11y/no-noninteractive-element-interactions': 'warn', - 'jsx-a11y/interactive-supports-focus': 'warn', - 'jsx-a11y/role-has-required-aria-props': 'warn', - 'jsx-a11y/role-supports-aria-props': 'warn', - 'jsx-a11y/no-autofocus': 'warn', - 'react/no-unescaped-entities': 'warn', - }, - settings: { - react: { - version: 'detect', - }, }, }, ); diff --git a/package-lock.json b/package-lock.json index 7f7cb10..9ac2c00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.6", + "globals": "^17.6.0", "jsdom": "^29.1.1", "ts-node": "^10.9.2", "typescript": "^5.2.2", @@ -503,6 +504,19 @@ "concat-map": "0.0.1" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", @@ -3348,9 +3362,9 @@ } }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.6.0.tgz", + "integrity": "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 2f971ba..708017c 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.6", + "globals": "^17.6.0", "jsdom": "^29.1.1", "ts-node": "^10.9.2", "typescript": "^5.2.2", diff --git a/tsconfig.json b/tsconfig.json index 15b5f89..cf4379a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "ESNext", "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": false, + "allowJs": true, "skipLibCheck": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, @@ -23,5 +23,16 @@ }, "types": ["vite/client", "node", "vitest/globals"] }, - "include": ["src", "cli", "tests"] + "include": [ + "src", + "cli", + "tests", + "*.config.ts", + "*.config.js", + "*.config.cjs", + "vite.config.ts", + "vitest.config.ts", + "playwright.config.ts", + "eslint.config.js" + ] } From ed4d14717c989a07186cfcee6bee0d439f46339a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 18:44:18 +0000 Subject: [PATCH 2/2] chore: expand lint coverage to cli and config files - Remove global ignores for CLI and config files in eslint.config.js. - Add Node-specific ESLint configuration for CLI and config files. - Scope browser/React rules to src/ directory. - Update cli/index.ts to fix linting errors. - Add 'globals' package to devDependencies. - Integrated with new multi-project tsconfig structure. Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com> --- eslint.config.js | 39 ++++++++++++++++++++++----------------- package.json | 4 ++-- tsconfig.app.json | 12 ++++++++++++ tsconfig.base.json | 25 +++++++++++++++++++++++++ tsconfig.json | 40 +++++----------------------------------- tsconfig.node.json | 27 +++++++++++++++++++++++++++ tsconfig.test.json | 20 ++++++++++++++++++++ vitest.config.ts | 10 ++++++---- 8 files changed, 119 insertions(+), 58 deletions(-) create mode 100644 tsconfig.app.json create mode 100644 tsconfig.base.json create mode 100644 tsconfig.node.json create mode 100644 tsconfig.test.json diff --git a/eslint.config.js b/eslint.config.js index e7234ea..8e0fdb5 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -30,6 +30,12 @@ export default tseslint.config( 'react-refresh': reactRefresh, 'jsx-a11y': jsxA11y, }, + languageOptions: { + parserOptions: { + project: ['./tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, rules: { ...react.configs.flat.recommended.rules, ...react.configs.flat['jsx-runtime'].rules, @@ -52,20 +58,28 @@ export default tseslint.config( }, }, + // Test configuration + { + files: ['tests/**/*.{ts,tsx}', 'src/**/*.test.{ts,tsx}', 'src/**/*.spec.{ts,tsx}', 'src/test/setup.ts'], + languageOptions: { + parserOptions: { + project: ['./tsconfig.test.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, + }, + // CLI and Config Files (Node) { - files: [ - 'cli/**/*.ts', - '*.config.{js,ts,cjs}', - 'scripts/**/*.ts', - 'vite.config.ts', - 'vitest.config.ts', - 'playwright.config.ts', - ], + files: ['cli/**/*.ts', 'scripts/**/*.ts', '*.config.{ts,js,cjs}', '*.config.*.{ts,js,cjs}', 'eslint.config.js'], languageOptions: { globals: { ...globals.node, }, + parserOptions: { + project: ['./tsconfig.node.json'], + tsconfigRootDir: import.meta.dirname, + }, }, rules: { // Node-specific rule overrides can go here @@ -75,15 +89,6 @@ export default tseslint.config( } }, - { - files: ['**/*.{js,ts,tsx,cjs}'], - languageOptions: { - parserOptions: { - project: ['./tsconfig.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, - }, { rules: { '@typescript-eslint/no-explicit-any': 'error', diff --git a/package.json b/package.json index 708017c..1b8159f 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc && vite build", + "build": "tsc -p tsconfig.app.json && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives", "lint:strict": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", @@ -31,7 +31,7 @@ "test:coverage": "vitest run --coverage", "test:e2e": "playwright test", "test:e2e:ci": "npm run build && PLAYWRIGHT_MODE=production playwright test", - "typecheck": "tsc --noEmit", + "typecheck": "tsc -b", "cli": "node --loader ts-node/esm cli/index.ts" }, "dependencies": { diff --git a/tsconfig.app.json b/tsconfig.app.json new file mode 100644 index 0000000..bb5e950 --- /dev/null +++ b/tsconfig.app.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "./dist/types/app", + "types": ["vite/client", "node"] + }, + "include": ["src"], + "exclude": ["src/**/*.test.ts", "src/**/*.spec.ts", "src/**/__tests__/**", "src/test/setup.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000..e4ddf30 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "allowJs": false, + "skipLibCheck": true, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + } +} diff --git a/tsconfig.json b/tsconfig.json index cf4379a..01490aa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,38 +1,8 @@ { - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "module": "ESNext", - "moduleResolution": "Node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - "baseUrl": ".", - "paths": { - "@/*": ["src/*"] - }, - "types": ["vite/client", "node", "vitest/globals"] - }, - "include": [ - "src", - "cli", - "tests", - "*.config.ts", - "*.config.js", - "*.config.cjs", - "vite.config.ts", - "vitest.config.ts", - "playwright.config.ts", - "eslint.config.js" + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" }, + { "path": "./tsconfig.test.json" } ] } diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..e7874c2 --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,27 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "composite": true, + "noEmit": false, + "allowJs": true, + "emitDeclarationOnly": true, + "outDir": "./dist/types/node", + "types": ["node", "vite/client"] + }, + "include": [ + "cli", + "scripts", + "src/db/client.ts", + "src/db/repository.ts", + "src/db/connection-pool.ts", + "src/lib/logger.ts", + "src/lib/errors.ts", + "src/lib/validation.ts", + "vite.config.ts", + "vitest.config.ts", + "playwright.config.ts", + "eslint.config.js", + "commitlint.config.cjs", + "src/test/setup.ts" + ] +} diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..a037dbf --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "./dist/types/test", + "types": ["node", "vitest/globals", "vite/client"] + }, + "include": [ + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/__tests__/**/*", + "src/test/setup.ts", + "tests" + ], + "references": [ + { "path": "./tsconfig.app.json" } + ] +} diff --git a/vitest.config.ts b/vitest.config.ts index 09804be..bb32b21 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -25,10 +25,12 @@ export default defineConfig({ ], // Thresholds are set to reflect the broad inclusion of UI/feature modules // while maintaining a baseline for future growth. - branches: 14, - functions: 16, - lines: 25, - statements: 24, + thresholds: { + branches: 14, + functions: 16, + lines: 25, + statements: 24, + }, }, }, resolve: {