-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enhancement: allow altering the file names that project: true
searches for
#7056
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
Comments
The idea is to mimic what |
One of the reasons we introduced this mode was to remove/lessen the need for Previously with the explicit path pattern it was really hard to split up your lint over multiple processes using monorepo tools like nx because you had to use eslint override configs to specifically set like this: {
overrides: [
{
files: ['package1/**/*.ts'],
parserOptions: {
project: ['package1/tsconfig.json'],
}
},
{
files: ['package2/**/*.ts'],
parserOptions: {
project: ['package2/tsconfig.json'],
}
},
],
} Which was manual and painful to maintain. This meant that people would usually just do the config once like With This is the recommended way to scale linting on a monorepo rather than relying on the out-of-the-box With all that being said - the big question is "why do you still want to use a |
The current reason for not doing
We have per-project |
I would actually say that that's the opposite way to do things - you have a The TS LSP also works in the same way we've designed just looking for the nearest |
FWIW I've found
|
@JoshuaKGoldberg but wouldn't that be solved by doing what I mentioned - inverting the problem? So you'd have Otherwise as I mentioned things might get weird with tools that expect |
It hasn't been an issue. The language service seems to always pick up the root-level |
I guess the question is then - why not invert the problem instead to avoid the eslint-only config? How would your project typecheck tests and such as it stands? Does it use the eslint config to typecheck the non src files? |
Inverting feels weird to me 🤔. I'm accustomed to the root-level
Tests are treated the same as non-test files. They're type checked and compiled normally. In that style of template, |
To me it seems weird to transpile tests - as the project grows this will slow down the build step a lot - which is why we are cautious to exclude them in this project. Imagine if our massive blob of fixtures was included in the transpiration then ignored by the publish - it'd be very slow! Typechecking them - 100%, but transpiling them - no way! |
I guess for inversion IMO what would make the most sense as the "main" tsconfig.json is the main thing they're being used for. While normally I'd consider that builds, if the main tsconfig.json is also used by tsserver for the IDE I could see a reason to have one that touches all files as the main one. I'd consider linting by itself as a weird task to consider as needing the main tsconfig, but in the repo I made this ticket about we do have a lot of libraries that don't build and therefore don't need a main tsconfig file for that purpose. So I moved all of those over and set So basically I'm wondering if there's something beyond linting that will make use of a |
From my understanding the IDE typechecking will look for the nearest tsconfig.json that includes the file or it'll use the settings in the root tsconfig if it doesn't find one and sort of "make do". So it's sort of best effort and the IDE should mostly "just work" no matter your setup. The thing we're looking into now is if we can use the LSP codebase to power our types and replace the manual algorithm we built. If we can then it'd work the same way the IDE does. I'm not sure if we can customise what tsconfigs it looks for? If we can't then adding the feature in now would mean a hard breaking change down the line when we switch the internals. It would require investigation to confirm. |
Following up: in #6754 we added an Since that flag is experimental -and will be for quite some time-, we still don't have a stable way for situations where cc @me4502 - thanks for talking with us through it! I've marked the discussion comments as hidden & off-topic so that folks wanting to implement it don't get discouraged by the long thread (cc @bradzacher too). Please yell at me if you think the comments should be surfaced more visibly - maybe we should make a GH Discussion for them? At any rate, I think we'd want to see an API suggestion before marking this as purely
I like that idea. Maybe, On the other hand, it could get confusing having this object shape have project: {
allowed: ['tsconfig.eslint.json', 'tsconfig.json'],
ignored: ['./packages/ignore-me/tsconfig.json'],
relative: true,
} |
project: true
searches forproject: true
searches for
...wow. This is an awful way to represent many collapsed comments: Sorry for stealing your issue @me4502 but I'm going to just file a new one and un-hide those. I really don't want people who want to discuss or implement this issue to have to wade through all that. |
Before You File a Proposal Please Confirm You Have Done The Following...
Relevant Package
parser
My proposal is suitable for this project
Description
Currently, the
project: true
option allows TypeScript-ESLint to auto-detect the tsconfig.json file within each package of a monorepo, however a relatively common setup is to use atsconfig.eslint.json
file for eslint setup. This means that instead of being able to utiliseproject: true
, each package needs an eslintrc file that points to the project file, or globs need to be used in the base configuration. Neither of these are ideal either for massive duplication reasons or for performance reasons.Ideally, another option would be added to allow setting the filename that the parser looks for when
project
is set totrue
. This would allow utilising atsconfig.eslint.json
file without needing to manually define it in all used locations.Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: