I am working on a large JavaScript project, which is divided into several auxiliary modules, each of which has its own git and Node repositories. And we also have an entry point module App
, which has the configuration of Webpack and eslint.
Since most developers worked on several modules in tandem with each other, instead of waiting for each module to be published, we use npm link
to connect submodules to the application module, so changes in the submodule during development will be immediately visible in the module App
.
We ran into problems in order to get eslint-loader
to align not only the source code of the module App
, but also all the submodules that are linked through npm link
. When linting the code of the submodule, eslint-loader
it was not possible to resolve paths local to the submodule.
Is there any way around this problem?
Here is an example project structure
--- App
| src
| node_modules
|- Sub_module_x
| src
| node_modules
|- Sub_module_y
src
node_modules
Here is the relevant eslint-loader section in webpack.config.js
module: {
preloaders: [
{
test: /\.js$/,
loader: 'eslint-loader',
exclude: [
path.resolve(__dirname, 'node_modules', 'Sub_module_x'), // If this is commented, the loader would lint Sub_module_x, but cannot resolve any files which import other files
/node_modules/
]
}
]
}
source
share