Skip to content

Commit 2807344

Browse files
committed
Prefer non-strict methods when using node:assert/strict
1 parent aad7796 commit 2807344

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

config-v-next/eslint.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ function createConfig(configFilePath, packageEntryPoints = []) {
214214
message:
215215
"Use ensureError() or HardhatError.isHardhatError instead of casting the error",
216216
},
217+
{
218+
selector:
219+
"CallExpression[callee.object.name='assert'][callee.property.name=/strict/i]",
220+
message:
221+
"Use non-strict methods when importing from 'node:assert/strict'",
222+
},
217223
],
218224
"@typescript-eslint/restrict-plus-operands": "error",
219225
"@typescript-eslint/restrict-template-expressions": [

v-next/core/test/internal/plugins/resolve-plugin-list.ts

+21-18
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ describe("Plugins - resolve plugin list", () => {
1010
);
1111

1212
it("should return empty on an empty plugin list", async () => {
13-
assert.deepStrictEqual(
14-
await resolvePluginList([], installedPackageFixture),
15-
[],
16-
);
13+
assert.deepEqual(await resolvePluginList([], installedPackageFixture), []);
1714
});
1815

1916
it("should return empty on an undefined plugin list", async () => {
20-
assert.deepStrictEqual(
17+
assert.deepEqual(
2118
await resolvePluginList(undefined, installedPackageFixture),
2219
[],
2320
);
@@ -28,7 +25,7 @@ describe("Plugins - resolve plugin list", () => {
2825
id: "example-plugin",
2926
};
3027

31-
assert.deepStrictEqual(
28+
assert.deepEqual(
3229
await resolvePluginList([plugin], installedPackageFixture),
3330
[plugin],
3431
);
@@ -40,9 +37,10 @@ describe("Plugins - resolve plugin list", () => {
4037
const b: HardhatPlugin = { id: "b", dependencies: [async () => c] };
4138
const a: HardhatPlugin = { id: "a", dependencies: [async () => b] };
4239

43-
assert.deepStrictEqual(
40+
const expected = [c, b, a];
41+
assert.deepEqual(
4442
await resolvePluginList([a], installedPackageFixture),
45-
[c, b, a],
43+
expected,
4644
);
4745
});
4846

@@ -52,9 +50,10 @@ describe("Plugins - resolve plugin list", () => {
5250
const b: HardhatPlugin = { id: "b" };
5351
const a: HardhatPlugin = { id: "a" };
5452

55-
assert.deepStrictEqual(
53+
const expected = [a, b, c];
54+
assert.deepEqual(
5655
await resolvePluginList([a, b, c], installedPackageFixture),
57-
[a, b, c],
56+
expected,
5857
);
5958
});
6059

@@ -69,9 +68,10 @@ describe("Plugins - resolve plugin list", () => {
6968
dependencies: [async () => b, async () => c],
7069
};
7170

72-
assert.deepStrictEqual(
71+
const expected = [b, c, a];
72+
assert.deepEqual(
7373
await resolvePluginList([a], installedPackageFixture),
74-
[b, c, a],
74+
expected,
7575
);
7676
});
7777

@@ -83,9 +83,10 @@ describe("Plugins - resolve plugin list", () => {
8383
const b: HardhatPlugin = { id: "b", dependencies: [async () => c] };
8484
const a: HardhatPlugin = { id: "a", dependencies: [async () => c] };
8585

86-
assert.deepStrictEqual(
86+
const expected = [c, a, b];
87+
assert.deepEqual(
8788
await resolvePluginList([a, b], installedPackageFixture),
88-
[c, a, b],
89+
expected,
8990
);
9091
});
9192

@@ -103,9 +104,10 @@ describe("Plugins - resolve plugin list", () => {
103104
dependencies: [async () => b, async () => c],
104105
};
105106

106-
assert.deepStrictEqual(
107+
const expected = [d, b, c, a];
108+
assert.deepEqual(
107109
await resolvePluginList([a], installedPackageFixture),
108-
[d, b, c, a],
110+
expected,
109111
);
110112
});
111113

@@ -133,9 +135,10 @@ describe("Plugins - resolve plugin list", () => {
133135
dependencies: [async () => c, async () => d],
134136
};
135137

136-
assert.deepStrictEqual(
138+
const expected = [i, g, c, d, a, h, e, f, b];
139+
assert.deepEqual(
137140
await resolvePluginList([a, b], installedPackageFixture),
138-
[i, g, c, d, a, h, e, f, b],
141+
expected,
139142
);
140143
});
141144

v-next/hardhat-utils/test/fs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ describe("File system utils", () => {
576576
const encoder = new TextEncoder();
577577
const binaryContent = encoder.encode(content);
578578

579-
assert.deepStrictEqual(await readBinaryFile(filePath), binaryContent);
579+
assert.deepEqual(await readBinaryFile(filePath), binaryContent);
580580
expectTypeOf(await readBinaryFile(filePath)).toMatchTypeOf<Uint8Array>();
581581
});
582582

0 commit comments

Comments
 (0)