-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
tsconfig.json: Specify <root> in "include" and "exclude" for extends configs #51213
Comments
Related: #37227 |
Related: #20110 |
@fatcerberus Consider projects which do not need to update the config in the extends (eg. they just want to include all files of all extensions). These projects can be very common in situations where:
I think there are other scenarios for this type of boilerplate as well. |
Another idea for implementation would be to have a code-based config (ideally Allowing TS / JS configs is a common pattern in developer tooling, and covers many use cases beyond this issue. But I think @mhegazy is against a code-based config Asking whether this can be reconsidered here: #20110 (comment) I will also add this to the issue description above. |
The paths are relative to the tsconfig.json file, making them useless. See microsoft/TypeScript#51213
@fatcerberus It is useful in monorepositories where you share infrastructure configurations across multiple packages. |
I am using a monorepo, there is no way to control the output of relative file, I mean inclue, exclude, outdir, all of them are relative to the base conf. What I need is to have a base conf, that have settings that applies relatively to the current project. |
Considering the severe limitations and perf problems that |
Thanks @sheetalkamat for implementing the
Looks like will be a part of TS 5.5: |
Suggestion
As always, thanks again for all of your hard work on the TypeScript tooling and ecosystem! 🙌
Extends configs (configs referenced from
"extends"
) can specify"include"
and"exclude"
, but they are relative to thetsconfig.json
file (which could be deep innode_modules
) instead of the root of the directory, per theinclude
docs:This means that the following configuration would not work as expected:
tsconfig.json
node_modules/@upleveled/eslint-config-upleveled/templates/tsconfig.json
(this would resolve relative to the
node_modules
deep path, which would be useless)Removal of such broken config can also be seen in the wild here: tsconfig/bases#41
Suggestion 1:
<root>
directory specifierIt would be great to get a
<root>
capability to add toinclude
andexclude
paths to refer to the directory with thepackage.json
file, like Jest's<rootDir>
option:Suggestion 2:
tsconfig.ts
Another idea for implementation would be to have a code-based config (ideally
tsconfig.ts
, as @weswigham mentions in #20110) - I'm guessing this would open up alternative ways to retrieve the root directory of the project.Allowing TS / JS configs is a common pattern in developer tooling, and covers many use cases beyond this issue.
🔍 Search Terms
extends, extended, root directory, root folder, configs, tsconfig
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
In the description above
📃 Motivating Example
In the description above
💻 Use Cases
Workaround
Specify the paths using relative paths:
But here this encodes the directory structure of
node_modules
into the config as well, which is brittle.The text was updated successfully, but these errors were encountered: