facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.85k stars 632 forks source link

Bug: recursion: "Maximum call stack size exceeded" #1313

Closed ayroblu closed 8 months ago

ayroblu commented 8 months ago

Bug Description

I'm trying to switch our codebase from eslint-parser to hermes-eslint

I'm getting these errors after changing the parser. There are a lot of these recursion errors relating to mdx files:

/path/to/Screen.mdx
  0:0  error  Parsing error: Maximum call stack size exceeded

EDIT <omitted these while I investigate>

pieterv commented 8 months ago

Is this a stardard markdown file? hermes-eslint is only designed to run over JS files, you will need to scope the parser change to just JS files via the overrides config, e.g. something like the following:

module.exports = {
  overrides: [
    {
      files: ['*.js', '*.js.flow'],
      parser: 'hermes-eslint',
    },
  ],
};
ayroblu commented 8 months ago

This doesn't work. It causes an error on all JS files

/path/to/suite/index.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

If I specifically remove mdx from the list of valid extensions it works