Skip to content

Conversation

@MariaSolOs
Copy link
Contributor

@MariaSolOs MariaSolOs commented Jun 23, 2025

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.

@netlify
Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 8363f90
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/68df4123bb5f3300088ee413
😎 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: 89 (🟢 up 11 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (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.

@nx-cloud
Copy link

nx-cloud bot commented Jun 23, 2025

View your CI Pipeline Execution ↗ for commit 8363f90

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

☁️ Nx Cloud last updated this comment at 2025-10-03 03:32:26 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.

@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 :)

@MariaSolOs MariaSolOs marked this pull request as ready for review August 22, 2025 01:04
@codecov
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.96%. Comparing base (f7e672e) to head (8363f90).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11333   +/-   ##
=======================================
  Coverage   90.95%   90.96%           
=======================================
  Files         506      506           
  Lines       51433    51443   +10     
  Branches     8491     8495    +4     
=======================================
+ Hits        46783    46793   +10     
  Misses       4637     4637           
  Partials       13       13           
Flag Coverage Δ
unittest 90.96% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...pt-estree/src/parseSettings/createParseSettings.ts 93.01% <100.00%> (+0.31%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

The source code change looks great. Just requesting adding tests: you should be able to use the existing vi.stubEnv-powered TYPESCRIPT_ESLINT_PROJECT_SERVICE ones around projectService in createParseSettings.test.ts as reference. LMK if that actually doesn't work though!

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Sep 3, 2025
@MariaSolOs MariaSolOs force-pushed the parser-config branch 3 times, most recently from 8f2fe95 to 65acef6 Compare September 6, 2025 23:05
@MariaSolOs
Copy link
Contributor Author

@JoshuaKGoldberg I'm having trouble fixing these tests as I can't reproduce the errors locally. I've been running yarn nx test eslint-plugin-internal from the root of the repo, is that not the right command?

@JoshuaKGoldberg
Copy link
Member

Ah, yes, these come from explicitly setting TYPESCRIPT_ESLINT_PROJECT_SERVICE:

unit_tests_project_service:
name: Run Unit Tests with Project Service

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

I normally run Vitest directly when only a handful of files are failing:

TYPESCRIPT_ESLINT_PROJECT_SERVICE=true yarn vitest packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts

@MariaSolOs
Copy link
Contributor Author

@JoshuaKGoldberg got it, thank you for the hint!

@MariaSolOs MariaSolOs force-pushed the parser-config branch 2 times, most recently from f3f5baa to cf71e1a Compare September 17, 2025 00:42
languageOptions: {
parserOptions: {
project: './tsconfig.json',
projectService: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is the right way to fix the tests in files that just use the RuleTester.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, good question. Ideally we wouldn't have to do anything in the plugin tests themselves. I'm poking around...

Copy link
Member

Choose a reason for hiding this comment

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

OK, yes, this is the right way.

Recapping for posterity: it's not apparent from the naming (sigh) but the TYPESCRIPT_ESLINT_PROJECT_SERVICE env variable's purpose isn't purely to enable projectService. It's to switch project to projectService if project is enabled. But it doesn't apply when project: false is present.

@JoshuaKGoldberg JoshuaKGoldberg removed the awaiting response Issues waiting for a reply from the OP or another party label Sep 22, 2025
@JoshuaKGoldberg JoshuaKGoldberg self-requested a review September 22, 2025 16:22
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Oct 2, 2025

Ok, I think I have a handle on things and am most of the way through normalizing test files to handle the change. I have to step away, but in the meantime filed #11676. Expect more soon. Fun stuff! 🫠

@MariaSolOs
Copy link
Contributor Author

Ok, I think I have a handle on things and am most of the way through normalizing test files to handle the change. I have to step away, but in the meantime filed #11676. Expect more soon. Fun stuff! 🫠

Thanks a lot for the help here! <3

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.

This was a lot more work than I was expecting it to be 🙃. Sorry for "surprise!" gifting you this big of a task @MariaSolOs!

Summarizing what's going on:

  • Previously, if process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE was enabled, rule tests with project set were being switched to projectService
  • With this PR's intended change, that use case errors intentionally
  • I switched typed rule tests from manually calling new RuleTester to using a helper createRuleTesterWithTypes that:
    • If it receives an enabled project, sets projectService: false like before
    • Enables projectService if process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE
    • Otherwise enables project

languageOptions: {
parserOptions: {
project: './tsconfig.json',
projectService: false,
Copy link
Member

Choose a reason for hiding this comment

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

OK, yes, this is the right way.

Recapping for posterity: it's not apparent from the naming (sigh) but the TYPESCRIPT_ESLINT_PROJECT_SERVICE env variable's purpose isn't purely to enable projectService. It's to switch project to projectService if project is enabled. But it doesn't apply when project: false is present.

Comment on lines +28 to +32
// Finally, default to project: true as the standard (legacy) behavior
// See: https://github.com/typescript-eslint/typescript-eslint/issues/11676
else {
parserOptions.project = true;
}
Copy link
Member

Choose a reason for hiding this comment

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

Linking #11676 here so we don't forget: if & when we remove eslint-plugin from the TYPESCRIPT_ESLINT_PROJECT_SERVICE matrix, we could switch the default to projectService: true...

@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team October 3, 2025 03:37
@JoshuaKGoldberg JoshuaKGoldberg dismissed their stale review October 3, 2025 03:38

(I added code myself)

@MariaSolOs
Copy link
Contributor Author

Sorry for "surprise!" gifting you this big of a task @MariaSolOs!

No worries at all! At least I'm relieved that something non-trivial was going on and it wasn't just me having skill issues 😂

Oh my, that tsestreeOptions.project && tsestreeOptions.projectService !== false && process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE === 'true' condition does feel a bit hacky. Besides the tests in this repo, do you think there are projects out in the wild with this setup?

  • I switched typed rule tests from manually calling new RuleTester to using a helper createRuleTesterWithTypes that:

    • If it receives an enabled project, sets projectService: false like before
    • Enables projectService if process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE
    • Otherwise enables project

You're awesome, thank you for all the work here! 🦸

@JoshuaKGoldberg
Copy link
Member

Besides the tests in this repo, do you think there are projects out in the wild with this setup?

I hope not... https://sourcegraph.com/search?q=context:global+TYPESCRIPT_ESLINT_PROJECT_SERVICE+-file:.*node_modules.*+-repo:%5Egithub%5C.com/typescript-eslint/typescript-eslint%24+&patternType=keyword&sm=0 shows none. I suppose we'll never know for sure though. 🤷

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