Skip to content

fix(parser): error when both projectService and project are set #11333

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MariaSolOs
Copy link
Contributor

PR Checklist

Overview

As mentioned in the issue, the docs aren't clear of what the parser will use when both projectService and project are set. When such case is detected, I think it's better to be explicit about the misconfiguration and error as early as possible.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @MariaSolOs!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit a8c4dc1
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6858d2e35e37da0008baaf4e
😎 Deploy Preview https://deploy-preview-11333--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

nx-cloud bot commented Jun 23, 2025

View your CI Pipeline Execution ↗ for commit a8c4dc1.

Command Status Duration Result
nx test typescript-estree --coverage=false ❌ Failed 5s View ↗
nx test eslint-plugin-internal --coverage=false ❌ Failed 3s View ↗
nx test typescript-estree ❌ Failed 30s View ↗
nx run-many -t typecheck ✅ Succeeded 1m 54s View ↗
nx run-many -t lint ✅ Succeeded 10s View ↗
nx run integration-tests:test ✅ Succeeded <1s View ↗
nx run types:build ✅ Succeeded <1s View ↗
nx run generate-configs ✅ Succeeded 5s View ↗
Additional runs (11) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-06-23 04:11:03 UTC

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

These are just notes from quick preliminary review. I think we have a good path forward but should definitely let other team folks weigh in in #11319.

For now, I'll switch this PR to draft so it doesn't show up on the queue. But we can definitely un-draft it once the issue's discussion is done.

@@ -145,6 +145,12 @@ export function createParseSettings(
tsconfigRootDir,
};

if (parseSettings.projectService && tsestreeOptions.project) {
throw new Error(
'Cannot use both projectService and project parser options.',
Copy link
Member

Choose a reason for hiding this comment

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

[Docs] I think users who are enabling both are probably not super familiar with them. We'll need to guide them a bit more. Maybe something like...

Suggested change
'Cannot use both projectService and project parser options.',
'Enabling 'project' does nothing when 'projectService' is already enabled. You can remove 'project'.',

Note that we can't assume project: true rather than string / string[]. Example from the wild, https://sourcegraph.com/github.com/software-mansion/smelter/-/blob/ts/eslint.config.js?L28-35

Copy link
Member

Choose a reason for hiding this comment

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

[Testing] Looks like our own test infrastructure is getting in the way. Both are set because that was easier to do in CI:

- name: Run unit tests for ${{ matrix.package }}
run: yarn nx test ${{ matrix.package }} --coverage=false
env:
CI: true
TYPESCRIPT_ESLINT_PROJECT_SERVICE: true

projectService:
tsestreeOptions.projectService ||
(tsestreeOptions.project &&
tsestreeOptions.projectService !== false &&
process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE === 'true')
? populateProjectService(tsestreeOptions.projectService, {
jsDocParsingMode,
tsconfigRootDir,
})
: undefined,

Maybe we should temporarily give users a way to disable the new error? TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR or some similarly unwieldy name? I'll post in #11319.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft June 30, 2025 20:02
@MariaSolOs
Copy link
Contributor Author

@JoshuaKGoldberg Thanks for the review! I'll wait for further thoughts from other maintainers before I continue working on this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants