Skip to content

Commit

Permalink
fix(typescript-estree): don't allow single-run unless we're in type-a…
Browse files Browse the repository at this point in the history
…ware linting mode (#5893)

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
  • Loading branch information
bradzacher and JoshuaKGoldberg committed Oct 29, 2022
1 parent d806bda commit 891b087
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/typescript-estree/src/parseSettings/inferSingleRun.ts
Expand Up @@ -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;
Expand Down

0 comments on commit 891b087

Please sign in to comment.