Skip to content

Commit 369a2fe

Browse files
committed
chore: simplify variable names
1 parent 50136de commit 369a2fe

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"extends": [
3-
"eslint-config-unjs"
4-
],
5-
"rules": {}
2+
"extends": ["eslint-config-unjs"],
3+
"rules": {
4+
"@typescript-eslint/no-unused-vars": 0
5+
}
66
}

src/utils.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,12 @@ export function serialCaller(hooks: HookCallback[], arguments_?: any[]) {
9696
}
9797

9898
/** @deprecated */
99-
export function parallelCaller(hooks: HookCallback[], arguments_?: any[]) {
100-
return Promise.all(hooks.map((hook) => hook(...arguments_)));
99+
export function parallelCaller(hooks: HookCallback[], args?: any[]) {
100+
return Promise.all(hooks.map((hook) => hook(...args)));
101101
}
102102

103-
export function callEachWith(
104-
callbacks: Array<(argument0: any) => any>,
105-
argument0?: any
106-
) {
103+
export function callEachWith(callbacks: Array<(arg0: any) => any>, arg0?: any) {
107104
for (const callback of callbacks) {
108-
callback(argument0);
105+
callback(arg0);
109106
}
110107
}

test/types.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("hook types", () => {
77
test("correctly handles non-nested hooks", () => {
88
const hooks = createHooks<{
99
foo: () => true;
10-
bar: (_argument: string) => 42;
10+
bar: (_arg: string) => 42;
1111
}>();
1212

1313
expectTypeOf(hooks.hook).parameter(0).not.toBeAny();
@@ -20,7 +20,7 @@ describe("hook types", () => {
2020
test("deprecates hooks", () => {
2121
const hooks = createHooks<{
2222
foo: () => true;
23-
bar: (_argument: string) => 42;
23+
bar: (_arg: string) => 42;
2424
}>();
2525
hooks.deprecateHooks({
2626
foo: { to: "bar" },
@@ -30,43 +30,43 @@ describe("hook types", () => {
3030
test("handles nested hooks", () => {
3131
const hooks = createHooks<{
3232
"namespace:foo": (argument: number) => void;
33-
bar: (_argument: string) => void;
33+
bar: (_arg: string) => void;
3434
"namespace:baz": (argument: "42") => void;
3535
}>();
3636

3737
// should be valid
3838
hooks.addHooks({
39-
namespace: { foo: (_argument) => {}, baz: (_argument) => {} },
40-
bar: (_argument) => {},
39+
namespace: { foo: (_arg) => {}, baz: (_arg) => {} },
40+
bar: (_arg) => {},
4141
"namespace:foo": () => {},
4242
});
4343
// @ts-expect-error
44-
hooks.addHooks({ a: (_argument) => {} });
44+
hooks.addHooks({ a: (_arg) => {} });
4545
// @ts-expect-error
46-
hooks.addHooks({ namespace: { nonexistent: (_argument) => {} } });
46+
hooks.addHooks({ namespace: { nonexistent: (_arg) => {} } });
4747
});
4848

4949
test("handles nested hooks with signature", () => {
5050
const hooks = createHooks<{
5151
[key: string]: HookCallback;
5252
"namespace:foo": (argument: number) => void;
53-
bar: (_argument: string) => void;
53+
bar: (_arg: string) => void;
5454
}>();
5555

5656
// should both be valid
5757
hooks.addHooks({
58-
namespace: { foo: (_argument) => {} },
59-
bar: (_argument) => {},
58+
namespace: { foo: (_arg) => {} },
59+
bar: (_arg) => {},
6060
"namespace:foo": () => {},
6161
});
62-
hooks.addHooks({ namespace: { nothing: (_argument) => {} } });
63-
hooks.addHooks({ nothing: (_argument) => {} });
62+
hooks.addHooks({ namespace: { nothing: (_arg) => {} } });
63+
hooks.addHooks({ nothing: (_arg) => {} });
6464
});
6565

6666
test("beforeEach and afterEach typings", () => {
6767
const hooks = createHooks<{
6868
foo: () => true;
69-
bar: (_argument: number) => 42;
69+
bar: (_arg: number) => 42;
7070
}>();
7171

7272
expectTypeOf(hooks.beforeEach).parameter(0).not.toBeAny();

0 commit comments

Comments
 (0)