-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: for (using foo in {});
should be invalid
#7555
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
Comments
HI @bradzacher I am interested in solving this bug, I find the result of this bug is because some default setting prevent first,
but this ternary operation does not return a program instance, because
This bug can be solved by always returning a program instance. but I think there must be some reason that makes |
The check can be added here. typescript-eslint/packages/typescript-estree/src/convert.ts Lines 920 to 926 in d2973cc
|
HI @fisker thanks for your reply, but is the Typescript Program instance already doing the semantic diagnosis for us, why not just use but manual check in the coverter? |
It costs around 50ms per file to calculate diagnostics. This adds up quickly across any non-trivial codebase and so we purposely avoid it - 100 files = 5s!! Just to calculate diagnostics that likely aren't even there most of the time! Instead we implement our own restrictions within our AST conversion as we can do it very quickly during the traversal - we have to inspect and disect the AST any way to convert it so it's easy and natural for us to enforce certain invariants during this process. |
Before You File a Bug Report Please Confirm You Have Done The Following...
Relevant Package
parser
Playground Link
https://typescript-eslint.io/play/#ts=5.2.0-beta&showAST=es&fileType=.tsx&code=GYewTgBAFArgzgSwHYHMKhBZEDeBfASgG4g&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
Error thrown.
Actual Result
Successfuly parsed.
Additional Info
No response
Versions
@typescript-eslint/parser
5.6.0
The text was updated successfully, but these errors were encountered: