Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat: create standalone project-service, tsconfig-utils packages#11182
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
JoshuaKGoldberg merged 24 commits intotypescript-eslint:mainfromJoshuaKGoldberg:standalone-project-serviceMay 21, 2025
+1,018 −498
Merged
Changes fromall commits
Commits
Show all changes
24 commits Select commitHold shift + click to select a range
17475ae
feat: create standalone project-service, tsconfig-utils packages
JoshuaKGoldberg2670553
fix: add missing dependency on tsconfig-utils
JoshuaKGoldberg2fe82d9
chore: correct for Knip reports
JoshuaKGoldberg7e4902a
lint fixes
JoshuaKGoldberg59a1d8d
lint fixes
JoshuaKGoldberge01d316
lint fixes
JoshuaKGoldberg8a305c9
Merge branch 'main' into standalone-project-service
JoshuaKGoldbergcd550db
Docs and lockfile updates
JoshuaKGoldbergf904504
nit: 'programs', not 'projects'
JoshuaKGoldbergf151e66
Updated y(a)ml files too
JoshuaKGoldberg03a1ccc
chore: correct tsconfig-utils type-utils config entries
JoshuaKGoldbergabd2315
chore: correct license year
JoshuaKGoldbergc424f73
tests: corrected
JoshuaKGoldbergef91a38
Lint fixes
JoshuaKGoldbergcaa57bb
Lint fixes
JoshuaKGoldberg12f8d47
Merge branch 'main'
JoshuaKGoldberg9364664
Merge branch 'main'
JoshuaKGoldberg3d0e00e
Apply suggestions from code review
JoshuaKGoldberg06f7ae8
filename fix
JoshuaKGoldberg94e5552
an inline disable
JoshuaKGoldbergee2001b
Merge branch 'main' into standalone-project-service
JoshuaKGoldbergba8b507
Remove project.json files, and instead add package.json nx entries
JoshuaKGoldberg5e52cf8
Align scripts
JoshuaKGoldberg572acf5
Remove unnecessary deps
JoshuaKGoldbergFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions.github/ISSUE_TEMPLATE/06-bug-report-other.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions.github/ISSUE_TEMPLATE/07-enhancement-other.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions.github/workflows/ci.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions.github/workflows/semantic-pr-titles.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletionsdocs/packages/Project_Service.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
id: project-service | ||
sidebar_label: project-service | ||
toc_max_heading_level: 3 | ||
--- | ||
import GeneratedDocs from './project-service/generated/index.md'; | ||
# `@typescript-eslint/project-service` | ||
<PackageLink packageName="project-service" scope="@typescript-eslint" /> | ||
> Standalone TypeScript project service wrapper for linting ✨ | ||
The typescript-eslint Project Service is a wrapper around TypeScript's "project service" APIs. | ||
These APIs are what editors such as VS Code use to programmatically "open" files and generate TypeScript programs for type information. | ||
:::note | ||
See [Announcing typescript-eslint v8 > Project Service](/blog/announcing-typescript-eslint-v8#project-service) for more details on how lint users interact with the Project Service. | ||
::: | ||
```ts | ||
import { createProjectService } from '@typescript-eslint/project-service'; | ||
const filePathAbsolute = '/path/to/your/project/index.ts'; | ||
const { service } = createProjectService(); | ||
service.openClientFile(filePathAbsolute); | ||
const scriptInfo = service.getScriptInfo(filePathAbsolute)!; | ||
const program = service | ||
.getDefaultProjectForFile(scriptInfo.fileName, true)! | ||
.getLanguageService(true) | ||
.getProgram()!; | ||
``` | ||
The following documentation is auto-generated from source code. | ||
<GeneratedDocs /> |
17 changes: 17 additions & 0 deletionsdocs/packages/TSConfig_Utils.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
id: tsconfig-utils | ||
sidebar_label: tsconfig-utils | ||
toc_max_heading_level: 3 | ||
--- | ||
import GeneratedDocs from './tsconfig-utils/generated/index.md'; | ||
# `@typescript-eslint/tsconfig-utils` | ||
<PackageLink packageName="tsconfig-utils" scope="@typescript-eslint" /> | ||
> Utilities for collecting TSConfigs for linting scenarios ✨ | ||
The following documentation is auto-generated from source code. | ||
<GeneratedDocs /> |
21 changes: 21 additions & 0 deletionspackages/project-service/LICENSE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
Copyright (c) 2025 typescript-eslint and other contributors | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
12 changes: 12 additions & 0 deletionspackages/project-service/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# `@typescript-eslint/project-service` | ||
> Standalone TypeScript project service wrapper for linting. | ||
[](https://www.npmjs.com/package/@typescript-eslint/project-service) | ||
[](https://www.npmjs.com/package/@typescript-eslint/project-service) | ||
A standalone export of the "Project Service" that powers typed linting for typescript-eslint. | ||
> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. | ||
<!-- Local path for docs: docs/packages/Project_Service.mdx --> |
63 changes: 63 additions & 0 deletionspackages/project-service/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "@typescript-eslint/project-service", | ||
"version": "8.32.1", | ||
"description": "Standalone TypeScript project service wrapper for linting.", | ||
"files": [ | ||
"dist", | ||
"!*.tsbuildinfo", | ||
"package.json", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
"type": "commonjs", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"engines": { | ||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/typescript-eslint/typescript-eslint.git", | ||
"directory": "packages/project-service" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/typescript-eslint/typescript-eslint/issues" | ||
}, | ||
"homepage": "https://typescript-eslint.io", | ||
"license": "MIT", | ||
"keywords": [ | ||
"eslint", | ||
"typescript", | ||
"estree" | ||
], | ||
"scripts": { | ||
"//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", | ||
"build": "yarn run -BT nx build", | ||
"clean": "rimraf dist/ coverage/", | ||
"format": "yarn run -T format", | ||
"lint": "yarn run -BT nx lint", | ||
"test": "yarn run -BT nx test", | ||
"typecheck": "yarn run -BT nx typecheck" | ||
}, | ||
"dependencies": { | ||
"@typescript-eslint/tsconfig-utils": "^8.32.1", | ||
"@typescript-eslint/types": "^8.32.1", | ||
"debug": "^4.3.4" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/typescript-eslint" | ||
}, | ||
"nx": { | ||
"name": "project-service", | ||
"includedScripts": [ | ||
"clean" | ||
] | ||
} | ||
} |
119 changes: 80 additions & 39 deletions...rc/create-program/createProjectService.ts → ...oject-service/src/createProjectService.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.