diff --git a/src/utils.ts b/src/utils.ts index 7c1fee8079..3fc608336e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -132,5 +132,23 @@ export async function ensurePackages(packages: (string | undefined)[]): Promise< } export function isInEditorEnv(): boolean { - return !!((process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM) && !process.env.CI) + if (process.env.CI) + return false + if (isInGitHooksOrLintStaged()) + return false + return !!(false + || process.env.VSCODE_PID + || process.env.VSCODE_CWD + || process.env.JETBRAINS_IDE + || process.env.VIM + || process.env.NVIM + ) +} + +export function isInGitHooksOrLintStaged(): boolean { + return !!(false + || process.env.GIT_PARAMS + || process.env.VSCODE_GIT_COMMAND + || process.env.npm_lifecycle_script?.startsWith('lint-staged') + ) }