diff --git a/.claude/agents/lint-fixer.md b/.claude/agents/lint-fixer.md index 68a03ded0..7498e98af 100644 --- a/.claude/agents/lint-fixer.md +++ b/.claude/agents/lint-fixer.md @@ -9,7 +9,7 @@ You are an expert code quality engineer specializing in JavaScript/TypeScript li ## Your Core Workflow 1. **Initial Analysis** - - First, run `npm run lint` to identify all current linting issues (includes Biome style/format checks, TypeScript type checking, and secret detection) + - First, run `npm run lint` to identify all current linting issues (includes Biome style/format checks, oxlint JavaScript/TypeScript linting, TypeScript type checking, and secret detection) - Capture and analyze the complete output, noting error types, locations, and severity - Group related issues to understand patterns of problems @@ -17,7 +17,7 @@ You are an expert code quality engineer specializing in JavaScript/TypeScript li - Before making fixes, examine the affected files using `git diff` to understand recent changes - Review surrounding code to understand the implementation context - Check for similar patterns in the codebase using `rg` to ensure consistency - - Look for any project-specific linting rules in `biome.json` or similar configuration files + - Look for any project-specific linting rules in `biome.json`, `.oxlintrc.json`, or similar configuration files 3. **Strategic Fixing** - Prioritize fixes based on: @@ -33,11 +33,11 @@ You are an expert code quality engineer specializing in JavaScript/TypeScript li - Apply fixes incrementally, testing after each significant change - Preserve the original intent and logic of the code - Maintain or improve code readability - - Follow the project's coding style as defined in `biome.json` + - Follow the project's coding style as defined in `biome.json` and linting rules in `.oxlintrc.json` - Ensure all comments remain in English 5. **Verification** - - After fixing, run `npm run lint` again to confirm all issues are resolved (style, TypeScript, and security checks) + - After fixing, run `npm run lint` again to confirm all issues are resolved (Biome style checks, oxlint JavaScript/TypeScript checks, TypeScript compilation, and security checks) - Run `npm run test` to ensure no functionality was broken - Review your changes with `git diff` to ensure they're appropriate - Document any non-obvious fixes with clear comments @@ -47,7 +47,7 @@ You are an expert code quality engineer specializing in JavaScript/TypeScript li - **Never make blind fixes**: Always understand why a linting error occurs before fixing it - **Preserve functionality**: Linting fixes should never change the behavior of the code - **Maintain consistency**: Look for similar patterns in the codebase and apply consistent fixes -- **Handle auto-fixable vs manual fixes**: Use `npm run lint` which includes auto-fixes via biome, but always review the changes it makes +- **Handle auto-fixable vs manual fixes**: Use `npm run lint` which includes auto-fixes via biome and oxlint, but always review the changes they make - **Edge cases**: Be careful with fixes that might affect: - Type definitions and interfaces - Async/await patterns diff --git a/.claude/commands/code/lint-fix.md b/.claude/commands/code/lint-fix.md index 6af93c7b0..c5829ad17 100644 --- a/.claude/commands/code/lint-fix.md +++ b/.claude/commands/code/lint-fix.md @@ -1,2 +1,2 @@ -Run `npm run lint` and fix any errors that occur. +Use the lint-fixer agent to run `npm run lint` and fix any errors that occur. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40ff65760..db64a8428 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,18 @@ jobs: - run: npm ci - run: npm run lint-biome && git diff --exit-code + lint-oxlint: + name: Lint oxlint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # ratchet:actions/checkout@v4 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # ratchet:actions/setup-node@v4 + with: + node-version-file: .tool-versions + cache: npm + - run: npm ci + - run: npm run lint-oxlint && git diff --exit-code lint-ts: name: Lint TypeScript runs-on: ubuntu-latest diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 000000000..227793a97 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "ignorePatterns": [ + "tests/integration-tests/**/*" + ] +} diff --git a/benchmarks/memory/src/simple-memory-test.ts b/benchmarks/memory/src/simple-memory-test.ts index 8e035cbf1..3d905d576 100644 --- a/benchmarks/memory/src/simple-memory-test.ts +++ b/benchmarks/memory/src/simple-memory-test.ts @@ -36,7 +36,7 @@ function getMemoryMB(): Pick { async function cleanup(): Promise { try { await fs.unlink(path.join(__dirname, '../memory-test-output.txt')); - } catch (error) { + } catch { // Ignore if file doesn't exist } } diff --git a/browser/scripts/generate-icons.ts b/browser/scripts/generate-icons.ts index 21a613774..867ef4329 100644 --- a/browser/scripts/generate-icons.ts +++ b/browser/scripts/generate-icons.ts @@ -2,11 +2,6 @@ import fs from 'node:fs'; import path from 'node:path'; import sharp from 'sharp'; -interface IconSize { - width: number; - height: number; -} - const ICON_SIZES: readonly number[] = [16, 19, 32, 38, 48, 64, 128] as const; const INPUT_SVG_PATH = path.join(__dirname, '../app/images/icon.svg'); const OUTPUT_DIR = path.join(__dirname, '../app/images'); diff --git a/package-lock.json b/package-lock.json index 788f61baf..5d3193b94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "@typescript/native-preview": "^7.0.0-dev.20250708.1", "@vitest/coverage-v8": "^3.1.1", "git-up": "^8.1.1", + "oxlint": "^1.12.0", "rimraf": "^6.0.1", "secretlint": "^9.3.1", "tsx": "^4.19.4", @@ -1016,6 +1017,202 @@ "node": ">= 8" } }, + "node_modules/@oxlint-tsgolint/darwin-arm64": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-0.0.4.tgz", + "integrity": "sha512-qL0zqIYdYrXl6ghTIHnhJkvyYy1eKz0P8YIEp59MjY3/zNiyk/gtyp8LkwZdqb9ezbcX9UDQhSuSO1wURJsq8g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/darwin-x64": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-0.0.4.tgz", + "integrity": "sha512-c3nSjqmDSKzemChAEUv/zy2e9cwgkkO/7rz4Y447+8pSbeZNHi3RrNpVHdrKL/Qep4pt6nFZE+6PoczZxHNQjg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/linux-arm64": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-0.0.4.tgz", + "integrity": "sha512-P2BA54c/Ej5AGkChH1/7zMd6PwZfa+jnw8juB/JWops+BX+lbhbbBHz0cYduDBgWYjRo4e3OVJOTskqcpuMfNw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/linux-x64": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-0.0.4.tgz", + "integrity": "sha512-hbgLpnDNicPrbHOAQ9nNfLOSrUrdWANP/umR7P/cwCc1sv66eEs7bm4G3mrhRU8aXFBJmbhdNqiDSUkYYvHWJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/win32-arm64": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-0.0.4.tgz", + "integrity": "sha512-ozKEppmwZhC5LMedClBEat6cXgBGUvxGOgsKK2ZZNE6zSScX7QbvJAOt3nWMGs8GQshHy/6ndMB33+uRloglQA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint-tsgolint/win32-x64": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-0.0.4.tgz", + "integrity": "sha512-gLfx+qogW21QcaRKFg6ARgra7tSPqyn+Ems3FgTUyxV4OpJYn7KsQroygxOWElqv6JUobtvHBrxdB6YhlvERbQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/darwin-arm64": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/darwin-arm64/-/darwin-arm64-1.12.0.tgz", + "integrity": "sha512-Pv+Ho1uq2ny8g2P6JgQpaIUF1FHPL32DfOlZhKqmzDT3PydtFvZp/7zNyJE3BIXeTOOOG1Eg12hjZHMLsWxyNw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint/darwin-x64": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/darwin-x64/-/darwin-x64-1.12.0.tgz", + "integrity": "sha512-kNXPH/7jXjX4pawrEWXQHOasOdOsrYKhskA1qYwLYcv/COVSoxOSElkQtQa+KxN5zzt3F02kBdWDndLpgJLbLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint/linux-arm64-gnu": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-gnu/-/linux-arm64-gnu-1.12.0.tgz", + "integrity": "sha512-U7NETs02K55ZyDlgdhx4lWeFYbkUKcL+YcG+Ak70EyEt/BKIIVt4B84VdV1JzC71FErUipDYAwPJmxMREXr4Sg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-arm64-musl": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-musl/-/linux-arm64-musl-1.12.0.tgz", + "integrity": "sha512-e4Pb2eZu3V2BsiX4t4gyv9iJ8+KRT6bkoWM5uC9BLX7edsVchwLwL6LB2vPYusYdPPrxdjlFCg6ni+9wlw7FbQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-x64-gnu": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-gnu/-/linux-x64-gnu-1.12.0.tgz", + "integrity": "sha512-qJK98Dj/z7Nbm0xoz0nCCMFGy0W/kLewPzOK5QENxuUoQQ6ymt7/75rXOuTwAZJ6JFTarqfSuMAA0pka6Tmytw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/linux-x64-musl": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-musl/-/linux-x64-musl-1.12.0.tgz", + "integrity": "sha512-jNeltpHc1eonSev/bWKipJ7FI6+Rc7EXh6Y7E0pm8e95sc1klFA29FFVs3FjMA6CCa+SRT0u0nnNTTAtf2QOiQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint/win32-arm64": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/win32-arm64/-/win32-arm64-1.12.0.tgz", + "integrity": "sha512-T3fpNZJ3Q9YGgJTKc1YyvGoomSXnrV5mREz0QACE06zUzfS8EWyaYc/GN17FhHvQ4uQk/1xLgnM6FPsuLMeRhw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/win32-x64": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxlint/win32-x64/-/win32-x64-1.12.0.tgz", + "integrity": "sha512-2eC4XQ1SMM2z7bCDG+Ifrn5GrvP6fkL0FGi4ZwDCrx6fwb1byFrXgSUNIPiqiiqBBrFRMKlXzU9zD6IjuFlUOg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -3922,6 +4119,53 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/oxlint": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.12.0.tgz", + "integrity": "sha512-tBQ9aB00aYLlGXE21WJHnKQAI8xoi2V6Eiz/WvGV7FwU9YLYuNOurEEVbfoS5u0ODX8GLvGWj1fdHh5Rb74Kkw==", + "dev": true, + "license": "MIT", + "bin": { + "oxc_language_server": "bin/oxc_language_server", + "oxlint": "bin/oxlint" + }, + "engines": { + "node": ">=8.*" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxlint/darwin-arm64": "1.12.0", + "@oxlint/darwin-x64": "1.12.0", + "@oxlint/linux-arm64-gnu": "1.12.0", + "@oxlint/linux-arm64-musl": "1.12.0", + "@oxlint/linux-x64-gnu": "1.12.0", + "@oxlint/linux-x64-musl": "1.12.0", + "@oxlint/win32-arm64": "1.12.0", + "@oxlint/win32-x64": "1.12.0", + "oxlint-tsgolint": ">=0.0.1" + } + }, + "node_modules/oxlint-tsgolint": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-0.0.4.tgz", + "integrity": "sha512-KFWVP+VU3ymgK/Dtuf6iRkqjo+aN42lS1YThY6JWlNi1GQqm7wtio/kAwssqDhm8kP+CVXbgZAtu1wgsK4XeTg==", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "tsgolint": "bin/tsgolint.js" + }, + "optionalDependencies": { + "@oxlint-tsgolint/darwin-arm64": "0.0.4", + "@oxlint-tsgolint/darwin-x64": "0.0.4", + "@oxlint-tsgolint/linux-arm64": "0.0.4", + "@oxlint-tsgolint/linux-x64": "0.0.4", + "@oxlint-tsgolint/win32-arm64": "0.0.4", + "@oxlint-tsgolint/win32-x64": "0.0.4" + } + }, "node_modules/p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", diff --git a/package.json b/package.json index 93c00d8b7..87ecf223e 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,9 @@ "scripts": { "build": "rimraf lib && tsc -p tsconfig.build.json --sourceMap --declaration", "build-bun": "bun run build", - "lint": "node --run lint-biome && node --run lint-ts && node --run lint-secretlint", + "lint": "node --run lint-biome && node --run lint-oxlint && node --run lint-ts && node --run lint-secretlint", "lint-biome": "biome check --write", + "lint-oxlint": "oxlint --fix", "lint-ts": "tsgo --noEmit", "lint-secretlint": "secretlint \"**/*\" --secretlintignore .gitignore", "test": "vitest", @@ -108,6 +109,7 @@ "@typescript/native-preview": "^7.0.0-dev.20250708.1", "@vitest/coverage-v8": "^3.1.1", "git-up": "^8.1.1", + "oxlint": "^1.12.0", "rimraf": "^6.0.1", "secretlint": "^9.3.1", "tsx": "^4.19.4", diff --git a/src/cli/actions/initAction.ts b/src/cli/actions/initAction.ts index 4a2b2ec00..4673dd8ce 100644 --- a/src/cli/actions/initAction.ts +++ b/src/cli/actions/initAction.ts @@ -9,7 +9,6 @@ import { defaultFilePathMap, } from '../../config/configSchema.js'; import { getGlobalDirectory } from '../../config/globalDirectory.js'; -import { getVersion } from '../../core/file/packageJsonParse.js'; import { logger } from '../../shared/logger.js'; const onCancelOperation = () => { diff --git a/src/cli/cliRun.ts b/src/cli/cliRun.ts index 8c94b2326..6c2f8bb75 100644 --- a/src/cli/cliRun.ts +++ b/src/cli/cliRun.ts @@ -1,5 +1,5 @@ import process from 'node:process'; -import { Command, Option, program } from 'commander'; +import { Option, program } from 'commander'; import pc from 'picocolors'; import { getVersion } from '../core/file/packageJsonParse.js'; import { RepomixError, handleError } from '../shared/errorHandle.js'; diff --git a/src/core/file/fileManipulate.ts b/src/core/file/fileManipulate.ts index 2b4046960..12dd2831c 100644 --- a/src/core/file/fileManipulate.ts +++ b/src/core/file/fileManipulate.ts @@ -83,8 +83,8 @@ class PythonManipulator extends BaseManipulator { const line = lines[i] + (i !== sz - 1 ? '\n' : ''); buffer += line; if (quoteType === '') { - const indexSingle = line.search(/(? + (rawFile, _index) => ({ rawFile, config, diff --git a/src/core/file/workers/fileProcessWorker.ts b/src/core/file/workers/fileProcessWorker.ts index 1b84cb741..0435592de 100644 --- a/src/core/file/workers/fileProcessWorker.ts +++ b/src/core/file/workers/fileProcessWorker.ts @@ -1,5 +1,5 @@ import type { RepomixConfigMerged } from '../../../config/configSchema.js'; -import { logger, setLogLevelByWorkerData } from '../../../shared/logger.js'; +import { setLogLevelByWorkerData } from '../../../shared/logger.js'; import { processContent } from '../fileProcessContent.js'; import type { ProcessedFile, RawFile } from '../fileTypes.js'; diff --git a/src/core/git/gitCommand.ts b/src/core/git/gitCommand.ts index e136c4768..1fe0db160 100644 --- a/src/core/git/gitCommand.ts +++ b/src/core/git/gitCommand.ts @@ -195,7 +195,10 @@ export const validateGitUrl = (url: string): void => { if (url.startsWith('https://')) { new URL(url); } - } catch (error) { - throw new RepomixError(`Invalid repository URL. Please provide a valid URL: ${url}`); + } catch (error: unknown) { + // Redact embedded credentials in https URLs to avoid PII leakage + const redactedUrl = url.startsWith('https://') ? url.replace(/^(https?:\/\/)([^@/]+)@/i, '$1***@') : url; + logger.trace('Invalid repository URL:', (error as Error).message); + throw new RepomixError(`Invalid repository URL. Please provide a valid URL: ${redactedUrl}`); } }; diff --git a/src/core/git/gitHubArchive.ts b/src/core/git/gitHubArchive.ts index 7b99c4ee6..74ba3e9ee 100644 --- a/src/core/git/gitHubArchive.ts +++ b/src/core/git/gitHubArchive.ts @@ -288,7 +288,7 @@ const processExtractedFiles = async ( } // Sanitize relativePath to prevent path traversal attacks - const sanitized = path.normalize(relativePath).replace(/^(\.\.([\/\\]|$))+/, ''); + const sanitized = path.normalize(relativePath).replace(/^(\.\.([/\\]|$))+/, ''); // Reject absolute paths outright if (path.isAbsolute(sanitized)) { diff --git a/src/core/git/gitRemoteParse.ts b/src/core/git/gitRemoteParse.ts index 326c43e27..920ff1204 100644 --- a/src/core/git/gitRemoteParse.ts +++ b/src/core/git/gitRemoteParse.ts @@ -64,7 +64,7 @@ export const parseRemoteValue = ( repoUrl: repoUrl, remoteBranch: undefined, }; - } catch (error) { + } catch { throw new RepomixError('Invalid remote repository URL or repository shorthand (owner/repo)'); } }; @@ -73,7 +73,7 @@ export const isValidRemoteValue = (remoteValue: string, refs: string[] = []): bo try { parseRemoteValue(remoteValue, refs); return true; - } catch (error) { + } catch { return false; } }; diff --git a/src/core/git/gitRepositoryHandle.ts b/src/core/git/gitRepositoryHandle.ts index cd302e861..b3a159066 100644 --- a/src/core/git/gitRepositoryHandle.ts +++ b/src/core/git/gitRepositoryHandle.ts @@ -33,7 +33,7 @@ export const isGitRepository = async ( try { await deps.execGitRevParse(directory); return true; - } catch (error) { + } catch { return false; } }; diff --git a/src/core/output/outputSort.ts b/src/core/output/outputSort.ts index e30f1ac81..a83daac28 100644 --- a/src/core/output/outputSort.ts +++ b/src/core/output/outputSort.ts @@ -50,7 +50,7 @@ export const sortOutputFiles = async ( const countB = fileChangeCounts[b.path] || 0; return countA - countB; }); - } catch (error) { + } catch { // If git command fails, return original order return files; } diff --git a/src/core/output/outputStyleDecorate.ts b/src/core/output/outputStyleDecorate.ts index 3b1b7cde5..0865a79bc 100644 --- a/src/core/output/outputStyleDecorate.ts +++ b/src/core/output/outputStyleDecorate.ts @@ -46,7 +46,7 @@ export const analyzeContent = (config: RepomixConfigMerged): ContentInfo => { }; }; -export const generateHeader = (config: RepomixConfigMerged, generationDate: string): string => { +export const generateHeader = (config: RepomixConfigMerged, _generationDate: string): string => { const info = analyzeContent(config); // Generate selection description diff --git a/src/core/packager.ts b/src/core/packager.ts index 94ab1b8bf..c7c0df7d2 100644 --- a/src/core/packager.ts +++ b/src/core/packager.ts @@ -1,14 +1,13 @@ import type { RepomixConfigMerged } from '../config/configSchema.js'; -import { RepomixError } from '../shared/errorHandle.js'; import { logMemoryUsage, withMemoryLogging } from '../shared/memoryUtils.js'; import type { RepomixProgressCallback } from '../shared/types.js'; import { type SkippedFileInfo, collectFiles } from './file/fileCollect.js'; import { sortPaths } from './file/filePathSort.js'; import { processFiles } from './file/fileProcess.js'; import { searchFiles } from './file/fileSearch.js'; -import type { ProcessedFile, RawFile } from './file/fileTypes.js'; -import { GitDiffResult, getGitDiffs } from './git/gitDiffHandle.js'; -import { GitLogResult, getGitLogs } from './git/gitLogHandle.js'; +import type { ProcessedFile } from './file/fileTypes.js'; +import { getGitDiffs } from './git/gitDiffHandle.js'; +import { getGitLogs } from './git/gitLogHandle.js'; import { calculateMetrics } from './metrics/calculateMetrics.js'; import { generateOutput } from './output/outputGenerate.js'; import { copyToClipboardIfEnabled } from './packager/copyToClipboardIfEnabled.js'; diff --git a/src/core/security/validateFileSafety.ts b/src/core/security/validateFileSafety.ts index 7be5ba8be..e34ac9da5 100644 --- a/src/core/security/validateFileSafety.ts +++ b/src/core/security/validateFileSafety.ts @@ -1,7 +1,7 @@ import type { RepomixConfigMerged } from '../../config/configSchema.js'; import { logger } from '../../shared/logger.js'; import type { RepomixProgressCallback } from '../../shared/types.js'; -import type { ProcessedFile, RawFile } from '../file/fileTypes.js'; +import type { RawFile } from '../file/fileTypes.js'; import type { GitDiffResult } from '../git/gitDiffHandle.js'; import type { GitLogResult } from '../git/gitLogHandle.js'; import { filterOutUntrustedFiles } from './filterOutUntrustedFiles.js'; diff --git a/src/core/treeSitter/loadLanguage.ts b/src/core/treeSitter/loadLanguage.ts index db370c79b..239d5865e 100644 --- a/src/core/treeSitter/loadLanguage.ts +++ b/src/core/treeSitter/loadLanguage.ts @@ -1,6 +1,5 @@ import fs from 'node:fs/promises'; import { createRequire } from 'node:module'; -import path from 'node:path'; import Parser from 'web-tree-sitter'; const require = createRequire(import.meta.url); diff --git a/src/core/treeSitter/parseFile.ts b/src/core/treeSitter/parseFile.ts index 948409c7d..01947400b 100644 --- a/src/core/treeSitter/parseFile.ts +++ b/src/core/treeSitter/parseFile.ts @@ -1,4 +1,3 @@ -import type { QueryCapture } from 'web-tree-sitter'; import type { RepomixConfigMerged } from '../../config/configSchema.js'; import { logger } from '../../shared/logger.js'; import type { SupportedLang } from './lang2Query.js'; diff --git a/src/core/treeSitter/parseStrategies/CssParseStrategy.ts b/src/core/treeSitter/parseStrategies/CssParseStrategy.ts index 4faf0627d..7413e04fc 100644 --- a/src/core/treeSitter/parseStrategies/CssParseStrategy.ts +++ b/src/core/treeSitter/parseStrategies/CssParseStrategy.ts @@ -6,7 +6,7 @@ export class CssParseStrategy implements ParseStrategy { capture: { node: SyntaxNode; name: string }, lines: string[], processedChunks: Set, - context: ParseContext, + _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; diff --git a/src/core/treeSitter/parseStrategies/DefaultParseStrategy.ts b/src/core/treeSitter/parseStrategies/DefaultParseStrategy.ts index 6c1980232..5f6f390d7 100644 --- a/src/core/treeSitter/parseStrategies/DefaultParseStrategy.ts +++ b/src/core/treeSitter/parseStrategies/DefaultParseStrategy.ts @@ -6,7 +6,7 @@ export class DefaultParseStrategy implements ParseStrategy { capture: { node: SyntaxNode; name: string }, lines: string[], processedChunks: Set, - context: ParseContext, + _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; diff --git a/src/core/treeSitter/parseStrategies/GoParseStrategy.ts b/src/core/treeSitter/parseStrategies/GoParseStrategy.ts index b2ca283f2..1990d6e9e 100644 --- a/src/core/treeSitter/parseStrategies/GoParseStrategy.ts +++ b/src/core/treeSitter/parseStrategies/GoParseStrategy.ts @@ -25,7 +25,7 @@ export class GoParseStrategy implements ParseStrategy { capture: { node: SyntaxNode; name: string }, lines: string[], processedChunks: Set, - context: ParseContext, + _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; diff --git a/src/core/treeSitter/parseStrategies/PythonParseStrategy.ts b/src/core/treeSitter/parseStrategies/PythonParseStrategy.ts index 6893984e8..bf5b23f32 100644 --- a/src/core/treeSitter/parseStrategies/PythonParseStrategy.ts +++ b/src/core/treeSitter/parseStrategies/PythonParseStrategy.ts @@ -19,7 +19,7 @@ export class PythonParseStrategy implements ParseStrategy { capture: { node: SyntaxNode; name: string }, lines: string[], processedChunks: Set, - context: ParseContext, + _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; diff --git a/src/core/treeSitter/parseStrategies/TypeScriptParseStrategy.ts b/src/core/treeSitter/parseStrategies/TypeScriptParseStrategy.ts index 48fab808d..b7b23a108 100644 --- a/src/core/treeSitter/parseStrategies/TypeScriptParseStrategy.ts +++ b/src/core/treeSitter/parseStrategies/TypeScriptParseStrategy.ts @@ -25,7 +25,7 @@ export class TypeScriptParseStrategy implements ParseStrategy { capture: { node: SyntaxNode; name: string }, lines: string[], processedChunks: Set, - context: ParseContext, + _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; diff --git a/src/core/treeSitter/parseStrategies/VueParseStrategy.ts b/src/core/treeSitter/parseStrategies/VueParseStrategy.ts index 1aad8ddbc..6b35d049c 100644 --- a/src/core/treeSitter/parseStrategies/VueParseStrategy.ts +++ b/src/core/treeSitter/parseStrategies/VueParseStrategy.ts @@ -6,7 +6,7 @@ export class VueParseStrategy implements ParseStrategy { capture: { node: SyntaxNode; name: string }, lines: string[], processedChunks: Set, - context: ParseContext, + _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; @@ -23,7 +23,7 @@ export class VueParseStrategy implements ParseStrategy { } const chunk = selectedLines.join('\n'); - const normalizedChunk = chunk.trim(); + const _normalizedChunk = chunk.trim(); // Create a unique ID for this chunk const chunkId = `${name}:${startRow}`; diff --git a/src/mcp/tools/attachPackedOutputTool.ts b/src/mcp/tools/attachPackedOutputTool.ts index f0bd8813e..66211dd68 100644 --- a/src/mcp/tools/attachPackedOutputTool.ts +++ b/src/mcp/tools/attachPackedOutputTool.ts @@ -3,7 +3,6 @@ import path from 'node:path'; import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { z } from 'zod'; -import { generateTreeString } from '../../core/file/fileTreeGenerate.js'; import type { ProcessedFile } from '../../core/file/fileTypes.js'; import { type McpToolMetrics, diff --git a/src/mcp/tools/fileSystemReadFileTool.ts b/src/mcp/tools/fileSystemReadFileTool.ts index b861ce6b3..375567e36 100644 --- a/src/mcp/tools/fileSystemReadFileTool.ts +++ b/src/mcp/tools/fileSystemReadFileTool.ts @@ -3,7 +3,6 @@ import path from 'node:path'; import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { z } from 'zod'; -import type { SuspiciousFileResult } from '../../core/security/securityCheck.js'; import { createSecretLintConfig, runSecretLint } from '../../core/security/workers/securityCheckWorker.js'; import { logger } from '../../shared/logger.js'; import { buildMcpToolErrorResponse, buildMcpToolSuccessResponse } from './mcpToolRuntime.js'; diff --git a/src/mcp/tools/grepRepomixOutputTool.ts b/src/mcp/tools/grepRepomixOutputTool.ts index c78efb815..6e0a08a1f 100644 --- a/src/mcp/tools/grepRepomixOutputTool.ts +++ b/src/mcp/tools/grepRepomixOutputTool.ts @@ -117,7 +117,7 @@ export const registerGrepRepomixOutputTool = (mcpServer: McpServer) => { try { await fs.access(filePath); - } catch (error) { + } catch { return buildMcpToolErrorResponse({ errorMessage: `Error: Output file does not exist at path: ${filePath}. The temporary file may have been cleaned up.`, details: { diff --git a/src/mcp/tools/readRepomixOutputTool.ts b/src/mcp/tools/readRepomixOutputTool.ts index c2c34e33d..062dfecd5 100644 --- a/src/mcp/tools/readRepomixOutputTool.ts +++ b/src/mcp/tools/readRepomixOutputTool.ts @@ -61,7 +61,7 @@ export const registerReadRepomixOutputTool = (mcpServer: McpServer) => { // Check if the file exists try { await fs.access(filePath); - } catch (error) { + } catch { return buildMcpToolErrorResponse({ errorMessage: `Error: Output file does not exist at path: ${filePath}. The temporary file may have been cleaned up.`, }); diff --git a/tests/cli/actions/defaultAction.buildCliConfig.test.ts b/tests/cli/actions/defaultAction.buildCliConfig.test.ts index 53daa1997..ac1ce4292 100644 --- a/tests/cli/actions/defaultAction.buildCliConfig.test.ts +++ b/tests/cli/actions/defaultAction.buildCliConfig.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from 'vitest'; import { buildCliConfig } from '../../../src/cli/actions/defaultAction.js'; import type { CliOptions } from '../../../src/cli/types.js'; -import { RepomixError } from '../../../src/shared/errorHandle.js'; describe('buildCliConfig', () => { describe('tokenCountTree option', () => { diff --git a/tests/cli/actions/defaultAction.test.ts b/tests/cli/actions/defaultAction.test.ts index 7a31dfc86..5401a05fd 100644 --- a/tests/cli/actions/defaultAction.test.ts +++ b/tests/cli/actions/defaultAction.test.ts @@ -644,12 +644,6 @@ describe('defaultAction', () => { tokenCount: { encoding: 'cl100k_base' as const }, }); - const mockCliOptions: CliOptions = { - verbose: false, - progress: true, - stdin: true, - }; - beforeEach(() => { vi.mocked(packager.pack).mockResolvedValue({ totalTokens: 1000, @@ -777,11 +771,6 @@ describe('defaultAction', () => { tokenCount: { encoding: 'cl100k_base' as const }, }); - const mockCliOptions: CliOptions = { - verbose: false, - progress: true, - }; - beforeEach(() => { vi.mocked(packager.pack).mockResolvedValue({ totalTokens: 1000, diff --git a/tests/cli/actions/diffsFlag.test.ts b/tests/cli/actions/diffsFlag.test.ts index d09ce795c..07a0a9e62 100644 --- a/tests/cli/actions/diffsFlag.test.ts +++ b/tests/cli/actions/diffsFlag.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test, vi } from 'vitest'; +import { describe, expect, test } from 'vitest'; import { buildCliConfig } from '../../../src/cli/actions/defaultAction.js'; import type { CliOptions } from '../../../src/cli/types.js'; diff --git a/tests/cli/cliRun.test.ts b/tests/cli/cliRun.test.ts index 4fea9a092..c6e6bcf2c 100644 --- a/tests/cli/cliRun.test.ts +++ b/tests/cli/cliRun.test.ts @@ -6,7 +6,6 @@ import * as remoteAction from '../../src/cli/actions/remoteAction.js'; import * as versionAction from '../../src/cli/actions/versionAction.js'; import { run, runCli } from '../../src/cli/cliRun.js'; import type { CliOptions } from '../../src/cli/types.js'; -import type { RepomixConfigMerged } from '../../src/config/configSchema.js'; import type { PackResult } from '../../src/core/packager.js'; import { type RepomixLogLevel, logger, repomixLogLevels } from '../../src/shared/logger.js'; import { createMockConfig } from '../testing/testUtils.js'; diff --git a/tests/config/configLoad.test.ts b/tests/config/configLoad.test.ts index 7df7aba89..ecd7c8b88 100644 --- a/tests/config/configLoad.test.ts +++ b/tests/config/configLoad.test.ts @@ -2,12 +2,11 @@ import type { Stats } from 'node:fs'; import * as fs from 'node:fs/promises'; import path from 'node:path'; import process from 'node:process'; -import pc from 'picocolors'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { loadFileConfig, mergeConfigs } from '../../src/config/configLoad.js'; import type { RepomixConfigCli, RepomixConfigFile } from '../../src/config/configSchema.js'; import { getGlobalDirectory } from '../../src/config/globalDirectory.js'; -import { RepomixConfigValidationError, RepomixError } from '../../src/shared/errorHandle.js'; +import { RepomixConfigValidationError } from '../../src/shared/errorHandle.js'; import { logger } from '../../src/shared/logger.js'; vi.mock('node:fs/promises'); diff --git a/tests/core/file/fileCollect.test.ts b/tests/core/file/fileCollect.test.ts index 2761ed451..c50d9744c 100644 --- a/tests/core/file/fileCollect.test.ts +++ b/tests/core/file/fileCollect.test.ts @@ -4,7 +4,6 @@ import path from 'node:path'; import iconv from 'iconv-lite'; import { isBinary } from 'istextorbinary'; import jschardet from 'jschardet'; -import pc from 'picocolors'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { collectFiles } from '../../../src/core/file/fileCollect.js'; import type { FileCollectTask } from '../../../src/core/file/workers/fileCollectWorker.js'; @@ -21,7 +20,7 @@ vi.mock('jschardet'); vi.mock('iconv-lite'); vi.mock('../../../src/shared/logger'); -const mockInitTaskRunner = (numOfTasks: number, workerPath: string) => { +const mockInitTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { return (await fileCollectWorker(task as FileCollectTask)) as R; diff --git a/tests/core/file/fileManipulate.test.ts b/tests/core/file/fileManipulate.test.ts index 3f9b76e58..d9a465f2c 100644 --- a/tests/core/file/fileManipulate.test.ts +++ b/tests/core/file/fileManipulate.test.ts @@ -495,11 +495,11 @@ describe('fileManipulate', () => { name: 'Python escaped hash in string', ext: '.py', input: ` - text = "This string contains an \# escaped hash" + text = "This string contains an # escaped hash" # This is a real comment `, expected: ` - text = "This string contains an \# escaped hash" + text = "This string contains an # escaped hash" `, }, @@ -564,12 +564,12 @@ describe('fileManipulate', () => { name: 'Python mixed single and double quotes', ext: '.py', input: ` - x = '\"\"\""' # This is not a docstring start + x = '""""' # This is not a docstring start y = "'''" # Neither is this """But this is a docstring""" `, expected: ` - x = '\"\"\""' + x = '""""' y = "'''" `, diff --git a/tests/core/file/fileProcess.test.ts b/tests/core/file/fileProcess.test.ts index fa1f39236..1237b107c 100644 --- a/tests/core/file/fileProcess.test.ts +++ b/tests/core/file/fileProcess.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it } from 'vitest'; import type { FileManipulator } from '../../../src/core/file/fileManipulate.js'; import { processFiles } from '../../../src/core/file/fileProcess.js'; import { processContent } from '../../../src/core/file/fileProcessContent.js'; @@ -19,7 +19,7 @@ const mockGetFileManipulator = (filePath: string): FileManipulator | null => { return null; }; -const mockInitTaskRunner = (numOfTasks: number, workerPath: string) => { +const mockInitTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { return (await fileProcessWorker(task as FileProcessTask)) as R; diff --git a/tests/core/file/fileSearch.test.ts b/tests/core/file/fileSearch.test.ts index d81faa43a..128faadea 100644 --- a/tests/core/file/fileSearch.test.ts +++ b/tests/core/file/fileSearch.test.ts @@ -2,7 +2,6 @@ import type { Stats } from 'node:fs'; import * as fs from 'node:fs/promises'; import path from 'node:path'; import process from 'node:process'; -import { globby } from 'globby'; import { minimatch } from 'minimatch'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { diff --git a/tests/core/file/fileStdin.test.ts b/tests/core/file/fileStdin.test.ts index 8374b6728..ea9309aec 100644 --- a/tests/core/file/fileStdin.test.ts +++ b/tests/core/file/fileStdin.test.ts @@ -252,8 +252,9 @@ describe('fileStdin', () => { it('should wrap generic errors in RepomixError', async () => { const mockInterface = { - // biome-ignore lint/correctness/useYield: This generator intentionally throws without yielding [Symbol.asyncIterator]: async function* (): AsyncGenerator { + // This generator needs to throw an error for testing, but must yield first to satisfy require-yield + yield 'dummy'; throw new Error('Generic error'); }, }; @@ -288,8 +289,9 @@ describe('fileStdin', () => { it('should handle unknown error types', async () => { const mockInterface = { - // biome-ignore lint/correctness/useYield: This generator intentionally throws without yielding [Symbol.asyncIterator]: async function* (): AsyncGenerator { + // This generator needs to throw an error for testing, but must yield first to satisfy require-yield + yield 'dummy'; throw 'string error'; }, }; diff --git a/tests/core/metrics/calculateMetrics.test.ts b/tests/core/metrics/calculateMetrics.test.ts index 32c41cd2c..63cfc7518 100644 --- a/tests/core/metrics/calculateMetrics.test.ts +++ b/tests/core/metrics/calculateMetrics.test.ts @@ -1,7 +1,6 @@ import { type Mock, describe, expect, it, vi } from 'vitest'; import type { ProcessedFile } from '../../../src/core/file/fileTypes.js'; import type { GitDiffResult } from '../../../src/core/git/gitDiffHandle.js'; -import { TokenCounter } from '../../../src/core/metrics/TokenCounter.js'; import { calculateMetrics } from '../../../src/core/metrics/calculateMetrics.js'; import { calculateSelectiveFileMetrics } from '../../../src/core/metrics/calculateSelectiveFileMetrics.js'; import type { RepomixProgressCallback } from '../../../src/shared/types.js'; diff --git a/tests/core/metrics/calculateOutputMetrics.test.ts b/tests/core/metrics/calculateOutputMetrics.test.ts index 7f97e4c38..4844a54c8 100644 --- a/tests/core/metrics/calculateOutputMetrics.test.ts +++ b/tests/core/metrics/calculateOutputMetrics.test.ts @@ -6,7 +6,7 @@ import { logger } from '../../../src/shared/logger.js'; vi.mock('../../../src/shared/logger'); -const mockInitTaskRunner = (numOfTasks: number, workerPath: string) => { +const mockInitTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { return (await outputMetricsWorker(task as OutputMetricsTask)) as R; @@ -46,9 +46,9 @@ describe('calculateOutputMetrics', () => { const encoding = 'o200k_base'; const mockError = new Error('Worker error'); - const mockErrorTaskRunner = (numOfTasks: number, workerPath: string) => { + const mockErrorTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { - run: async (task: T) => { + run: async (_task: T) => { throw mockError; }, cleanup: async () => { @@ -96,9 +96,9 @@ describe('calculateOutputMetrics', () => { const path = 'large-file.txt'; let chunksProcessed = 0; - const mockParallelTaskRunner = (numOfTasks: number, workerPath: string) => { + const mockParallelTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { - run: async (task: T) => { + run: async (_task: T) => { chunksProcessed++; // Return a fixed token count for each chunk return 100 as R; @@ -122,9 +122,9 @@ describe('calculateOutputMetrics', () => { const encoding = 'o200k_base'; const mockError = new Error('Parallel processing error'); - const mockErrorTaskRunner = (numOfTasks: number, workerPath: string) => { + const mockErrorTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { - run: async (task: T) => { + run: async (_task: T) => { throw mockError; }, cleanup: async () => { @@ -147,7 +147,7 @@ describe('calculateOutputMetrics', () => { const encoding = 'o200k_base'; const processedChunks: string[] = []; - const mockChunkTrackingTaskRunner = (numOfTasks: number, workerPath: string) => { + const mockChunkTrackingTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { const outputTask = task as OutputMetricsTask; @@ -165,7 +165,7 @@ describe('calculateOutputMetrics', () => { }); // Check that chunks are roughly equal in size - const expectedChunkSize = Math.ceil(content.length / 1000); // CHUNK_SIZE is 1000 + const _expectedChunkSize = Math.ceil(content.length / 1000); // CHUNK_SIZE is 1000 const chunkSizes = processedChunks.map((chunk) => chunk.length); expect(processedChunks.length).toBe(1000); // Should have 1000 chunks diff --git a/tests/core/metrics/calculateSelectiveFileMetrics.test.ts b/tests/core/metrics/calculateSelectiveFileMetrics.test.ts index 60d531527..30b9b5dd9 100644 --- a/tests/core/metrics/calculateSelectiveFileMetrics.test.ts +++ b/tests/core/metrics/calculateSelectiveFileMetrics.test.ts @@ -9,7 +9,7 @@ vi.mock('../../shared/processConcurrency', () => ({ getProcessConcurrency: () => 1, })); -const mockInitTaskRunner = (numOfTasks: number, workerPath: string) => { +const mockInitTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { return (await fileMetricsWorker(task as FileMetricsTask)) as R; diff --git a/tests/core/output/diffsInOutput.test.ts b/tests/core/output/diffsInOutput.test.ts index 5056cbfcd..89caf442b 100644 --- a/tests/core/output/diffsInOutput.test.ts +++ b/tests/core/output/diffsInOutput.test.ts @@ -123,7 +123,7 @@ index 123..456 100644 }; // Call generateOutput with mocked deps - const output = await generateOutput(rootDirs, mockConfig, processedFiles, ['file1.js'], gitDiffResult, undefined, { + const _output = await generateOutput(rootDirs, mockConfig, processedFiles, ['file1.js'], gitDiffResult, undefined, { buildOutputGeneratorContext: mockBuildOutputGeneratorContext, generateHandlebarOutput: mockGenerateHandlebarOutput, generateParsableXmlOutput: mockGenerateParsableXmlOutput, @@ -186,7 +186,7 @@ index 123..456 100644 }; // Call generateOutput with mocked deps - const output = await generateOutput(rootDirs, mockConfig, processedFiles, ['file1.js'], gitDiffResult, undefined, { + const _output = await generateOutput(rootDirs, mockConfig, processedFiles, ['file1.js'], gitDiffResult, undefined, { buildOutputGeneratorContext: mockBuildOutputGeneratorContext, generateHandlebarOutput: mockGenerateHandlebarOutput, generateParsableXmlOutput: mockGenerateParsableXmlOutput, diff --git a/tests/core/output/outputGenerateDiffs.test.ts b/tests/core/output/outputGenerateDiffs.test.ts index 6c441a1f6..2882042f6 100644 --- a/tests/core/output/outputGenerateDiffs.test.ts +++ b/tests/core/output/outputGenerateDiffs.test.ts @@ -70,7 +70,7 @@ describe('Output Generation with Diffs', () => { mockConfig.output.parsableStyle = false; // Mock the Handlebars output function to check for diffs in the template - mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, processedFiles) => { + mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, _processedFiles) => { // Verify that the renderContext has the gitDiffs property expect(renderContext.gitDiffWorkTree).toBe(sampleDiff); @@ -138,7 +138,7 @@ describe('Output Generation with Diffs', () => { mockConfig.output.parsableStyle = false; // Mock the Handlebars output function for markdown - mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, processedFiles) => { + mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, _processedFiles) => { // Verify that the renderContext has the gitDiffs property expect(renderContext.gitDiffWorkTree).toBe(sampleDiff); @@ -173,7 +173,7 @@ describe('Output Generation with Diffs', () => { mockConfig.output.parsableStyle = false; // Mock the Handlebars output function for plain text - mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, processedFiles) => { + mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, _processedFiles) => { expect(renderContext.gitDiffWorkTree).toBe(sampleDiff); // Simulate the plain text output @@ -216,7 +216,7 @@ describe('Output Generation with Diffs', () => { })); // Mock the Handlebars output function - mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, processedFiles) => { + mockDeps.generateHandlebarOutput.mockImplementation((config, renderContext: RenderContext, _processedFiles) => { // Verify that the renderContext does not have the gitDiffs property expect(renderContext.gitDiffWorkTree).toBeUndefined(); diff --git a/tests/core/output/outputSort.test.ts b/tests/core/output/outputSort.test.ts index 8b7d3a889..ccf4beee5 100644 --- a/tests/core/output/outputSort.test.ts +++ b/tests/core/output/outputSort.test.ts @@ -1,6 +1,5 @@ import path from 'node:path'; import { describe, expect, test, vi } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import type { ProcessedFile } from '../../../src/core/file/fileTypes.js'; import { sortOutputFiles } from '../../../src/core/output/outputSort.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/output/outputStyles/markdownStyle.test.ts b/tests/core/output/outputStyles/markdownStyle.test.ts index 5e485deb9..1366137f9 100644 --- a/tests/core/output/outputStyles/markdownStyle.test.ts +++ b/tests/core/output/outputStyles/markdownStyle.test.ts @@ -1,8 +1,6 @@ import Handlebars from 'handlebars'; import { describe, expect, test } from 'vitest'; -import { generateOutput } from '../../../../src/core/output/outputGenerate.js'; import { getMarkdownTemplate } from '../../../../src/core/output/outputStyles/markdownStyle.js'; -import { createMockConfig } from '../../../testing/testUtils.js'; describe('markdownStyle', () => { describe('getMarkdownTemplate', () => { diff --git a/tests/core/security/securityCheck.test.ts b/tests/core/security/securityCheck.test.ts index ad929a6e9..bfe33e21c 100644 --- a/tests/core/security/securityCheck.test.ts +++ b/tests/core/security/securityCheck.test.ts @@ -39,7 +39,7 @@ const mockFiles: RawFile[] = [ }, ]; -const mockInitTaskRunner = (numOfTasks: number, workerPath: string) => { +const mockInitTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { return (await securityCheckWorker(task as SecurityCheckTask)) as R; diff --git a/tests/core/treeSitter/parseFile.c.test.ts b/tests/core/treeSitter/parseFile.c.test.ts index 4e043d277..4284d8685 100644 --- a/tests/core/treeSitter/parseFile.c.test.ts +++ b/tests/core/treeSitter/parseFile.c.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.comments.test.ts b/tests/core/treeSitter/parseFile.comments.test.ts index 847a0c004..6a8012154 100644 --- a/tests/core/treeSitter/parseFile.comments.test.ts +++ b/tests/core/treeSitter/parseFile.comments.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.cpp.test.ts b/tests/core/treeSitter/parseFile.cpp.test.ts index bd314f8d0..11f6b6a8d 100644 --- a/tests/core/treeSitter/parseFile.cpp.test.ts +++ b/tests/core/treeSitter/parseFile.cpp.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.csharp.test.ts b/tests/core/treeSitter/parseFile.csharp.test.ts index c1797ac42..65d07996e 100644 --- a/tests/core/treeSitter/parseFile.csharp.test.ts +++ b/tests/core/treeSitter/parseFile.csharp.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../../tests/testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.css.test.ts b/tests/core/treeSitter/parseFile.css.test.ts index 42900b1e3..5cf10d92f 100644 --- a/tests/core/treeSitter/parseFile.css.test.ts +++ b/tests/core/treeSitter/parseFile.css.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.go.test.ts b/tests/core/treeSitter/parseFile.go.test.ts index 5e76aaabc..4b7cb1cc6 100644 --- a/tests/core/treeSitter/parseFile.go.test.ts +++ b/tests/core/treeSitter/parseFile.go.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.java.test.ts b/tests/core/treeSitter/parseFile.java.test.ts index 2f3c51298..ddeb71405 100644 --- a/tests/core/treeSitter/parseFile.java.test.ts +++ b/tests/core/treeSitter/parseFile.java.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../../tests/testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.javascript.test.ts b/tests/core/treeSitter/parseFile.javascript.test.ts index c70251514..8e04b9e06 100644 --- a/tests/core/treeSitter/parseFile.javascript.test.ts +++ b/tests/core/treeSitter/parseFile.javascript.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { CHUNK_SEPARATOR, parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.php.test.ts b/tests/core/treeSitter/parseFile.php.test.ts index 10ab66a8b..f34ad9173 100644 --- a/tests/core/treeSitter/parseFile.php.test.ts +++ b/tests/core/treeSitter/parseFile.php.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../../tests/testing/testUtils.js'; @@ -10,7 +9,7 @@ describe('parseFile for PHP', () => { namespace App; -use App\Greeter; +use App\\Greeter; // Define the greeting function function greet($name) { @@ -54,7 +53,7 @@ enum GreeterEnum: string { expect(typeof result).toBe('string'); const expectContents = [ 'namespace App;', - 'use AppGreeter;', + 'use App\\Greeter;', 'function greet($name) {', '// Define the greeting function', '// Print the personalized greeting message', diff --git a/tests/core/treeSitter/parseFile.python.test.ts b/tests/core/treeSitter/parseFile.python.test.ts index cc3b754e0..437fee5c4 100644 --- a/tests/core/treeSitter/parseFile.python.test.ts +++ b/tests/core/treeSitter/parseFile.python.test.ts @@ -1,5 +1,4 @@ -import { beforeEach, describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; +import { describe, expect, test } from 'vitest'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.ruby.test.ts b/tests/core/treeSitter/parseFile.ruby.test.ts index 7fc0de55b..ad29fb337 100644 --- a/tests/core/treeSitter/parseFile.ruby.test.ts +++ b/tests/core/treeSitter/parseFile.ruby.test.ts @@ -1,7 +1,6 @@ import { describe, expect, test } from 'vitest'; import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; -import { createMockConfig } from '../../../tests/testing/testUtils.js'; describe('parseFile for Ruby', () => { test('should parse Ruby correctly', async () => { diff --git a/tests/core/treeSitter/parseFile.rust.test.ts b/tests/core/treeSitter/parseFile.rust.test.ts index c8d325bce..d8f9b5074 100644 --- a/tests/core/treeSitter/parseFile.rust.test.ts +++ b/tests/core/treeSitter/parseFile.rust.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../../tests/testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.swift.test.ts b/tests/core/treeSitter/parseFile.swift.test.ts index dfcc64021..e6c021506 100644 --- a/tests/core/treeSitter/parseFile.swift.test.ts +++ b/tests/core/treeSitter/parseFile.swift.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.test.ts b/tests/core/treeSitter/parseFile.test.ts index e50897fcc..9c2fe61fa 100644 --- a/tests/core/treeSitter/parseFile.test.ts +++ b/tests/core/treeSitter/parseFile.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { CHUNK_SEPARATOR, parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; diff --git a/tests/core/treeSitter/parseFile.typescript.test.ts b/tests/core/treeSitter/parseFile.typescript.test.ts index 1c41a3ec0..355bac02c 100644 --- a/tests/core/treeSitter/parseFile.typescript.test.ts +++ b/tests/core/treeSitter/parseFile.typescript.test.ts @@ -1,10 +1,9 @@ -import { beforeEach, describe, expect, test, vi } from 'vitest'; +import { beforeEach, describe, expect, test } from 'vitest'; import type { Language, Point, Query, SyntaxNode, Tree, TreeCursor } from 'web-tree-sitter'; import type { Edit, Range } from 'web-tree-sitter'; import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { TypeScriptParseStrategy } from '../../../src/core/treeSitter/parseStrategies/TypeScriptParseStrategy.js'; -import { createMockConfig } from '../../../tests/testing/testUtils.js'; interface MockContext { fileContent: string; @@ -158,26 +157,26 @@ describe('TypeScript File Parsing', () => { gotoParent(): boolean { return false; }, - gotoFirstChildForIndex(index: number): boolean { + gotoFirstChildForIndex(_index: number): boolean { return false; }, - gotoFirstChildForPosition(goalPosition: Point): boolean { + gotoFirstChildForPosition(_goalPosition: Point): boolean { return false; }, - gotoDescendant(goalDescendantIndex: number): boolean { + gotoDescendant(_goalDescendantIndex: number): boolean { return false; }, reset(): void {}, - resetTo(cursor: TreeCursor): void {}, + resetTo(_cursor: TreeCursor): void {}, delete(): void {}, }; const mockTree: Tree = { rootNode: {} as SyntaxNode, - rootNodeWithOffset(offsetBytes: number, offsetExtent: Point): SyntaxNode { + rootNodeWithOffset(_offsetBytes: number, _offsetExtent: Point): SyntaxNode { return {} as SyntaxNode; }, - getChangedRanges(other: Tree): Range[] { + getChangedRanges(_other: Tree): Range[] { return []; }, getIncludedRanges(): Range[] { @@ -187,7 +186,7 @@ describe('TypeScript File Parsing', () => { return this; }, delete() {}, - edit(delta: Edit) {}, + edit(_delta: Edit) {}, getLanguage(): Language { return {} as Language; }, diff --git a/tests/core/treeSitter/parseFile.vue.test.ts b/tests/core/treeSitter/parseFile.vue.test.ts index 2835a7aec..37f953861 100644 --- a/tests/core/treeSitter/parseFile.vue.test.ts +++ b/tests/core/treeSitter/parseFile.vue.test.ts @@ -1,6 +1,5 @@ import { describe, expect, test } from 'vitest'; -import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; -import { CHUNK_SEPARATOR, parseFile } from '../../../src/core/treeSitter/parseFile.js'; +import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; describe('parseFile for Vue', () => { diff --git a/tests/integration-tests/packager.test.ts b/tests/integration-tests/packager.test.ts index e8aa97bff..41a2ff079 100644 --- a/tests/integration-tests/packager.test.ts +++ b/tests/integration-tests/packager.test.ts @@ -30,7 +30,7 @@ const fixturesDir = path.join(__dirname, 'fixtures', 'packager'); const inputsDir = path.join(fixturesDir, 'inputs'); const outputsDir = path.join(fixturesDir, 'outputs'); -const mockCollectFileInitTaskRunner = (numOfTasks: number, workerPath: string) => { +const mockCollectFileInitTaskRunner = (_numOfTasks: number, _workerPath: string) => { return { run: async (task: T) => { return (await fileCollectWorker(task as FileCollectTask)) as R; @@ -111,7 +111,7 @@ describe.runIf(!isWindows)('packager integration', () => { initTaskRunner: mockCollectFileInitTaskRunner, }); }, - processFiles: async (rawFiles, config, progressCallback) => { + processFiles: async (rawFiles, config, _progressCallback) => { const processedFiles: ProcessedFile[] = []; for (const rawFile of rawFiles) { processedFiles.push(await fileProcessWorker({ rawFile, config })); @@ -131,7 +131,14 @@ describe.runIf(!isWindows)('packager integration', () => { }, writeOutputToDisk, copyToClipboardIfEnabled, - calculateMetrics: async (processedFiles, output, progressCallback, config, gitDiffResult, gitLogResult) => { + calculateMetrics: async ( + processedFiles, + _output, + _progressCallback, + _config, + _gitDiffResult, + _gitLogResult, + ) => { return { totalFiles: processedFiles.length, totalCharacters: processedFiles.reduce((acc, file) => acc + file.content.length, 0), @@ -160,7 +167,7 @@ describe.runIf(!isWindows)('packager integration', () => { // Read the actual and expected outputs const actualOutput = await fs.readFile(actualOutputPath, 'utf-8'); - const expectedOutput = await fs.readFile(expectedOutputPath, 'utf-8'); + const _expectedOutput = await fs.readFile(expectedOutputPath, 'utf-8'); // Compare the outputs - styles (e.g., XML, plain, markdown) may differ expect(actualOutput).toContain('This file is a merged representation of the entire codebase'); diff --git a/tests/mcp/tools/fileSystemReadDirectoryTool.test.ts b/tests/mcp/tools/fileSystemReadDirectoryTool.test.ts index 1ac1e5db2..a54813572 100644 --- a/tests/mcp/tools/fileSystemReadDirectoryTool.test.ts +++ b/tests/mcp/tools/fileSystemReadDirectoryTool.test.ts @@ -1,15 +1,12 @@ import { promises as fs } from 'node:fs'; -import type { Dirent, Stats } from 'node:fs'; import path from 'node:path'; import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { registerFileSystemReadDirectoryTool } from '../../../src/mcp/tools/fileSystemReadDirectoryTool.js'; -import { logger } from '../../../src/shared/logger.js'; vi.mock('node:fs'); vi.mock('node:path'); -vi.mock('../../../src/shared/logger.js'); describe('FileSystemReadDirectoryTool', () => { const mockServer = { diff --git a/tests/mcp/tools/fileSystemReadFileTool.test.ts b/tests/mcp/tools/fileSystemReadFileTool.test.ts index db16cb8a9..6f3d5ef2f 100644 --- a/tests/mcp/tools/fileSystemReadFileTool.test.ts +++ b/tests/mcp/tools/fileSystemReadFileTool.test.ts @@ -1,17 +1,12 @@ import { promises as fs } from 'node:fs'; -import type { Stats } from 'node:fs'; import path from 'node:path'; import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { beforeEach, describe, expect, test, vi } from 'vitest'; -import { runSecretLint } from '../../../src/core/security/workers/securityCheckWorker.js'; import { registerFileSystemReadFileTool } from '../../../src/mcp/tools/fileSystemReadFileTool.js'; -import { logger } from '../../../src/shared/logger.js'; vi.mock('node:fs'); vi.mock('node:path'); -vi.mock('../../../src/shared/logger.js'); -vi.mock('../../../src/core/security/workers/securityCheckWorker.js'); describe('FileSystemReadFileTool', () => { const mockServer = { diff --git a/tests/mcp/tools/grepRepomixOutputTool.test.ts b/tests/mcp/tools/grepRepomixOutputTool.test.ts index 71c85c80a..fe8a59b67 100644 --- a/tests/mcp/tools/grepRepomixOutputTool.test.ts +++ b/tests/mcp/tools/grepRepomixOutputTool.test.ts @@ -20,17 +20,6 @@ vi.mock('../../../src/mcp/tools/mcpToolRuntime.js', async () => { }; }); -/** - * Search options for grep functionality - */ -interface SearchOptions { - pattern: string; - contextLines: number; - beforeLines: number; - afterLines: number; - ignoreCase: boolean; -} - describe('grepRepomixOutputTool', () => { describe('createRegexPattern', () => { it('should create a case-sensitive regex by default', () => { diff --git a/tests/mcp/tools/mcpToolRuntime.test.ts b/tests/mcp/tools/mcpToolRuntime.test.ts index 59ee96385..974658c21 100644 --- a/tests/mcp/tools/mcpToolRuntime.test.ts +++ b/tests/mcp/tools/mcpToolRuntime.test.ts @@ -2,7 +2,7 @@ import crypto from 'node:crypto'; import fs from 'node:fs/promises'; import os from 'node:os'; import path from 'node:path'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; // Type guard for structured content with result property function hasResult(obj: unknown): obj is { result: string } { diff --git a/website/client/components/utils/resultViewer.ts b/website/client/components/utils/resultViewer.ts index fa807f91d..29883cac0 100644 --- a/website/client/components/utils/resultViewer.ts +++ b/website/client/components/utils/resultViewer.ts @@ -34,7 +34,7 @@ function formatRepositoryName(repository: string): string { return `${owner}-${repo}`; } // For non-GitHub repositories or local files, clean up the name - return repository.replace(/[\/\\]/g, '-').replace(/\.git$/, ''); + return repository.replace(/[/\\]/g, '-').replace(/\.git$/, ''); } /** diff --git a/website/client/components/utils/validation.ts b/website/client/components/utils/validation.ts index 871df7ce1..498870010 100644 --- a/website/client/components/utils/validation.ts +++ b/website/client/components/utils/validation.ts @@ -14,7 +14,7 @@ export function isValidRemoteValue(remoteValue: string): boolean { try { new URL(remoteValue); return true; - } catch (error) { + } catch { return false; } } diff --git a/website/client/composables/useFileUpload.ts b/website/client/composables/useFileUpload.ts index da55d3ed0..f6acd7c9f 100644 --- a/website/client/composables/useFileUpload.ts +++ b/website/client/composables/useFileUpload.ts @@ -222,7 +222,7 @@ export function useFileUpload(config: FileUploadConfig) { try { const files = await collectFilesFromEntry(entry); return await processFiles(files, entry.name); - } catch (error) { + } catch { const errorMsg = 'Failed to process the folder. Please try again or use the browse button.'; errorMessage.value = errorMsg; return { success: false, error: errorMsg }; diff --git a/website/server/src/index.ts b/website/server/src/index.ts index 4f9fe3bff..138209a6a 100644 --- a/website/server/src/index.ts +++ b/website/server/src/index.ts @@ -11,7 +11,7 @@ import type { PackResult } from './types.js'; import { handlePackError } from './utils/errorHandler.js'; import { cloudLogger, createErrorResponse, logError, logInfo, logMemoryUsage } from './utils/logger.js'; import { getProcessConcurrency } from './utils/processConcurrency.js'; -import { calculateLatency, formatLatencyForDisplay } from './utils/time.js'; +import { formatLatencyForDisplay } from './utils/time.js'; // Log server metrics on startup logInfo('Server starting', { diff --git a/website/server/src/schemas/request.ts b/website/server/src/schemas/request.ts index 5e4bda35d..96f6e9c82 100644 --- a/website/server/src/schemas/request.ts +++ b/website/server/src/schemas/request.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; // Regular expression to validate ignore patterns // Allowed characters: alphanumeric, *, ?, /, -, _, ., !, (, ), space, comma -const ignorePatternRegex = /^[a-zA-Z0-9*?\/\-_.,!()\s]*$/; +const ignorePatternRegex = /^[a-zA-Z0-9*?/\-_.,!()\s]*$/; export const packOptionsSchema = z .object({