-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
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, andreferences
several additional tsconfig files (e.gtsconfig.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 adefaultProject
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 atsconfig.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 |