Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-project configuration doesn't type check files not included in any project #724

Closed
ark120202 opened this issue Jul 19, 2019 · 1 comment · Fixed by #760
Closed
Labels
bug Something isn't working has pr there is a PR raised to close this package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@ark120202
Copy link

ark120202 commented Jul 19, 2019

What code were you trying to parse?

[1].forEach(value => value + 1);

What did you expect to happen?

No warnings

What actually happened?

A warning from @typescript-eslint/restrict-plus-operands rule.

After a bit of debugging I found out that type checker returned any type for the value node. It happened because project didn't contain a reference to package's tsconfig file, so this file was linted in a context of an inferred project.

I've tried to reproduce it in an isolated environment and looks like it works correctly if there is only one project.

UPD: After reading source it makes sense that it can't do the same thing it does with a single config, but falling back to the same program used for non-type-checked rules should also make rules handle it like it does without any project specified - throw an error.

Versions

package version
@typescript-eslint/typescript-estree 1.12.0
TypeScript 3.5.3
node 12.1.0
npm 6.9.0
@ark120202 ark120202 added package: typescript-estree Issues related to @typescript-eslint/typescript-estree triage Waiting for maintainers to take a look labels Jul 19, 2019
@bradzacher
Copy link
Member

this is due to the same reason that the plugin is slow when you don't include all files within a tsconfig. It essentially handles it by fudging a lot.

The parser doesn't have a context of partially typechecked or not per file, it just reports that every file has either been fully typechecked (i.e. project is provided), or it's not.

We're planning on fixing this by throwing hard errors if the file isn't within the specified project (which is the same thing tslint did).

@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Jul 19, 2019
@bradzacher bradzacher added the has pr there is a PR raised to close this label Jul 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
2 participants