summaryrefslogtreecommitdiff
path: root/std/node/_util
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-06-12 09:19:29 -0400
committerGitHub <noreply@github.com>2020-06-12 09:19:29 -0400
commitd0970daacda0b6f6c2077c2f81948536b574bbe9 (patch)
treef116548be832ae6786449dd6f1257865efe38026 /std/node/_util
parentca1c2ee82207f2ead857ab4aeca48edff16827ae (diff)
make std deno-lint clean (#6240)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'std/node/_util')
-rw-r--r--std/node/_util/_util_callbackify_test.ts14
-rw-r--r--std/node/_util/_util_promisify.ts2
2 files changed, 13 insertions, 3 deletions
diff --git a/std/node/_util/_util_callbackify_test.ts b/std/node/_util/_util_callbackify_test.ts
index c68a2ed50..630e4d0e7 100644
--- a/std/node/_util/_util_callbackify_test.ts
+++ b/std/node/_util/_util_callbackify_test.ts
@@ -21,8 +21,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-/* eslint-disable @typescript-eslint/no-explicit-any */
-
const { test } = Deno;
import { assert, assertStrictEquals } from "../../testing/asserts.ts";
import { callbackify } from "./_util_callbackify.ts";
@@ -107,8 +105,10 @@ test("callbackify passes the resolution value as the second argument to the call
});
});
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
function thenableFn(): PromiseLike<any> {
return {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
then(onfulfilled): PromiseLike<any> {
assert(onfulfilled);
onfulfilled(value);
@@ -146,7 +146,9 @@ test("callbackify passes the rejection value as the first argument to the callba
if (err instanceof Error) {
if ("reason" in err) {
assert(!value);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).code, "ERR_FALSY_VALUE_REJECTION");
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).reason, value);
} else {
assertStrictEquals(String(value).endsWith(err.message), true);
@@ -177,7 +179,9 @@ test("callbackify passes the rejection value as the first argument to the callba
if (err instanceof Error) {
if ("reason" in err) {
assert(!value);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).code, "ERR_FALSY_VALUE_REJECTION");
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).reason, value);
} else {
assertStrictEquals(String(value).endsWith(err.message), true);
@@ -206,7 +210,9 @@ test("callbackify passes the rejection value as the first argument to the callba
if (err instanceof Error) {
if ("reason" in err) {
assert(!value);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).code, "ERR_FALSY_VALUE_REJECTION");
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).reason, value);
} else {
assertStrictEquals(String(value).endsWith(err.message), true);
@@ -322,10 +328,12 @@ test("callbackify preserves the `this` binding", async () => {
test("callbackify throws with non-function inputs", () => {
["foo", null, undefined, false, 0, {}, Symbol(), []].forEach((value) => {
try {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
callbackify(value as any);
throw Error("We should never reach this error");
} catch (err) {
assert(err instanceof TypeError);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).code, "ERR_INVALID_ARG_TYPE");
assertStrictEquals(err.name, "TypeError");
assertStrictEquals(
@@ -342,6 +350,7 @@ test("callbackify returns a function that throws if the last argument is not a f
return 42;
}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
const cb = callbackify(asyncFn) as any;
const args: unknown[] = [];
@@ -353,6 +362,7 @@ test("callbackify returns a function that throws if the last argument is not a f
throw Error("We should never reach this error");
} catch (err) {
assert(err instanceof TypeError);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
assertStrictEquals((err as any).code, "ERR_INVALID_ARG_TYPE");
assertStrictEquals(err.name, "TypeError");
assertStrictEquals(
diff --git a/std/node/_util/_util_promisify.ts b/std/node/_util/_util_promisify.ts
index d7ca55be8..e3cc36a0c 100644
--- a/std/node/_util/_util_promisify.ts
+++ b/std/node/_util/_util_promisify.ts
@@ -69,7 +69,7 @@ export function promisify(original: Function): Function {
function fn(...args: unknown[]): Promise<unknown> {
return new Promise((resolve, reject) => {
- // @ts-ignore
+ // @ts-ignore: 'this' implicitly has type 'any' because it does not have a type annotation
original.call(this, ...args, (err: Error, ...values: unknown[]) => {
if (err) {
return reject(err);