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

TypeScript ESLint crash after 22.4.4 when passing TFunction #1901

Closed
CreativeTechGuy opened this issue Jan 22, 2023 · 19 comments
Closed

TypeScript ESLint crash after 22.4.4 when passing TFunction #1901

CreativeTechGuy opened this issue Jan 22, 2023 · 19 comments
Assignees

Comments

@CreativeTechGuy
Copy link

CreativeTechGuy commented Jan 22, 2023

💥 Regression Report

When using @typescript-eslint/no-misused-promises to lint a TypeScript project with i18next CustomTypeOptions set, the linter will crash when attempting to analyze the function arguments of a function which is passed TFunction type. (This is a continuation of #1891 but now with a minimal reproduction.)

Error received:

➜  i18next-eslint-repro  $ npm run lint

> i18next-eslint-repro@1.0.0 lint
> eslint src/**


<--- Last few GCs --->

[8512:000001F9FC78AFD0]   144555 ms: Mark-sweep (reduce) 3699.7 (3799.6) -> 3699.7 (3753.6) MB, 1889.0 / 0.0 ms  (average mu = 0.706, current mu = 0.000) last resort GC in old space requested
[8512:000001F9FC78AFD0]   146347 ms: Mark-sweep (reduce) 3699.7 (3753.6) -> 3699.7 (3753.4) MB, 1791.8 / 0.0 ms  (average mu = 0.548, current mu = 0.000) last resort GC in old space requested


<--- JS stacktrace --->

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 00007FF618FD7A1F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+114207
 2: 00007FF618F66096 DSA_meth_get_flags+65542
 3: 00007FF618F66F4D node::OnFatalError+301
 4: 00007FF61989B2CE v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF6198858AD v8::SharedArrayBuffer::Externalize+781
 6: 00007FF619728C7C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
 7: 00007FF61972381E v8::internal::Heap::AllocateExternalBackingStore+2270
 8: 00007FF619741420 v8::internal::FreeListManyCached::Reset+1408
 9: 00007FF619741AD5 v8::internal::Factory::AllocateRaw+37
10: 00007FF619753A7E v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray+46
11: 00007FF6197566BA v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller+74
12: 00007FF619756913 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithMap+35
13: 00007FF619554608 v8::internal::OrderedNameDictionary::Add<v8::internal::LocalIsolate>+856
14: 00007FF619554BC7 v8::internal::OrderedNameDictionary::FindEntry<v8::internal::LocalIsolate>+247
15: 00007FF619554A54 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap,2>::EnsureGrowable<v8::internal::Isolate>+100
16: 00007FF619484FCF v8::internal::CompilationCache::IsEnabledScriptAndEval+5775
17: 00007FF619928FC1 v8::internal::SetupIsolateDelegate::SetupHeap+494417
18: 00007FF619903B7B v8::internal::SetupIsolateDelegate::SetupHeap+341771
19: 000001F9804B3EEF

Last working version

Worked up to version: 22.4.3

Stopped working in version: 22.4.4

To Reproduce

Very minimal repo here: https://github.com/CreativeTechGuy/i18next-eslint-repro

  • Pull code
  • npm ci to install dependencies
  • npm run lint to cause the crash (it'll stall for a while but if you leave it long enough it'll crash with an error similar to above)

Expected behavior

The code can be linted without issue.

Your Environment

  • runtime version: Node 16.15.0
  • i18next version: 22.4.4
  • os: Windows
@stale
Copy link

stale bot commented Feb 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 18, 2023
@CreativeTechGuy
Copy link
Author

Not stale

@stale stale bot removed the stale label Feb 19, 2023
@esetnik
Copy link

esetnik commented Feb 28, 2023

Related to #1883

@esetnik
Copy link

esetnik commented Mar 1, 2023

According to this comment the issue can only be fixed by reducing the complexity of the recursive types associated with TFunction.

@stale
Copy link

stale bot commented Mar 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 18, 2023
@CreativeTechGuy
Copy link
Author

not stale

@esetnik
Copy link

esetnik commented Mar 24, 2023

@CreativeTechGuy yup, we're also stuck on v22.4.3 until this gets fixed.

@stale stale bot removed the stale label Mar 24, 2023
@esetnik
Copy link

esetnik commented Mar 24, 2023

@adrai can you turn off the stale bot?

@stale
Copy link

stale bot commented Apr 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 2, 2023
@adrai adrai removed the stale label Apr 2, 2023
@stale
Copy link

stale bot commented May 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 4, 2023
@adrai adrai removed the stale label May 4, 2023
@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2023
@adrai adrai removed the stale label May 21, 2023
@stale
Copy link

stale bot commented Jun 10, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 10, 2023
@adrai adrai removed the stale label Jun 10, 2023
@luisjuniorj
Copy link

Not Stale.

@adrai
Copy link
Member

adrai commented Jun 15, 2023

Please try with i18next v23.0.1 and react-i18next v13.0.0

@esetnik
Copy link

esetnik commented Jun 15, 2023

@adrai please see #1972

@CreativeTechGuy
Copy link
Author

CreativeTechGuy commented Jun 15, 2023

@adrai It's looking MUCH better. I am not having any issues and it's very responsive. It even responds to changes in the json file much faster than previously! So overall a very great change. Thank you.

Edit: I'm using TypeScript 4.9.5 in case that is relevant.

I do have a complaint (nit) regarding the change from TFuncKeys to ParseKeys. Now it requires 3 generic arguments, all of which can be set to defaults (and are set to defaults when used elsewhere internally). It'd be nice if the type had default generic values so it was easier to use (and was an actual 1:1 replacement for TFuncKeys).

@pedrodurek
Copy link
Member

Hey @CreativeTechGuy, I'm glad to hear that! The defaults values should be available in the next patch version: 18ce83f

@pedrodurek
Copy link
Member

Since it's resolved, I'll close this issue

@adrai
Copy link
Member

adrai commented Jun 16, 2023

Hey @CreativeTechGuy, I'm glad to hear that! The defaults values should be available in the next patch version: 18ce83f

fyi: released in v23.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants