Eslint-plugin-import: eslint-import-resolver-webpack swallows errors in webpack.config.js

Created on 30 Aug 2016  路  5Comments  路  Source: benmosher/eslint-plugin-import

I was seeing the following error for each of my checked files:
1:0 error Resolve error: Unexpected token import

I was trying to understand why (correct plugin configuration, babel and webpack setup correctly) for about 1h until I realized, that I forgot to start eslint with babel-node and my webpack.config.js was written in babel ES6+ code. Obviosly, it was starting with
import path from 'path';
which seems to have produced said errors.

I think instead eslint-import-resolver-webpack should error when trying to read the webpack configuration, similar to as it does, when settings.import/resolver.webpack cannot be resolved.

accepted bug help wanted resolvewebpack resolver

All 5 comments

Ah, yeah, that makes sense. Could still re-emit the original message, but would be ideal to prefix with Error encountered when loading resolver config: or some such.

That would decrease the setup pain even more! 馃憤
If I find some time I'll try to put together a PR, but no guarantees 馃槄

Btw, it's working fine now and it's an absolutely awesome plugin! Thanks for your work :)

PR: https://github.com/benmosher/eslint-plugin-import/pull/599

I've hit the same error, but I use Atom which starts eslint by itself, so instead of "starting eslint with babel-node", I've required 'babel-register' from the file I've configured eslint-import-resolver-webpack with, the same way I do where the ES6+ webpack configs are used to build the app.

Was this page helpful?
0 / 5 - 0 ratings