Skip to content

Commit e9216ef

Browse files
authored
chore: upgrade eslint from v8 to v9 (#804)
1 parent 1561c30 commit e9216ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4547
-2172
lines changed

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"package-lock.json",
4444
"node_modules",
4545
"coverage",
46-
"*.log"
46+
"*.log",
47+
"test/fixtures/**"
4748
]
4849
}

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ module.exports = {
146146
},
147147
// If absolute path is a `glob` we replace backslashes with forward slashes, because only forward slashes can be used in the `glob`
148148
path.posix.join(
149-
path.resolve(__dirname, "src").replace(/\\/g, "/"),
149+
path.resolve(__dirname, "src").replaceAll("\\", "/"),
150150
"*.txt",
151151
),
152152
],
@@ -184,7 +184,7 @@ module.exports = {
184184
{
185185
// If absolute path is a `glob` we replace backslashes with forward slashes, because only forward slashes can be used in the `glob`
186186
from: path.posix.join(
187-
path.resolve(__dirname, "fixtures").replace(/\\/g, "/"),
187+
path.resolve(__dirname, "fixtures").replaceAll("\\", "/"),
188188
"*.txt",
189189
),
190190
},
@@ -397,7 +397,7 @@ Default: `undefined`
397397
**webpack.config.js**
398398

399399
```js
400-
const fs = require("fs").promise;
400+
const fs = require("node:fs").promise;
401401

402402
module.exports = {
403403
plugins: [
@@ -684,19 +684,13 @@ Type:
684684
type cache =
685685
| boolean
686686
| {
687-
keys: {
688-
[key: string]: any;
689-
};
687+
keys: Record<string, any>;
690688
}
691689
| {
692690
keys: (
693-
defaultCacheKeys: {
694-
[key: string]: any;
695-
},
691+
defaultCacheKeys: Record<string, any>,
696692
absoluteFilename: string,
697-
) => Promise<{
698-
[key: string]: any;
699-
}>;
693+
) => Promise<Record<string, any>>;
700694
}
701695
| undefined;
702696
```
@@ -849,7 +843,7 @@ type transformAll = (
849843
sourceFilename: string;
850844
absoluteFilename: string;
851845
}[],
852-
) => any;
846+
) => string[];
853847
```
854848

855849
Default: `undefined`
@@ -1181,7 +1175,7 @@ module.exports = {
11811175
patterns: [
11821176
{
11831177
from: path.posix.join(
1184-
path.resolve(__dirname, "src").replace(/\\/g, "/"),
1178+
path.resolve(__dirname, "src").replaceAll("\\", "/"),
11851179
"**/*",
11861180
),
11871181
globOptions: {

eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from "eslint/config";
2+
import configs from "eslint-config-webpack/configs.js";
3+
import eslintPluginJest from "eslint-plugin-jest";
4+
5+
export default defineConfig([
6+
{
7+
extends: [configs["recommended-dirty"]],
8+
plugins: {
9+
jest: eslintPluginJest,
10+
},
11+
rules: {
12+
"jest/expect-expect": [
13+
"error",
14+
{
15+
assertFunctionNames: ["expect", "runEmit", "runForce", "runChange"],
16+
},
17+
],
18+
},
19+
},
20+
]);

globalSetup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const path = require("path");
2-
const fs = require("fs");
1+
const fs = require("node:fs");
2+
const path = require("node:path");
33

44
const removeIllegalCharacterForWindows = require("./test/helpers/removeIllegalCharacterForWindows");
55

@@ -12,11 +12,11 @@ const specialFiles = {
1212
};
1313

1414
module.exports = () => {
15-
Object.keys(specialFiles).forEach((originFile) => {
15+
for (const originFile of Object.keys(specialFiles)) {
1616
const file = removeIllegalCharacterForWindows(originFile);
1717
const dir = path.dirname(file);
1818

1919
fs.mkdirSync(path.join(baseDir, dir), { recursive: true });
2020
fs.writeFileSync(path.join(baseDir, file), specialFiles[originFile]);
21-
});
21+
}
2222
};

0 commit comments

Comments
 (0)