-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Bug: Eslint hangs and gobbles memory with i18next version 22 and typescript-eslint #6538
Comments
There is another minimal reproduction available here i18next/i18next#1901 and a report of the same issue in i18next/i18next#1883 |
We believe the issue is caused by the usage of the @typescript-eslint/no-misused-promises rule. |
To do this we need to ask TS to do some deep interrogation of the types of the parameter and the argument. Which means we'll deeply inspect both the Having a quick glance at the definition of We don't even store the type - we just calculate it, figure out if it's a void or promise returning function, then discard it - so the memory usage is due to TS having to calculate so much. I saw in one of the issues that someone was even encountering OOMs with just I don't think there's anything that we can do here - these types are just ridiculously complex spaghetti. If someone wants to dig deeper into the rule and figure out if there's a way to optimise it - happy to accept a PR, but I think this can only be fixed from the library side. |
Sorry about the bug report then, I did search for a report in typescript-eslint, but forgot to look in the i18next issue tracker. 🙂 I either way am happy that I went through creating the minimal reproduction example, as I learned to avoid the problem in my own project by not taking TFunction as a parameter and using the imported t value directly (which in the new i18next is better anyhow). I'll leave it up to you what to do with this bug report, you may close it if you wish. Thank you for your time. 🙂 |
No problem! If anyone does have any ideas on how we might improve the perf, always happy to accept PRs! |
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
I type in "eslint src" and eslint would hang and start gobbling memory.
After it has taken about 4 gigs of memory, node would throw an out of memory error.
I have made a minimal reproduction example repo in github.
It seems to be a complex bug through the interplay between typescript-eslint and i18next.
I first discovered it by upgrading to i18next version 22. They did a major typescript rewrite
for that version. It can be seen from this repo as well, if i18next is removed, the bug disappears.
These are things I have tried to change, and then notice that the bug goes away:
Reproduction Repository Link
https://github.com/raigoinabox/typescript-eslint-hang-bug
Repro Steps
npm install
npx eslint src
Versions
@typescript-eslint/eslint-plugin
5.53.0
@typescript-eslint/parser
5.53.0
@typescript-eslint/scope-manager
5.53.0
@typescript-eslint/typescript-estree
5.53.0
@typescript-eslint/type-utils
5.53.0
@typescript-eslint/utils
5.53.0
TypeScript
4.9.5
ESLint
8.35.0
node
16.19.1
The text was updated successfully, but these errors were encountered: