Skip to content

Commit 1ac2b85

Browse files
committed
fix: correct id & filePath params
1 parent 7ca8fe9 commit 1ac2b85

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

packages/core/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ export default function ESLintPlugin(
8181
},
8282
async transform(_, id) {
8383
debug("==== transform hook ====");
84-
debug(`id: ${id}`);
85-
const filePath = getFilePath(id);
86-
debug(`filePath: ${filePath}`);
8784
// worker
88-
if (worker) return worker.postMessage(filePath);
85+
if (worker) return worker.postMessage(id);
8986
// no worker
87+
debug(`id: ${id}`);
9088
const shouldIgnore = await shouldIgnoreModule(id, filter, eslintInstance);
9189
debug(`should ignore: ${shouldIgnore}`);
9290
if (shouldIgnore) return;
91+
const filePath = getFilePath(id);
92+
debug(`filePath: ${filePath}`);
9393
return await lintFiles(
9494
{
9595
files: options.lintDirtyOnly ? filePath : options.include,

packages/core/src/worker.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
ESLintPluginOptions,
99
} from "./types";
1010
import {
11+
getFilePath,
1112
getFilter,
1213
initializeESLint,
1314
lintFiles,
@@ -48,16 +49,18 @@ const initPromise = initializeESLint(options).then((result) => {
4849
}
4950
})();
5051

51-
parentPort?.on("message", async (files) => {
52+
parentPort?.on("message", async (id) => {
5253
// make sure eslintInstance is initialized
5354
if (!eslintInstance) await initPromise;
5455
debug("==== worker message event ====");
55-
debug(`message: ${files}`);
56-
const shouldIgnore = await shouldIgnoreModule(files, filter, eslintInstance);
56+
debug(`id: ${id}`);
57+
const shouldIgnore = await shouldIgnoreModule(id, filter, eslintInstance);
5758
debug(`should ignore: ${shouldIgnore}`);
5859
if (shouldIgnore) return;
60+
const filePath = getFilePath(id);
61+
debug(`filePath: ${filePath}`);
5962
lintFiles({
60-
files: options.lintDirtyOnly ? files : options.include,
63+
files: options.lintDirtyOnly ? filePath : options.include,
6164
eslintInstance,
6265
formatter,
6366
outputFixes,

0 commit comments

Comments
 (0)