From 0aa109815b94b000dfc1ecee20beb1ef5103add8 Mon Sep 17 00:00:00 2001 From: Alexu Date: Sat, 16 Mar 2024 15:36:05 +0800 Subject: [PATCH] fix(typescript-estree): fix the issue of single run inferring in the pnpm repo (#3811) --- .../typescript-estree/src/parseSettings/inferSingleRun.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts index e8a9b020ce8..db64bc21435 100644 --- a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts +++ b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts @@ -35,11 +35,17 @@ export function inferSingleRun(options: TSESTreeOptions | undefined): boolean { // Currently behind a flag while we gather real-world feedback if (options.allowAutomaticSingleRunInference) { + const possibleEslintBinPaths = [ + 'node_modules/.bin/eslint', // npm or yarn repo + 'node_modules/eslint/bin/eslint.js', // pnpm repo + ]; if ( // Default to single runs for CI processes. CI=true is set by most CI providers by default. process.env.CI === 'true' || // This will be true for invocations such as `npx eslint ...` and `./node_modules/.bin/eslint ...` - process.argv[1].endsWith(normalize('node_modules/.bin/eslint')) + possibleEslintBinPaths.some(path => + process.argv[1].endsWith(normalize(path)), + ) ) { return true; }