Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Fix option should batch the changes #12

Open
ljani opened this issue Mar 20, 2018 · 1 comment
Open

Fix option should batch the changes #12

ljani opened this issue Mar 20, 2018 · 1 comment

Comments

@ljani
Copy link
Contributor

ljani commented Mar 20, 2018

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:

  1. Webpack compilation finishes
  2. tslint starts
  3. tslint fixes an issue and continues to the next file
  4. webpack detects the change and starts compiling
  5. tslint-webpack-plugin kills tslint
  6. 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

@ljani
Copy link
Contributor Author

ljani commented Mar 21, 2018

Turns out there are other issues related to fix: true in addition to the behavior of tslint-webpack-plugin: palantir/tslint#3786.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants