-
Notifications
You must be signed in to change notification settings - Fork 354
Description
Versions:
eslint
: 9.4.0
typescript
: 5.4.5
typescript-eslint
: 8.0.0
vscode-eslint
: 3.0.10 and 3.0.11(pre-release)
Issue
I'm not sure whether this should be raised with the typescript--eslint
team, or with the VSCode extension, or whether it's a little of both (or something that I'm doing wrong). I can't seem to find any mention of it on either repo though.
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.
Troubleshooting
So far I've tried:
- Using
project: true
in the parser config - ❌ Doesn't work due to thetsconfig.json
files not actually including files themselves - thereferences
include/exclude files for their use-case. - Using
project: [...array of tsconfig.json files]
- ✅ Works, but not ideal due to having to manually add any new files to the config each time - it would also be preferred to migrate to the new suggested method (projectService
) which works with the CLI. - Defining
projectService
using the object type from the Blog - ❌ Same error for nested files (and not really required for our project
Repro
I have created a repro that has instructions on how to reproduce the error.