Skip to content

Commit

Permalink
Add vite@5 to peer dependency range [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Nov 16, 2023
1 parent cd756bb commit d2312d5
Show file tree
Hide file tree
Showing 5 changed files with 448 additions and 340 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog

## 1.6.0

- Add vite@5 to peer dependency range
- Fix error when using `errorOnUnmatchedPattern: false`
- Update plugin name from `eslint` to `vite-plugin-eslint` to avoid confusion in case of errors reported by Vite

## 1.5.0

- Support async formatters ([#17](https://github.com/nabla/vite-plugin-eslint/pull/17))
Expand Down
10 changes: 5 additions & 5 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "@nabla/vite-plugin-eslint",
"description": "Plugs ESLint into Vite dev server",
"version": "1.5.0",
"version": "1.6.0",
"license": "MIT",
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
"main": "src/index.js",
Expand All @@ -22,12 +22,12 @@
"chalk": "^4"
},
"peerDependencies": {
"vite": "^2 || ^3 || ^4",
"vite": "^2 || ^3 || ^4 || ^5",
"eslint": "*"
},
"devDependencies": {
"eslint": "^8.20.0",
"prettier": "^2.7.1",
"vite": "^3.0.2"
"eslint": "^8.53.0",
"prettier": "3.0.3",
"vite": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -13,7 +13,7 @@ module.exports = function eslintPlugin(options = {}) {
let worker; // Don't initialize worker for builds

return {
name: "eslint",
name: "vite-plugin-eslint",
apply: "serve",
transform(_code, id) {
const path = normalizePath(id);
Expand Down
9 changes: 5 additions & 4 deletions src/worker.js
Expand Up @@ -15,6 +15,7 @@ parentPort.on("message", (path) => {
.then(async (ignored) => {
if (ignored) return;
const [report] = await eslint.lintFiles(path);
if (!report) return; // Can be empty with errorOnUnmatchedPattern: false
if (report.output !== undefined) await fs.writeFile(path, report.output);
if (report.messages.length === 0) return;
if (formatterPromise) {
Expand All @@ -27,8 +28,8 @@ parentPort.on("message", (path) => {
const rule = m.ruleId ? ` ${m.ruleId}` : "";
console.log(
`${location}: ${chalk[m.severity === 2 ? "red" : "yellow"](
m.message
)}${rule}`
m.message,
)}${rule}`,
);
});
}
Expand All @@ -38,8 +39,8 @@ parentPort.on("message", (path) => {
// Can happen when the file is deleted or moved
console.log(
`${chalk.yellow(`[eslint] File not found`)} ${chalk.dim(
e.messageData.pattern
)}`
e.messageData.pattern,
)}`,
);
} else {
// Otherwise log the full error
Expand Down

0 comments on commit d2312d5

Please sign in to comment.