Socket
Socket
Sign inDemoInstall

@nabla/vite-plugin-eslint

Package Overview
Dependencies
Maintainers
2
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.2.0 to 1.3.0

worker.js

34

index.js

@@ -1,3 +0,3 @@

const chalk = require("chalk");
const { ESLint } = require("eslint");
const path = require("path");
const { Worker } = require("worker_threads");
const { normalizePath } = require("vite");

@@ -9,7 +9,8 @@

shouldLint = (path) => path.match(/\/src\/.*\.[jt]sx?$/),
formatter: format,
formatter,
} = options;
const eslint = new ESLint({ cache: true, ...eslintOptions });
const formatterPromise = format ? eslint.loadFormatter(format) : undefined;
const worker = new Worker(path.resolve(__dirname, "./worker.js"), {
workerData: { options: { cache: true, ...eslintOptions }, formatter },
});

@@ -21,24 +22,3 @@ return {

const path = normalizePath(id);
if (shouldLint(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}` : "";
console.log(
`${location}: ${chalk[m.severity === 2 ? "red" : "yellow"](
`${m.message}`
)}${rule}`
);
});
}
});
}
if (shouldLint(path)) worker.postMessage(path);
return null;

@@ -45,0 +25,0 @@ },

{
"name": "@nabla/vite-plugin-eslint",
"version": "1.2.0",
"version": "1.3.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Plugs ESLint into Vite dev server",

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