From dab35157b0c8670fafb9d8c79270d33c42e51cf0 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 27 Jul 2023 20:44:11 -0400 Subject: [PATCH 1/2] docs: mention EXPERIMENTAL_useProjectService in parser package docs --- docs/packages/Parser.mdx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/packages/Parser.mdx b/docs/packages/Parser.mdx index a4faf2a84460..fdb94f05328e 100644 --- a/docs/packages/Parser.mdx +++ b/docs/packages/Parser.mdx @@ -249,6 +249,33 @@ Please only submit bug reports when using the officially supported version. ============= ``` +### `EXPERIMENTAL_useProjectService` + +An experimental alternative to `parserOptions.project`. +This directs the parser to use a more seamless TypeScript API to generate type information for rules. +It will automatically detect the TSConfig for each file (like `project: true`), and will also allow type information to be computed for JavaScript files without the `allowJs` compiler option (unlike `project: true`). + +```js +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + EXPERIMENTAL_useProjectService: true, + }, +}; +``` + +This option should bring two main benefits: + +- Simpler configurations: most projects shouldn't need to explicitly configure `project` paths or create `tsconfig.eslint.json`s +- Improved performance: this API is optimized on the TypeScript side for speed + - Initial versions of this option demonstrated performance changes in subsets of the typescript-eslint monorepo ranging from 11% slower to 70% faster + +We're hopeful this option will eventually become the standard way to enable typed linting. +It switches the parser from manually creating TypeScript uses the same "project services" API used by editors such as VS Code. +However, because it's so new and untested, we're keeping it under the `EXPERIMENTAL_` prefix for at least all of the `6.X` versions. + +See [feat(typescript-estree): add EXPERIMENTAL_useProjectService option to use TypeScript project service](https://github.com/typescript-eslint/typescript-eslint/pull/6754) for more information. + ## Utilities ### `createProgram(configFile, projectDirectory)` From 9e77dd2f39fd9cbb7c8f3a3cbe54f3f1bcc191f4 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 27 Jul 2023 20:57:18 -0400 Subject: [PATCH 2/2] nit: projects --- docs/packages/Parser.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/packages/Parser.mdx b/docs/packages/Parser.mdx index fdb94f05328e..ad36d3c5d8eb 100644 --- a/docs/packages/Parser.mdx +++ b/docs/packages/Parser.mdx @@ -271,7 +271,7 @@ This option should bring two main benefits: - Initial versions of this option demonstrated performance changes in subsets of the typescript-eslint monorepo ranging from 11% slower to 70% faster We're hopeful this option will eventually become the standard way to enable typed linting. -It switches the parser from manually creating TypeScript uses the same "project services" API used by editors such as VS Code. +It switches the parser from manually creating TypeScript programs to instead calling the same "project services" API used by editors such as VS Code. However, because it's so new and untested, we're keeping it under the `EXPERIMENTAL_` prefix for at least all of the `6.X` versions. See [feat(typescript-estree): add EXPERIMENTAL_useProjectService option to use TypeScript project service](https://github.com/typescript-eslint/typescript-eslint/pull/6754) for more information.