vite-plugin-eslint2
Version:
ESLint plugin for Vite.
24 lines (23 loc) • 856 B
JavaScript
import { n as PLUGIN_NAME, t as createLinter } from "./linter-D_nGEUO0.mjs";
import { parentPort, workerData } from "node:worker_threads";
import debugWrap from "debug";
//#region src/worker.ts
const debug = debugWrap(`${PLUGIN_NAME}:worker`);
const options = workerData.options;
const onOverlayPayload = options.customOverlay ? (payload) => parentPort?.postMessage({
type: "overlay-payload",
payload
}) : void 0;
const linter = createLinter(options, onOverlayPayload ? { onOverlayPayload } : void 0);
debug("==== worker start ====");
if (options.lintOnStart) {
debug("Lint on start");
linter.lintAll().catch((error) => debug(`lintAll failed: ${error}`));
}
parentPort?.on("message", (id) => {
debug("==== worker message event ====");
debug(`id: ${id}`);
linter.lint(id).catch((error) => debug(`lint failed: ${error}`));
});
//#endregion
export {};