Skip to content

Commit 06c3ad8

Browse files
authored
Update deps (#1025)
* update all deps * migrate Babel config * remove react from dev deps * remove semver from dev deps * update eslint to 9.6.0 * replace rimraf by native fs calls
1 parent 943f412 commit 06c3ad8

14 files changed

+1930
-2161
lines changed

.eslintignore

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

.eslintrc

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

babel.config.json

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
{
2+
"assumptions": {
3+
"arrayLikeIsIterable": true,
4+
"constantReexports": true,
5+
"ignoreFunctionLength": true,
6+
"ignoreToPrimitiveHint": true,
7+
"mutableTemplateObject": true,
8+
"noClassCalls": true,
9+
"noDocumentAll": true,
10+
"objectRestNoSymbols": true,
11+
"privateFieldsAsProperties": true,
12+
"pureGetters": true,
13+
"setClassMethods": true,
14+
"setComputedProperties": true,
15+
"setPublicClassFields": true,
16+
"setSpreadProperties": true,
17+
"skipForOfIteratorClosing": true,
18+
"superIsCallableConstructor": true
19+
},
220
"targets": {
321
"node": "14.15.0"
422
},
523
"presets": [
6-
["@babel/preset-env", {
7-
"loose": true,
8-
"bugfixes": true,
9-
"modules": false
10-
}]
24+
[
25+
"@babel/preset-env",
26+
{
27+
"bugfixes": true,
28+
"modules": false
29+
}
30+
]
1131
]
1232
}

eslint.config.mjs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
2+
import globals from "globals";
3+
import babelParser from "@babel/eslint-parser";
4+
import js from "@eslint/js";
5+
6+
export default [
7+
{
8+
ignores: [
9+
"**/lib",
10+
"**/node_modules",
11+
"**/scripts",
12+
"test/output",
13+
"test/fixtures",
14+
],
15+
},
16+
js.configs.recommended,
17+
{
18+
languageOptions: {
19+
globals: globals.node,
20+
parser: babelParser,
21+
ecmaVersion: "latest",
22+
sourceType: "module",
23+
},
24+
25+
rules: {
26+
camelcase: "off",
27+
"consistent-return": "off",
28+
curly: ["error", "multi-line"],
29+
"linebreak-style": ["error", "unix"],
30+
"max-len": ["error", 110, 2],
31+
"new-cap": "off",
32+
"no-cond-assign": "off",
33+
"no-confusing-arrow": "error",
34+
"no-console": "off",
35+
"no-constant-condition": "off",
36+
"no-empty": "off",
37+
"no-fallthrough": "off",
38+
"no-inner-declarations": "off",
39+
"no-labels": "off",
40+
"no-loop-func": "off",
41+
"no-process-exit": "off",
42+
"no-return-assign": "off",
43+
"no-shadow": "off",
44+
"no-underscore-dangle": "off",
45+
"no-unreachable": "off",
46+
"no-use-before-define": "off",
47+
strict: "off",
48+
},
49+
},
50+
eslintPluginPrettierRecommended,
51+
];

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,17 @@
2525
"@babel/preset-env": "^7.23.3",
2626
"ava": "^3.13.0",
2727
"c8": "^8.0.0",
28-
"eslint": "^8.45.0",
29-
"eslint-config-prettier": "^8.8.0",
30-
"eslint-plugin-prettier": "^5.0.0",
28+
"eslint": "^9.6.0",
29+
"eslint-config-prettier": "^9.1.0",
30+
"eslint-plugin-prettier": "^5.1.3",
31+
"globals": "^15.8.0",
3132
"husky": "^8.0.3",
3233
"lint-staged": "^13.2.3",
3334
"prettier": "^3.0.0",
34-
"react": "^17.0.1",
35-
"rimraf": "^5.0.1",
36-
"semver": "7.5.2",
3735
"webpack": "^5.89.0"
3836
},
3937
"scripts": {
40-
"clean": "rimraf lib/",
38+
"clean": "node ./scripts/rimraf.mjs lib",
4139
"build": "babel src/ --out-dir lib/ --copy-files",
4240
"format": "prettier --write --trailing-comma all 'src/**/*.js' 'test/**/*.test.js' 'test/helpers/*.js' && prettier --write --trailing-comma es5 'scripts/*.js'",
4341
"lint": "eslint src test",

scripts/rimraf.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { rmSync } from "fs";
2+
3+
if (process.argv[2]) {
4+
rmSync(process.argv[2], { recursive: true, force: true });
5+
}

src/cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let hashType = "sha256";
2323
// use md5 hashing if sha256 is not available
2424
try {
2525
crypto.createHash(hashType);
26-
} catch (err) {
26+
} catch {
2727
hashType = "md5";
2828
}
2929

@@ -98,7 +98,7 @@ const handleCache = async function (directory, params) {
9898
// No errors mean that the file was previously cached
9999
// we just need to return it
100100
return await read(file, cacheCompression);
101-
} catch (err) {}
101+
} catch {}
102102

