summaryrefslogtreecommitdiff
path: root/std/node
diff options
context:
space:
mode:
Diffstat (limited to 'std/node')
-rw-r--r--std/node/_util/_util_callbackify_test.ts14
-rw-r--r--std/node/_util/_util_promisify.ts2
-rw-r--r--std/node/_utils.ts8
-rw-r--r--std/node/events.ts4
-rw-r--r--std/node/module.ts12
5 files changed, 25 insertions, 15 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);
diff --git a/std/node/_utils.ts b/std/node/_utils.ts
index b8c4fa00e..463d4e67c 100644
--- a/std/node/_utils.ts
+++ b/std/node/_utils.ts
@@ -16,10 +16,10 @@ export type MaybeDefined<T> = T | undefined;
export type MaybeEmpty<T> = T | null | undefined;
export function intoCallbackAPI<T>(
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
func: (...args: any[]) => Promise<T>,
cb: MaybeEmpty<(err: MaybeNull<Error>, value: MaybeEmpty<T>) => void>,
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
...args: any[]
): void {
func(...args)
@@ -28,11 +28,11 @@ export function intoCallbackAPI<T>(
}
export function intoCallbackAPIWithIntercept<T1, T2>(
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
func: (...args: any[]) => Promise<T1>,
interceptor: (v: T1) => T2,
cb: MaybeEmpty<(err: MaybeNull<Error>, value: MaybeEmpty<T2>) => void>,
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
...args: any[]
): void {
func(...args)
diff --git a/std/node/events.ts b/std/node/events.ts
index fee715f0c..8d6e90abd 100644
--- a/std/node/events.ts
+++ b/std/node/events.ts
@@ -226,7 +226,8 @@ export default class EventEmitter {
rawListener: Function;
context: EventEmitter;
},
- ...args: any[] // eslint-disable-line @typescript-eslint/no-explicit-any
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ...args: any[]
): void {
this.context.removeListener(this.eventName, this.rawListener);
this.listener.apply(this.context, args);
@@ -434,7 +435,6 @@ export function on(
const unconsumedEventValues: any[] = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const unconsumedPromises: any[] = [];
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
let error: Error | null = null;
let finished = false;
diff --git a/std/node/module.ts b/std/node/module.ts
index daa01d2b2..55c5f2d32 100644
--- a/std/node/module.ts
+++ b/std/node/module.ts
@@ -659,7 +659,9 @@ function readPackage(requestPath: string): PackageInfo | null {
json = new TextDecoder().decode(
Deno.readFileSync(path.toNamespacedPath(jsonPath))
);
- } catch {}
+ } catch {
+ // pass
+ }
if (json === undefined) {
packageJsonCache.set(jsonPath, null);
@@ -839,7 +841,7 @@ function applyExports(basePath: string, expansion: string): string {
}
if (typeof pkgExports === "object") {
- if (pkgExports.hasOwnProperty(mappingKey)) {
+ if (Object.prototype.hasOwnProperty.call(pkgExports, mappingKey)) {
const mapping = pkgExports[mappingKey];
return resolveExportsTarget(
pathToFileURL(basePath + "/"),
@@ -910,7 +912,6 @@ function resolveExports(
return path.resolve(nmPath, request);
}
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
function resolveExportsTarget(
pkgPath: URL,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -959,7 +960,7 @@ function resolveExportsTarget(
}
} else if (typeof target === "object" && target !== null) {
// removed experimentalConditionalExports
- if (target.hasOwnProperty("default")) {
+ if (Object.prototype.hasOwnProperty.call(target, "default")) {
try {
return resolveExportsTarget(
pkgPath,
@@ -1012,7 +1013,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy(
},
getOwnPropertyDescriptor(target, prop): PropertyDescriptor | undefined {
- if (target.hasOwnProperty(prop)) {
+ if (Object.prototype.hasOwnProperty.call(target, prop)) {
return Object.getOwnPropertyDescriptor(target, prop);
}
emitCircularRequireWarning(prop);
@@ -1114,7 +1115,6 @@ interface RequireResolveFunction extends RequireResolve {
}
interface RequireFunction extends Require {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
resolve: RequireResolveFunction;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
extensions: { [key: string]: (module: Module, filename: string) => any };