9

If I run eslint . from my project-root, it prints all errors and warnings to the console, as I would expect it to.

However, when I cd into a subdirectory of the project, eslint . yields the following error-message:

<--- Last few GCs --->

[10574:0x4e6ca40]    72313 ms: Mark-sweep (reduce) 4073.6 (4143.3) -> 4073.0 (4143.8) MB, 3637.8 / 0.0 ms  (average mu = 0.082, current mu = 0.001) allocation failure scavenge might not succeed
[10574:0x4e6ca40]    75948 ms: Mark-sweep (reduce) 4074.1 (4143.8) -> 4073.0 (4144.1) MB, 3630.7 / 0.0 ms  (average mu = 0.043, current mu = 0.001) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb12b00 node::Abort() [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 2: 0xa2fe25 node::FatalError(char const*, char const*) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 3: 0xcf8a9e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 4: 0xcf8e17 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 5: 0xee2d65  [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 6: 0xef1ae1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 7: 0xef4d3c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 8: 0xec12eb v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
 9: 0x122acab v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
10: 0x160c479  [/home/tim/.nvm/versions/node/v16.0.0/bin/node]
error Command failed with signal "SIGABRT".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The eslint-documentation states, that a .eslintrc.js applies to the directory where it's placed, as well as all subdirectories. So it should use the same config-file.

Shouldn't it theoretically find less warnings, when it doesn't have to search the whole project? I would expect eslint to also use less memory, because of that fact.

eslint-version is v7.26.0.

0

1 Answer 1

0

Increasing the max_old_space_size in NODE_OPTIONS should fix the issue, as per How to increase EsLint memory to avoid `JavaScript heap out of memory`?

NODE_OPTIONS=--max_old_space_size=4096(to increase it to 4gb, instead of the default 1.5gb)

Not the answer you're looking for? Browse other questions tagged or ask your own question.