@nabla/vite-plugin-eslint
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"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", |
@@ -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); | ||
} | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66543
77