Reputation: 612
The title pretty much covers my issue but what I'm basically wanting is
Is this feasible?
Update
I'm using https://github.com/michaelzoidl/babel-root-import
//.babelrc
{
...,
"plugins": [["babel-root-import", {
"rootPathSuffix": "./src"
}]],
...
}
And in my webpack config I have a babel loader and an eslint loader like so
//webpack.config.dev.js
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel', 'eslint'],
include: path.join(__dirname, 'src'),
exclude: /node_modules/
},
...
}
After this I can then import modules using a syntax like
import Module from '~/components/Module'
rather than
import Module from '../../components/Module
Upvotes: 0
Views: 187
Reputation: 9766
ESLint validates files "as is" right from the file system without any extra preprocessing. For your case, you can create custom eslint rule, that understands your processed paths and can check them.
As other option, you can call Babel with your path processor the only plugin enabled, check the result with eslint and then run babel again with rest of plugins to convert the code to es5. But for me, the first way seems easier and nicer.
P.S. Maybe I can add something if you tell what the your path converting actually is.
Upvotes: 1