From 891b0879ba9c64a4722b8c0bf9e599a725b6d6df Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 29 Oct 2022 06:25:11 -0700 Subject: [PATCH] fix(typescript-estree): don't allow single-run unless we're in type-aware linting mode (#5893) Co-authored-by: Josh Goldberg --- .../src/parseSettings/inferSingleRun.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts index 723f857ece9..5d765a22ce9 100644 --- a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts +++ b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts @@ -15,6 +15,16 @@ import type { TSESTreeOptions } from '../parser-options'; * @returns Whether this is part of a single run, rather than a long-running process. */ export function inferSingleRun(options: TSESTreeOptions | undefined): boolean { + if ( + // single-run implies type-aware linting - no projects means we can't be in single-run mode + options?.project == null || + // programs passed via options means the user should be managing the programs, so we shouldn't + // be creating our own single-run programs accidentally + options?.programs != null + ) { + return false; + } + // Allow users to explicitly inform us of their intent to perform a single run (or not) with TSESTREE_SINGLE_RUN if (process.env.TSESTREE_SINGLE_RUN === 'false') { return false;