Skip to content

Bug(typescript-estree): Project services default project not working with extended tsconfigs #9205

Closed
@higherorderfunctor

Description

@higherorderfunctor

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

I have identified two issues with project services.

  1. If the default project's tsconfig.json has an extends, to say a tsconfig.base.json with a common set of compiler options, those compiler options are not used. The example repo is a monorepo with liberal use of project references. An example published package that uses a similar setup is https://github.com/Effect-TS/effect.
  2. Fixing or working around the first issue (both are demonstrated in the example), reveals that parserOptions.extraFileExtensions is not working as expected to setup tsserver for type checking using project references with non-standard file extensions. The example demonstrates how .vue files are not type checking correctly.

I have created a basic patch that solves both issues (minus rigorous testing).

The first issue is triggered by tsserver.readConfigFile at

Replacing with tsserver.getParsedCommandLineOfConfigFile solves the extends issue. This was pretty much lifted from

const parsed = ts.getParsedCommandLineOfConfigFile(

Fixing this issue will reveal the second issue with file extensions. The patch corrects this by forwarding extraFileExtensions to tsserver using service.setHostConfiguration.

Reproduction Repository Link

https://github.com/higherorderfunctor/example-typescript-eslint-bug

Repro Steps

Directions are located in the example repo's README.

The repo has a patch to fix the bugs (enabled by default) and needs to disabled to demonstrate the bugs.

Versions

node --version
v20.12.2

pnpm --version
8.15.5

pnpm list -r
Legend: production dependency, optional only, dev only

example-typescript-eslint-bug@1.0.0 <REDACTED>/example-typescript-eslint-bug (PRIVATE)

devDependencies:
eslint 8.57.0
eslint-plugin-vue 9.26.0
typescript 5.4.5
typescript-eslint 7.11.0
vue-eslint-parser 9.4.3
vue-tsc 2.0.19

package-a@1.0.0 <REDACTED>/example-typescript-eslint-bug/packages/package-a (PRIVATE)

dependencies:
@types/jsdom 21.1.7
@types/node 20.13.0
vite 5.2.12
vue 3.4.27

cat /etc/os-release
ANSI_COLOR="1;34"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="24.11.20240529.ad57eef"
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 24.11 (Vicuña)"
SUPPORT_URL="https://nixos.org/community.html"
VERSION="24.11 (Vicuña)"
VERSION_CODENAME="vicuña"
VERSION_ID="24.11"

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions