Skip to content

Enhancement: Allow specifying default TSConfig behavior with project service #7761

Closed as not planned
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

parser

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

I've heard of two requests around EXPERIMENTAL_useProjectService:

These are technically two requests, but I think it'd be good to discuss them together. Whatever API we end up going with may need to accommodate both.

Proposal: how about a fallbackCompilerOptions?

type FallbackCompilerOptions = 
  /* Don't allow fallback/inferred projects at all */
  | "error" 
  /* Allow fallback/inferred projects but log a warning */
  | "warn"
  /* Directly use these */
  ts.CompilerOptions;

// (approximation of the shape we'd allow)
interface ProjectServiceParserOptions {
  EXPERIMENTAL_useProjectService: true;

  // If undefined, go with TypeScript's defaults
  fallbackCompilerOptions?: FallbackCompilerOptions;
}

Additional Info

Courtesy of @jakebailey in https://discord.com/channels/508357248330760243/1163326359100199012/1163526441103802398: project services have a setCompilerOptionsForInferredProjects we can use.

#7752 largely enables the case of an inferred project in the first place.

Edit: oh, and also mentioned here: #6575 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpackage: parserIssues related to @typescript-eslint/parserwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions