[Fix] ExportMap / flat config: include languageOptions in context by michaelfaith · Pull Request #3052 · import-js/eslint-plugin-import (original) (raw)

@michaelfaith @ljharb

This change fixes a bug with flat config support. There is a function called childContext that's used by the ExportBuilder to "cleanse" the context object. This function wasn't including the new languageOptions object, which contains the parser. So by the time this cleansed context made it to the parse function, languageOptions wasn't there anymore.

Since parserPath was still being included in non-flat config scenarios, the parse function made it through ok and used parserPath. However, once you shift to flat config, parserPath is no longer defined, and the actual parser object needs to be there.

Fixes import-js#3051