Skip to content

Commit d2312d5

Browse files
committed
Add vite@5 to peer dependency range [publish]
1 parent cd756bb commit d2312d5

File tree

5 files changed

+448
-340
lines changed

5 files changed

+448
-340
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.6.0
4+
5+
- Add vite@5 to peer dependency range
6+
- Fix error when using `errorOnUnmatchedPattern: false`
7+
- Update plugin name from `eslint` to `vite-plugin-eslint` to avoid confusion in case of errors reported by Vite
8+
39
## 1.5.0
410

511
- Support async formatters ([#17](https://github.com/nabla/vite-plugin-eslint/pull/17))

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nabla/vite-plugin-eslint",
33
"description": "Plugs ESLint into Vite dev server",
4-
"version": "1.5.0",
4+
"version": "1.6.0",
55
"license": "MIT",
66
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
77
"main": "src/index.js",
@@ -22,12 +22,12 @@
2222
"chalk": "^4"
2323
},
2424
"peerDependencies": {
25-
"vite": "^2 || ^3 || ^4",
25+
"vite": "^2 || ^3 || ^4 || ^5",
2626
"eslint": "*"
2727
},
2828
"devDependencies": {
29-
"eslint": "^8.20.0",
30-
"prettier": "^2.7.1",
31-
"vite": "^3.0.2"
29+
"eslint": "^8.53.0",
30+
"prettier": "3.0.3",
31+
"vite": "^5.0.0"
3232
}
3333
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function eslintPlugin(options = {}) {
1313
let worker; // Don't initialize worker for builds
1414

1515
return {
16-
name: "eslint",
16+
name: "vite-plugin-eslint",
1717
apply: "serve",
1818
transform(_code, id) {
1919
const path = normalizePath(id);

src/worker.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ parentPort.on("message", (path) => {
1515
.then(async (ignored) => {
1616
if (ignored) return;
1717
const [report] = await eslint.lintFiles(path);
18+
if (!report) return; // Can be empty with errorOnUnmatchedPattern: false
1819
if (report.output !== undefined) await fs.writeFile(path, report.output);
1920
if (report.messages.length === 0) return;
2021
if (formatterPromise) {
@@ -27,8 +28,8 @@ parentPort.on("message", (path) => {
2728
const rule = m.ruleId ? ` ${m.ruleId}` : "";
2829
console.log(
2930
`${location}: ${chalk[m.severity === 2 ? "red" : "yellow"](
30-
m.message
31-
)}${rule}`
31+
m.message,
32+
)}${rule}`,
3233
);
3334
});
3435
}
@@ -38,8 +39,8 @@ parentPort.on("message", (path) => {
3839
// Can happen when the file is deleted or moved
3940
console.log(
4041
`${chalk.yellow(`[eslint] File not found`)} ${chalk.dim(
41-
e.messageData.pattern
42-
)}`
42+
e.messageData.pattern,
43+
)}`,
4344
);
4445
} else {
4546
// Otherwise log the full error

0 commit comments

Comments
 (0)