webpack-contrib / eslint-webpack-plugin

A ESLint plugin for webpack
MIT License
254 stars 47 forks source link

All modules are linted in watch mode after changing only a single file #75

Closed decademoon closed 3 years ago

decademoon commented 3 years ago

Expected Behavior

Only lint modules that were rebuilt after changing a file.

Actual Behavior

Every module is linted after changing a file.

Code

new ESLintPlugin({
  extensions: ['js', 'vue'],
})

How Do We Reproduce?

It seems there was a recent change to which hooks were used to lint the files. Before succeedModule was used which was only called with the rebuilt modules after a file change, but now finishModules is used which passes every module in the compilation, so all files get linted.

ricardogobbosouza commented 3 years ago

Solving it now. =)

wendyzhaogogo commented 3 years ago

My problem is a little different. In my project, there remains a lot of errors & warnings. I only want to lint what is saved by current user in his IDE. Now, when the project starts, all files are linted..about 100+

ricardogobbosouza commented 3 years ago

@WilkinWendy for this you can enable lintDirtyModulesOnly

https://github.com/webpack-contrib/eslint-webpack-plugin#lintdirtymodulesonly

wendyzhaogogo commented 3 years ago

@WilkinWendy for this you can enable lintDirtyModulesOnly

I’ve tried it,but not work.

wendyzhaogogo commented 3 years ago

@WilkinWendy for this you can enable lintDirtyModulesOnly

I’ve tried it,but not work.

{ exclude: 'node_modules', extensions: ['.js', '.jsx', '.vue', '.ts', '.tsx'], quiet: true, cache: true, fix: true, lintDirtyModulesOnly: true, formatter: 'codeframe' }

wendyzhaogogo commented 3 years ago

@WilkinWendy for this you can enable lintDirtyModulesOnly

I’ve tried it,but not work.

In my project, the compilation seems to be triggered in a dead loop, when fix:true

wendyzhaogogo commented 3 years ago

@WilkinWendy for this you can enable lintDirtyModulesOnly

I’ve tried it,but not work.

In my project, the compilation seems to be triggered in a dead loop, when fix:true

I‘ve worked out reason of this problem. If a file is unfixable,which means the output of the fixed file is the same as the source file, eg: no-console rule is unfixable. the outputFixes function will be executed in a dead loop.