tslint-webpack-plugin
tslint-webpack-plugin copied to clipboard
Fix option should batch the changes
Enabling the fix
option for the plugin with webpack-dev-server
's watch mode seems to cause tslint
to fix the issues one-by-one-ish while webpack compiles everything after each change. This is painful if you have multiple mistakes when doing eg. save all with your editor.
To reproduce this, enable fix
for the plugin and start webpack-dev-server
in watch mode. To enable fix
, change your webpack configuration file to:
new TslintWebpackPlugin({
// ...
fix: true
})
The log looks like this:
webpack: Compiled successfully.
[tslint-plugin] Starting linter in separate process...
webpack: Compiling...
...
webpack: Compiled successfully.
[tslint-plugin] Starting linter in separate process...
webpack: Compiling...
...
webpack: Compiled successfully.
[tslint-plugin] Starting linter in separate process...
webpack: Compiling...
...
webpack: Compiled successfully.
[tslint-plugin] Starting linter in separate process...
webpack: Compiling...
...
(Notice how tslint-plugin
never completes.)
It seems that this happens because:
- Webpack compilation finishes
-
tslint
starts -
tslint
fixes an issue and continues to the next file -
webpack
detects the change and starts compiling -
tslint-webpack-plugin
killstslint
- Go to step 1.
I have no idea how to fix this properly, but the hooks in plugin.js
seem to support my theory.
I'm still using webpack@3
if that matters.
EDIT: Changed the loop to illustrate the problem better
Turns out there are other issues related to fix: true
in addition to the behavior of tslint-webpack-plugin
: https://github.com/palantir/tslint/issues/3786.