Skip to content

Commit 0115aea

Browse files
refactor: restore old logic
1 parent ceea2d6 commit 0115aea

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ class StylelintWebpackPlugin {
6161
);
6262
}
6363

64-
let isFirstRun = this.options.lintDirtyModulesOnly;
64+
let hasCompilerRunByDirtyModule = this.options.lintDirtyModulesOnly;
65+
6566
compiler.hooks.watchRun.tapPromise(this.key, (compiler) => {
66-
if (isFirstRun) {
67-
isFirstRun = false;
67+
if (hasCompilerRunByDirtyModule) {
68+
hasCompilerRunByDirtyModule = false;
6869

6970
return Promise.resolve();
7071
}
@@ -81,12 +82,11 @@ class StylelintWebpackPlugin {
8182
*/
8283
async run(compiler, options, wanted, exclude) {
8384
// Do not re-hook
84-
/* istanbul ignore if */
85-
if (
86-
compiler.hooks.thisCompilation.taps.some(({ name }) => name === this.key)
87-
) {
88-
return;
89-
}
85+
const isCompilerHooked = compiler.hooks.thisCompilation.taps.find(
86+
({ name }) => name === this.key,
87+
);
88+
89+
if (isCompilerHooked) return;
9090

9191
compiler.hooks.thisCompilation.tap(this.key, (compilation) => {
9292
/** @type {import('./linter').Linter} */

0 commit comments

Comments
 (0)