Socket
Socket
Sign inDemoInstall

@nabla/vite-plugin-eslint

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nabla/vite-plugin-eslint - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

5

package.json
{
"name": "@nabla/vite-plugin-eslint",
"version": "1.3.1",
"version": "1.3.2",
"license": "MIT",

@@ -17,3 +17,4 @@ "description": "Plugs ESLint into Vite dev server",

"vite",
"eslint"
"eslint",
"vite-plugin"
],

@@ -20,0 +21,0 @@ "main": "index.js",

51

worker.js

@@ -12,22 +12,37 @@ const { workerData, parentPort } = require("worker_threads");

parentPort.on("message", (path) => {
eslint.isPathIgnored(path).then(async (ignored) => {
if (ignored) return;
const [report] = await eslint.lintFiles(path);
if (report.messages.length === 0) return;
if (formatterPromise) {
const formatter = await formatterPromise;
console.log(formatter.format([report]));
} else {
report.messages.forEach((m) => {
const prettyPath = path.slice(path.indexOf("/src/") + 1);
const location = `${prettyPath}(${m.line},${m.column})`;
const rule = m.ruleId ? ` ${m.ruleId}` : "";
eslint
.isPathIgnored(path)
.then(async (ignored) => {
if (ignored) return;
const [report] = await eslint.lintFiles(path);
if (report.messages.length === 0) return;
if (formatterPromise) {
const formatter = await formatterPromise;
console.log(formatter.format([report]));
} else {
report.messages.forEach((m) => {
const prettyPath = path.slice(path.indexOf("/src/") + 1);
const location = `${prettyPath}(${m.line},${m.column})`;
const rule = m.ruleId ? ` ${m.ruleId}` : "";
console.log(
`${location}: ${chalk[m.severity === 2 ? "red" : "yellow"](
m.message
)}${rule}`
);
});
}
})
.catch((e) => {
if (e.messageTemplate === "file-not-found" && e.messageData?.pattern) {
// Can happen when the file is deleted or moved
console.log(
`${location}: ${chalk[m.severity === 2 ? "red" : "yellow"](
`${m.message}`
)}${rule}`
`${chalk.yellow(`[eslint] File not found`)} ${chalk.dim(
e.messageData.pattern
)}`
);
});
}
});
} else {
// Otherwise log the full error
console.error(e);
}
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc