-
-
Notifications
You must be signed in to change notification settings - Fork 2.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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JoshuaKGoldberg
wants to merge
17
commits into
typescript-eslint:main
Choose a base branch
from
JoshuaKGoldberg:standalone-project-service
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,061
−500
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
17475ae
feat: create standalone project-service, tsconfig-utils packages
JoshuaKGoldberg 2670553
fix: add missing dependency on tsconfig-utils
JoshuaKGoldberg 2fe82d9
chore: correct for Knip reports
JoshuaKGoldberg 7e4902a
lint fixes
JoshuaKGoldberg 59a1d8d
lint fixes
JoshuaKGoldberg e01d316
lint fixes
JoshuaKGoldberg 8a305c9
Merge branch 'main' into standalone-project-service
JoshuaKGoldberg cd550db
Docs and lockfile updates
JoshuaKGoldberg f904504
nit: 'programs', not 'projects'
JoshuaKGoldberg f151e66
Updated y(a)ml files too
JoshuaKGoldberg 03a1ccc
chore: correct tsconfig-utils type-utils config entries
JoshuaKGoldberg abd2315
chore: correct license year
JoshuaKGoldberg c424f73
tests: corrected
JoshuaKGoldberg ef91a38
Lint fixes
JoshuaKGoldberg caa57bb
Lint fixes
JoshuaKGoldberg 12f8d47
Merge branch 'main'
JoshuaKGoldberg 9364664
Merge branch 'main'
JoshuaKGoldberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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 /> |
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 /> |
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. |
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/utils) | ||||||||||
[](https://www.npmjs.com/package/@typescript-eslint/utils) | ||||||||||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
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 --> |
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,64 @@ | ||
{ | ||
"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": { | ||
"build": "tsc -b tsconfig.build.json", | ||
"clean": "tsc -b tsconfig.build.json --clean", | ||
"postclean": "rimraf dist/ src/generated/ coverage/", | ||
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", | ||
"lint": "npx nx lint", | ||
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts", | ||
"check-types": "npx nx typecheck" | ||
}, | ||
"dependencies": { | ||
"@typescript-eslint/tsconfig-utils": "^8.32.1", | ||
"@typescript-eslint/types": "^8.32.1", | ||
"debug": "^4.3.4" | ||
}, | ||
"devDependencies": { | ||
"@vitest/coverage-v8": "^3.1.2", | ||
"prettier": "^3.2.5", | ||
"rimraf": "*", | ||
"typescript": "*", | ||
"vitest": "^3.1.2" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/typescript-eslint" | ||
} | ||
} |
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,13 @@ | ||
{ | ||
"name": "project-service", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "library", | ||
"root": "packages/project-service", | ||
"sourceRoot": "packages/project-service/src", | ||
"targets": { | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"] | ||
} | ||
} | ||
} |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filename is wrong?
TSConfig_Utilsx
?