Skip to content

Bug: projectService causes issues with vscode-eslint extension. #9731

@tetarchus

Description

@tetarchus

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

We've been using the v8 alpha-30 release to make use of ESLint v9 and have now switched to using the full release.
When using the projectService option for typescript-eslint's parser in v8.0.0, creating a new file causes the extension to produce the error:

Parsing error: [path-to-newly-created-file] was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject.

Requiring that the extension be restarted to force the project service to pick up the new file.
The alpha version (30) of v8 previously raised This rule requires the 'strictNullChecks' compiler option to be turned on to function correctly. on the newly created file, likely caused by the same issue (the project service was not aware of the new file as from the command line it will be started after the file is created).

Background

  • The repo is an NX monorepo using a custom flat config.
  • Each project contains a tsconfig.json that extends a base config, and references several additional tsconfig files (e.g tsconfig.lib.json/tsconfig.spec.json).
  • Linting is run from the root of the workspace on all projects
  • There is also a root level tsconfig.json (as well as the base config) that includes all files outside of nested projects (which theoretically negates the need for a defaultProject if I understand correctly).
  • The ESLint configuration uses a function to return the config at runtime based on environment variables and dynamic values - this all works as expected when editing existing files.
  • Running ESLint from the command line works as expected.

This issue was also opened on the vscode-eslint repo.

CC @dbaeumer

Reproduction Repository Link

https://github.com/tetarchus/project-service

Repro Steps

  • Clone the repo
  • Open the repo in VSCode
  • Install dependencies
  • Run npm run lint in the terminal and observe no errors
  • Ensure that the vscode extension is installed and active
  • Create a new file (can be anywhere, but libs/project-test/src/ is definitely covered by a tsconfig.json file)
  • Add some basic content and save the file
  • Observe that the extension shows an error line below the first word of the file - hovering to show the error (shown below) - also present in the Output logs.
  • Run npm run lint in a terminal and observe there are still no errors
  • Run the ESLint: Restart ESLint Server action and wait until complete
  • Observe that the error no longer displays.

Versions

package version
typescript-eslint 8.0.0
TypeScript 5.4.5
ESLint 9.8.0
node 20.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked by external APIBlocked by a tool we depend on exposing an API, such as TypeScript's Type Relationship APIbugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.triageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy