vite-plugin-eslint2
Version:
ESLint plugin for Vite.
24 lines (23 loc) • 975 B
JavaScript
const require_linter = require("./linter-COpRffPK.cjs");
let node_worker_threads = require("node:worker_threads");
let debug = require("debug");
debug = require_linter.__toESM(debug, 1);
//#region src/worker.ts
const debug$1 = (0, debug.default)(`${require_linter.PLUGIN_NAME}:worker`);
const options = node_worker_threads.workerData.options;
const onOverlayPayload = options.customOverlay ? (payload) => node_worker_threads.parentPort?.postMessage({
type: "overlay-payload",
payload
}) : void 0;
const linter = require_linter.createLinter(options, onOverlayPayload ? { onOverlayPayload } : void 0);
debug$1("==== worker start ====");
if (options.lintOnStart) {
debug$1("Lint on start");
linter.lintAll().catch((error) => debug$1(`lintAll failed: ${error}`));
}
node_worker_threads.parentPort?.on("message", (id) => {
debug$1("==== worker message event ====");
debug$1(`id: ${id}`);
linter.lint(id).catch((error) => debug$1(`lint failed: ${error}`));
});
//#endregion