diff --git a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts index 8007e6ccd66..a2a59b585f3 100644 --- a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts +++ b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts @@ -18,13 +18,13 @@ export function inferSingleRun(options: TSESTreeOptions | undefined): boolean { // https://github.com/typescript-eslint/typescript-eslint/issues/9504 // There's no support (yet?) for extraFileExtensions in single-run hosts. // Only watch program hosts and project service can support that. - if (options?.extraFileExtensions?.length) { + if (options?.extraFileExtensions?.length && !options.projectService) { return false; } if ( // single-run implies type-aware linting - no projects means we can't be in single-run mode - options?.project == null || + (options?.project == null && !options?.projectService) || // 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 diff --git a/packages/typescript-estree/tests/lib/inferSingleRun.test.ts b/packages/typescript-estree/tests/lib/inferSingleRun.test.ts index 2fe53da8907..d91cb4ed04c 100644 --- a/packages/typescript-estree/tests/lib/inferSingleRun.test.ts +++ b/packages/typescript-estree/tests/lib/inferSingleRun.test.ts @@ -143,6 +143,17 @@ describe(inferSingleRun, () => { expect(actual).toBe(false); }); + it('returns true when singleRun can be inferred options.extraFileExtensions contains entires with projectService', () => { + vi.stubEnv('CI', 'true'); + + const actual = inferSingleRun({ + extraFileExtensions: ['.vue'], + projectService: true, + }); + + expect(actual).toBe(true); + }); + it('returns false when there is no way to infer singleRun', () => { const actual = inferSingleRun({ programs: null, @@ -157,4 +168,11 @@ describe(inferSingleRun, () => { expect(actual).toBe(false); }); + + it('returns true for project service in single run', () => { + vi.stubEnv('CI', 'true'); + const actual = inferSingleRun({ projectService: true }); + + expect(actual).toBe(true); + }); });
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: