You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've come across an issue with ESLint when using eslint-import-resolver-webpack and webpack config is an array of functions.
ESLint starts to fail almost on all rules, saying: [eslint] Resolve error: Cannot read property 'externals' of undefined
I've managed to found the part of sources which responsible for that. The cause is that it first checks whether config is a function (and then executes it) and after that check whether it's an array.
My proposition is to check if config is an array, try to convert every element from function to object.
In case I understood everything correctly and didn't miss anything, I can make a PR for that, just going to add some tests as Contribution Guide claims
The text was updated successfully, but these errors were encountered:
I've come across an issue with ESLint when using
eslint-import-resolver-webpack
and webpack config is an array of functions.ESLint starts to fail almost on all rules, saying:
[eslint] Resolve error: Cannot read property 'externals' of undefined
I've managed to found the part of sources which responsible for that. The cause is that it first checks whether config is a function (and then executes it) and after that check whether it's an array.
https://github.com/benmosher/eslint-plugin-import/blob/b4a2f11fcacc6b2f048da4b29cfc896e682f17d1/resolvers/webpack/index.js#L88-L109
When it tries to find proper config with
resolve
field in the array, it finds nothing, because all elements are functions.And, in my case, it turns that config is undefined which leads to the error I see.
My proposition is to check if config is an array, try to convert every element from function to object.
In case I understood everything correctly and didn't miss anything, I can make a PR for that, just going to add some tests as Contribution Guide claims
The text was updated successfully, but these errors were encountered: