Skip to content

fix(typescript-estree): infers singleRun as true for project service #11327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😕 I also don't reproduce the failures locally. Even when running completely outside of Nx:

yarn
cd packages/typescript-estree
TYPESCRIPT_ESLINT_PROJECT_SERVICE=true yarn vitest tests/lib/parse.test.ts

This might be a question for @JamesHenry. Maybe some other cache shenanigans are in play?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finalized the general nx config follow ups PR and merged it into here, hopefully that helps, otherwise I'll look more specifically at this branch

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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 ||
(options?.project == null && options?.projectService == 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
Expand Down
8 changes: 8 additions & 0 deletions packages/typescript-estree/tests/lib/inferSingleRun.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,12 @@ describe(inferSingleRun, () => {

expect(actual).toBe(false);
});

it('returns true for project service in single run', () => {
vi.stubEnv('CI', 'true');
// Do not set `project: true` if `projectService: true`
const actual = inferSingleRun({ projectService: true });

expect(actual).toBe(true);
});
});
Loading