-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(typescript-estree): add allowDefaultProjectForFiles project service allowlist option #7752
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
feat(typescript-estree): add allowDefaultProjectForFiles project service allowlist option #7752
Conversation
Thanks for the PR, @JoshuaKGoldberg! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thanks for working on this. I wonder, should it perhaps throw an error or at least log a warning is the default TSConfig is used? For instance, in my case there was no intention to use the default config. Seeing a warning or error would make me either to include the file into the program or to exclude it from lint. Just thinking out loud. Can be I misunderstood the fix. |
Hmm yeah it's an interesting idea. I don't think we'd want to warn by default, because one of the primary motivations for the option is to allow unlisted files to be linted (e.g. Edit: #7761 👍 |
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.
Theoretically looks correct to me; the only actual change is not returning early.
Excellent, thanks. |
Re-targeting this to specifically focus on #7871. |
@@ -9,7 +13,15 @@ const createStubFileWatcher = (): ts.FileWatcher => ({ | |||
|
|||
export type TypeScriptProjectService = ts.server.ProjectService; | |||
|
|||
export function createProjectService(): TypeScriptProjectService { | |||
export interface ProjectServiceSettings { | |||
allowDefaultProjectForFiles: ReadonlySet<string>; |
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.
This name is not particularly good but it's under an experimental option so I'd expect we'll rethink all names for v7.
packages/typescript-estree/src/create-program/createProjectService.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/createProjectService.ts
Outdated
Show resolved
Hide resolved
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.
approving - pending that last convo being resolved
…ice allowlist option (typescript-eslint#7752) * fix(typescript-estree): allow project service for unknown client file * Fixed up project throwing tests * Added allowDefaultProjectForFiles as nested option * Added a bit more testing * fix: only throw on missing file path if hasFullTypeInformation * Fix test snapshot * Remove unnecessary assertion * TypeScript_ESTree.mdx docs * Absolute and canonical file paths * Use minimatch instead of fs globbing * lint: import sorting, missing return type * Ignore some tests
PR Checklist
Overview
Removes the check that
projectService.openClientFile
should return an opened file. In my testing, it looks like we can still generate type info for the file just with the default program for it?Standalone repro here:
https://github.com/JoshuaKGoldberg/repros/tree/project-service-without-opened-filehttps://github.com/JoshuaKGoldberg/repros/tree/allow-default-project-for-filesAsked for confirmation about this approach on the TypeScript Discord: https://discord.com/channels/508357248330760243/640177429775777792/1163133940115197952. Edit: confirmed, and filed #7761 as a followup ✅