Skip to content

Commit 9498a6a

Browse files
committed
chore: wip
1 parent 81ce0ce commit 9498a6a

File tree

3 files changed

+2
-39
lines changed

3 files changed

+2
-39
lines changed

bin/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ cli
100100
}
101101
}
102102

103-
const success = await runStagedLint(hook, config, process.cwd(), options?.verbose, options?.autoRestage)
103+
const success = await runStagedLint(hook, config, process.cwd(), options?.verbose ?? false, options?.autoRestage)
104104

105105
if (success) {
106106
log.success('Staged lint completed successfully')

src/git-hooks.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -501,41 +501,6 @@ function _removeHook(hook: string, projectRoot = process.cwd(), verbose = false)
501501
log.success(`Successfully removed the ${hook} hook`)
502502
}
503503

504-
/**
505-
* Runs the staged lint tasks defined in the config file
506-
*/
507-
export async function runStagedLint(hook: string, verbose?: boolean): Promise<boolean> {
508-
const projectRoot = process.cwd()
509-
const configFile = config
510-
511-
if (!configFile) {
512-
console.error(`[ERROR] No configuration found`)
513-
return false
514-
}
515-
516-
const isVerbose = Boolean(verbose ?? VERBOSE)
517-
518-
// First check for hook-specific configuration
519-
if (hook in configFile) {
520-
const hookConfig = configFile[hook as keyof typeof configFile]
521-
if (typeof hookConfig === 'object' && !Array.isArray(hookConfig)) {
522-
const stagedLintConfig = (hookConfig as { stagedLint?: StagedLintConfig; 'staged-lint'?: StagedLintConfig }).stagedLint ||
523-
(hookConfig as { stagedLint?: StagedLintConfig; 'staged-lint'?: StagedLintConfig })['staged-lint']
524-
if (stagedLintConfig) {
525-
return processStagedLint(stagedLintConfig, projectRoot, isVerbose)
526-
}
527-
}
528-
}
529-
530-
// If no hook-specific configuration, check for global staged-lint
531-
if (configFile['staged-lint']) {
532-
return processStagedLint(configFile['staged-lint'], projectRoot, isVerbose)
533-
}
534-
535-
console.error(`[ERROR] No staged lint configuration found for hook ${hook}`)
536-
return false
537-
}
538-
539504
/**
540505
* Validates the config, checks that every git hook or option is named correctly
541506
*/
@@ -566,7 +531,6 @@ const gitHooks: {
566531
checkBunGitHooksInDependencies: typeof checkBunGitHooksInDependencies
567532
getProjectRootDirectoryFromNodeModules: typeof getProjectRootDirectoryFromNodeModules
568533
getGitProjectRoot: typeof getGitProjectRoot
569-
runStagedLint: typeof runStagedLint
570534
getStagedFiles: typeof getStagedFiles
571535
areHooksInstalled: typeof areHooksInstalled
572536
} = {
@@ -576,7 +540,6 @@ const gitHooks: {
576540
checkBunGitHooksInDependencies,
577541
getProjectRootDirectoryFromNodeModules,
578542
getGitProjectRoot,
579-
runStagedLint,
580543
getStagedFiles,
581544
areHooksInstalled
582545
}

test/performance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function stageAll(repoDir: string) {
3131
function runStagedLint(repoDir: string): number {
3232
const start = Date.now()
3333
// Run the CLI directly to ensure config is loaded from cwd
34-
execSync(`bun ${require.resolve('../../bin/cli')} run-staged-lint pre-commit`, {
34+
execSync(`bun ${require.resolve('../bin/cli')} run-staged-lint pre-commit`, {
3535
cwd: repoDir,
3636
stdio: 'ignore',
3737
})

0 commit comments

Comments
 (0)