-
-
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
base: main
Are you sure you want to change the base?
Changes from all commits
17475ae
2670553
2fe82d9
7e4902a
59a1d8d
e01d316
8a305c9
cd550db
f904504
f151e66
03a1ccc
abd2315
c424f73
ef91a38
caa57bb
12f8d47
9364664
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 /> |
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 /> |
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. |
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 --> |
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", | ||
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. Same comment |
||
"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" | ||
} | ||
} |
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. Please update this PR to follow the conventions set in |
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}"] | ||
} | ||
} | ||
} |
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
?