typescript-eslint: `parserOptions.project` doesnt handle project references well
What code were you trying to parse?
Not parsing code exactly, but I’m attempting to upgrade to v2, which hard fails if project doesn’t include files correctly. This doesn’t seem to handle project references correctly.
Given this root tsconfig.json:
{
"files": [],
"references": [
{
"path": "packages/config-danger"
}
],
"extends": "./tsconfig.options.json"
}
And this config-danger/tsconfig.json:
{
"compilerOptions": {
"declarationDir": "lib",
"outDir": "lib",
"rootDir": "src"
},
"exclude": [
"lib",
"tests"
],
"extends": "../../tsconfig.options.json",
"include": [
"src/**/*",
"types/**/*",
"../../types/**/*"
],
"references": []
}
What did you expect to happen?
Files within a project reference include worked correctly.
What actually happened?
The parser/plugin fails with a ton of the following errors:
/root/packages/config-danger/src/code.ts
0:0 error Parsing error: If "parserOptions.project" has been set for @typescript-eslint/parser, /root/packages/config-danger/src/code.ts must be included in at least one of the projects provided
Versions
| package | version |
|---|---|
@typescript-eslint/parser |
2.0.0 |
TypeScript |
3.5.2 |
ESLint |
6.1.0 |
node |
12.8.0 |
npm |
6.1.0.3 |
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15 (9 by maintainers)
Commits related to this issue
- docs(parser): clarify project references Closes #856 — committed to typescript-eslint/typescript-eslint by bradzacher 7 years ago
- docs(parser): clarify project references (#884) Closes #856 — committed to typescript-eslint/typescript-eslint by bradzacher 7 years ago
@19majkel94 - there is #806 which will make this easier by allowing you to supply a glob matcher for tsconfig files.
Interesting. That’s good to know, thanks.
We should probably document this clearly so people don’t assume they only need to provide one of the tsconfigs in the project.