Closed rckahale closed 7 years ago
You can make separate file e.g eslint-import-resolver.js
which reflect webpack config just contain resolve alias value like sample below
module.exports = {
resolve: {
extensions: ['.js', '.jsx', '.scss'],
modules: [path.resolve(appRootDir.get(), './src'), path.resolve(appRootDir.get(), './node_modules')],
alias: {
TweenLite: 'gsap/src/uncompressed/TweenLite',
TimelineLite: 'gsap/src/uncompressed/TimelineLite',
},
},
};
Then change your .eslintrc
config path of import rules to point to this file.
Thanks for the quick response Dion! I tried above steps, but still found same errors. I think the eslint-import-resolver-webpack is expecting entire config object along with resolve & other keys. I also tried with
"settings": {
"import/resolver": {
"webpack": {
"config": {
"resolve" : "eslint-import-resolver.js"
}
}
}
}
It's should be config.path
instead of config.resolve
.
No luck with config.path However, i found an alternative. I shifted my alias into babelrc from webpack's configFactory. The modules which helped me for the cause are babel-plugin-module-resolver and eslint-import-resolver-babel-module
I have some alias in my webpack config. I want to fix eslint errors arising out of it. I followed this, but I could not find webpack config json to be applied as react-universally uses config generated from factory. AFAIK, js imports and function calls can't be made in eslintrc file. How can I fix these errors?