103103
const fallback =
104104
typeof cacheDirectory !== "string" && directory !== os.tmpdir();

test/cache.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import test from "ava";
22
import fs from "fs";
33
import path from "path";
4-
import { rimraf } from "rimraf";
54
import { webpackAsync } from "./helpers/webpackAsync.js";
65
import createTestDirectory from "./helpers/createTestDirectory.js";
76

@@ -40,8 +39,13 @@ test.beforeEach(async t => {
4039
const cacheDirectory = await createTestDirectory(cacheDir, t.title);
4140
t.context.cacheDirectory = cacheDirectory;
4241
});
43-
test.beforeEach(() => rimraf(defaultCacheDir));
44-
test.afterEach(t => rimraf([t.context.directory, t.context.cacheDirectory]));
42+
test.beforeEach(() =>
43+
fs.rmSync(defaultCacheDir, { recursive: true, force: true }),
44+
);
45+
test.afterEach(t => {
46+
fs.rmSync(t.context.directory, { recursive: true, force: true });
47+
fs.rmSync(t.context.cacheDirectory, { recursive: true, force: true });
48+
});
4549

4650
test("should output files to cache directory", async t => {
4751
const config = Object.assign({}, globalConfig, {
@@ -100,7 +104,6 @@ test("should output json.gz files to standard cache dir by default", async t =>
100104
t.true(files.length > 0);
101105
});
102106

103-
// eslint-disable-next-line max-len
104107
test("should output non-compressed files to standard cache dir when cacheCompression is set to false", async t => {
105108
const config = Object.assign({}, globalConfig, {
106109
output: {

test/helpers/createTestDirectory.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import path from "path";
22
import fs from "fs/promises";
3-
import { rimraf } from "rimraf";
43

54
export default async function createTestDirectory(baseDirectory, testTitle) {
65
const directory = path.join(baseDirectory, escapeDirectory(testTitle));
76

8-
await rimraf(directory);
7+
await fs.rm(directory, { recursive: true, force: true });
98
await fs.mkdir(directory, { recursive: true });
109
return directory;
1110
}

test/loader.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import test from "ava";
22
import fs from "fs";
33
import path from "path";
4-
import { rimraf } from "rimraf";
54
import { satisfies } from "semver";
65
import createTestDirectory from "./helpers/createTestDirectory.js";
76
import { webpackAsync } from "./helpers/webpackAsync.js";
@@ -35,7 +34,9 @@ test.beforeEach(async t => {
3534
t.context.directory = directory;
3635
});
3736

38-
test.afterEach(t => rimraf(t.context.directory));
37+
test.afterEach(t =>
38+
fs.rmSync(t.context.directory, { recursive: true, force: true }),
39+
);
3940

4041
test("should transpile the code snippet", async t => {
4142
const config = Object.assign({}, globalConfig, {

0 commit comments

Comments
 (0)