From a7c002ae634b20a2f84c90417327a88c9ac2df99 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 20 Aug 2024 15:14:37 -0400 Subject: [PATCH] chore: enable no-console dlint rule (#25113) --- .dlint.json | 1 + cli/bench/console.js | 3 ++ cli/bench/encode_into.js | 3 ++ cli/bench/getrandom.js | 3 ++ cli/bench/http/deno_tcp.ts | 1 + cli/bench/op_now.js | 3 ++ cli/bench/secure_curves.js | 3 ++ cli/bench/stdio/stdio.js | 2 ++ cli/bench/tty.js | 3 ++ cli/bench/url_parse.js | 3 ++ cli/bench/webstorage.js | 2 ++ cli/bench/write_file.js | 3 ++ ext/cron/01_cron.ts | 1 + ext/http/00_serve.ts | 7 ++++ ext/kv/01_db.ts | 1 + ext/node/polyfills/_utils.ts | 1 + ext/node/polyfills/http.ts | 1 + ext/node/polyfills/http2.ts | 4 +++ ext/node/polyfills/internal/util/debuglog.ts | 2 ++ ext/node/polyfills/testing.ts | 1 + ext/node/polyfills/util.ts | 1 + ext/node/polyfills/worker_threads.ts | 2 +- ext/web/06_streams.js | 1 + runtime/js/99_main.js | 35 +++++++++++++------ tests/ffi/tests/event_loop_integration.ts | 2 ++ tests/ffi/tests/ffi_callback_errors.ts | 2 ++ tests/napi/cleanup_hook_test.js | 2 ++ tests/node_compat/runner/setup.ts | 2 ++ tests/node_compat/test.ts | 2 ++ .../test/fixtures/child-process-spawn-node.js | 4 +-- tests/unit/console_test.ts | 2 ++ tests/unit/fetch_test.ts | 3 ++ tests/unit/serve_test.ts | 2 ++ tests/unit/timers_test.ts | 3 ++ tests/unit/worker_test.ts | 2 ++ tests/unit_node/_fs/_fs_write_test.ts | 3 ++ tests/unit_node/http2_test.ts | 2 ++ tests/unit_node/http_test.ts | 2 ++ tests/unit_node/net_test.ts | 2 ++ tests/unit_node/process_test.ts | 3 +- tests/wpt/wpt.ts | 2 ++ tools/copyright_checker.js | 2 ++ tools/lint.js | 23 +++++------- tools/release/00_start_release.ts | 3 ++ tools/release/03_publish_crates.ts | 3 ++ tools/release/promote_to_rc.ts | 2 ++ tools/upload_wptfyi.js | 2 ++ tools/util.js | 3 ++ tools/verify_pr_title.js | 3 ++ 49 files changed, 138 insertions(+), 30 deletions(-) diff --git a/.dlint.json b/.dlint.json index d25defffb1..f84d2b233c 100644 --- a/.dlint.json +++ b/.dlint.json @@ -4,6 +4,7 @@ "include": [ "ban-untagged-todo", "camelcase", + "no-console", "guard-for-in" ], "exclude": [ diff --git a/cli/bench/console.js b/cli/bench/console.js index 947061a3b9..1d336fbbde 100644 --- a/cli/bench/console.js +++ b/cli/bench/console.js @@ -1,3 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + const count = 100000; for (let i = 0; i < count; i++) console.log("Hello World"); diff --git a/cli/bench/encode_into.js b/cli/bench/encode_into.js index 4881f87528..11f5a56d90 100644 --- a/cli/bench/encode_into.js +++ b/cli/bench/encode_into.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + let [total, count] = typeof Deno !== "undefined" ? Deno.args : [process.argv[2], process.argv[3]]; diff --git a/cli/bench/getrandom.js b/cli/bench/getrandom.js index 87149afebd..3c3ec4aa19 100644 --- a/cli/bench/getrandom.js +++ b/cli/bench/getrandom.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + let [total, count] = typeof Deno !== "undefined" ? Deno.args : [process.argv[2], process.argv[3]]; diff --git a/cli/bench/http/deno_tcp.ts b/cli/bench/http/deno_tcp.ts index bac9ac4973..b795910737 100644 --- a/cli/bench/http/deno_tcp.ts +++ b/cli/bench/http/deno_tcp.ts @@ -3,6 +3,7 @@ // TODO(bartlomieju): Replace this with a real HTTP server once // https://github.com/denoland/deno/issues/726 is completed. // Note: this is a keep-alive server. +// deno-lint-ignore-file no-console const addr = Deno.args[0] || "127.0.0.1:4500"; const [hostname, port] = addr.split(":"); const listener = Deno.listen({ hostname, port: Number(port) }); diff --git a/cli/bench/op_now.js b/cli/bench/op_now.js index ba6be9c3a0..bcc3ea3c56 100644 --- a/cli/bench/op_now.js +++ b/cli/bench/op_now.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + const queueMicrotask = globalThis.queueMicrotask || process.nextTick; let [total, count] = typeof Deno !== "undefined" ? Deno.args diff --git a/cli/bench/secure_curves.js b/cli/bench/secure_curves.js index d1e909c4c8..02d248b23f 100644 --- a/cli/bench/secure_curves.js +++ b/cli/bench/secure_curves.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + let [total, count] = typeof Deno !== "undefined" ? Deno.args : [process.argv[2], process.argv[3]]; diff --git a/cli/bench/stdio/stdio.js b/cli/bench/stdio/stdio.js index 7f0e16b4a0..81bea835a6 100644 --- a/cli/bench/stdio/stdio.js +++ b/cli/bench/stdio/stdio.js @@ -2,6 +2,8 @@ // // From https://github.com/just-js/benchmarks/tree/main/01-stdio +// deno-lint-ignore-file no-console + const blocksize = parseInt(Deno.args[0] || 65536); const buf = new Uint8Array(blocksize); let size = 0; diff --git a/cli/bench/tty.js b/cli/bench/tty.js index 62319c71f2..248a901137 100644 --- a/cli/bench/tty.js +++ b/cli/bench/tty.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + const queueMicrotask = globalThis.queueMicrotask || process.nextTick; let [total, count] = typeof Deno !== "undefined" ? Deno.args diff --git a/cli/bench/url_parse.js b/cli/bench/url_parse.js index c9b62107f5..367cf73f46 100644 --- a/cli/bench/url_parse.js +++ b/cli/bench/url_parse.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + const queueMicrotask = globalThis.queueMicrotask || process.nextTick; let [total, count] = typeof Deno !== "undefined" ? Deno.args diff --git a/cli/bench/webstorage.js b/cli/bench/webstorage.js index b200ef2532..d19f024c63 100644 --- a/cli/bench/webstorage.js +++ b/cli/bench/webstorage.js @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + // Note: when benchmarking across different Deno version, make sure to clear // the DENO_DIR cache. let [total, count] = typeof Deno !== "undefined" ? Deno.args : []; diff --git a/cli/bench/write_file.js b/cli/bench/write_file.js index ab1e2280ee..104a23a8db 100644 --- a/cli/bench/write_file.js +++ b/cli/bench/write_file.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + const queueMicrotask = globalThis.queueMicrotask || process.nextTick; let [total, count] = typeof Deno !== "undefined" ? Deno.args diff --git a/ext/cron/01_cron.ts b/ext/cron/01_cron.ts index 7592e75ef5..017da8ae2f 100644 --- a/ext/cron/01_cron.ts +++ b/ext/cron/01_cron.ts @@ -157,6 +157,7 @@ function cron( const _res = isPromise(result) ? (await result) : result; success = true; } catch (error) { + // deno-lint-ignore no-console console.error(`Exception in cron handler ${name}`, error); success = false; } diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 9c6f805528..02910d580d 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -525,6 +525,7 @@ function mapToCallback(context, callback, onError) { ); } } catch (error) { + // deno-lint-ignore no-console console.error("Exception in onError while handling exception", error); response = internalServerError(); } @@ -533,6 +534,7 @@ function mapToCallback(context, callback, onError) { if (innerRequest?.[_upgraded]) { // We're done here as the connection has been upgraded during the callback and no longer requires servicing. if (response !== UPGRADE_RESPONSE_SENTINEL) { + // deno-lint-ignore no-console console.error("Upgrade response was not returned from callback"); context.close(); } @@ -612,6 +614,7 @@ function serve(arg1, arg2) { const wantsUnix = ObjectHasOwn(options, "path"); const signal = options.signal; const onError = options.onError ?? function (error) { + // deno-lint-ignore no-console console.error(error); return internalServerError(); }; @@ -627,6 +630,7 @@ function serve(arg1, arg2) { if (options.onListen) { options.onListen(listener.addr); } else { + // deno-lint-ignore no-console console.log(`Listening on ${path}`); } }); @@ -684,6 +688,7 @@ function serve(arg1, arg2) { const host = StringPrototypeIncludes(addr.hostname, ":") ? `[${addr.hostname}]` : addr.hostname; + // deno-lint-ignore no-console console.log(`Listening on ${scheme}${host}:${addr.port}/`); } }; @@ -729,6 +734,7 @@ function serveHttpOn(context, addr, callback) { const promiseErrorHandler = (error) => { // Abnormal exit + // deno-lint-ignore no-console console.error( "Terminating Deno.serve loop due to unexpected error", error, @@ -856,6 +862,7 @@ function registerDeclarativeServer(exports) { const nThreads = serveWorkerCount > 1 ? ` with ${serveWorkerCount} threads` : ""; + // deno-lint-ignore no-console console.debug( `%cdeno serve%c: Listening on %chttp://${hostname}:${port}/%c${nThreads}`, "color: green", diff --git a/ext/kv/01_db.ts b/ext/kv/01_db.ts index 9aa2036dd5..418ce3ff26 100644 --- a/ext/kv/01_db.ts +++ b/ext/kv/01_db.ts @@ -318,6 +318,7 @@ class Kv { const _res = isPromise(result) ? (await result) : result; success = true; } catch (error) { + // deno-lint-ignore no-console console.error("Exception in queue handler", error); } finally { const promise: Promise = op_kv_finish_dequeued_message( diff --git a/ext/node/polyfills/_utils.ts b/ext/node/polyfills/_utils.ts index 78b9bdddc3..b50c113e14 100644 --- a/ext/node/polyfills/_utils.ts +++ b/ext/node/polyfills/_utils.ts @@ -42,6 +42,7 @@ export function warnNotImplemented(msg?: string) { const message = msg ? `Warning: Not implemented: ${msg}` : "Warning: Not implemented"; + // deno-lint-ignore no-console console.warn(message); } diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 920f3a5b09..76291490e3 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -1836,6 +1836,7 @@ export class ServerImpl extends EventEmitter { } setTimeout() { + // deno-lint-ignore no-console console.error("Not implemented: Server.setTimeout()"); } diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts index baa2c6e219..98edf40f4e 100644 --- a/ext/node/polyfills/http2.ts +++ b/ext/node/polyfills/http2.ts @@ -127,6 +127,7 @@ type Http2Headers = Record; const debugHttp2Enabled = false; function debugHttp2(...args) { if (debugHttp2Enabled) { + // deno-lint-ignore no-console console.log(...args); } } @@ -1636,16 +1637,19 @@ export class Http2Server extends Server { this.emit("stream", stream, headers); return await stream._deferred.promise; } catch (e) { + // deno-lint-ignore no-console console.log(">>> Error in serveHttpOnConnection", e); } return new Response(""); }, () => { + // deno-lint-ignore no-console console.log(">>> error"); }, () => {}, ); } catch (e) { + // deno-lint-ignore no-console console.log(">>> Error in Http2Server", e); } }, diff --git a/ext/node/polyfills/internal/util/debuglog.ts b/ext/node/polyfills/internal/util/debuglog.ts index 9bbaed606f..bbaba7b6fc 100644 --- a/ext/node/polyfills/internal/util/debuglog.ts +++ b/ext/node/polyfills/internal/util/debuglog.ts @@ -30,6 +30,7 @@ export function initializeDebugEnv(debugEnv: string) { // NODE_DEBUG=http or NODE_DEBUG=http2. function emitWarningIfNeeded(set: string) { if ("HTTP" === set || "HTTP2" === set) { + // deno-lint-ignore no-console console.warn( "Setting the NODE_DEBUG environment variable " + "to '" + set.toLowerCase() + "' can expose sensitive " + @@ -50,6 +51,7 @@ function debuglogImpl( emitWarningIfNeeded(set); debugImpls[set] = function debug(...args: unknown[]) { const msg = args.map((arg) => inspect(arg)).join(" "); + // deno-lint-ignore no-console console.error("%s %s: %s", set, String(Deno.pid), msg); }; } else { diff --git a/ext/node/polyfills/testing.ts b/ext/node/polyfills/testing.ts index 92900e6323..901c38ed36 100644 --- a/ext/node/polyfills/testing.ts +++ b/ext/node/polyfills/testing.ts @@ -28,6 +28,7 @@ class NodeTestContext { } diagnostic(message) { + // deno-lint-ignore no-console console.log("DIAGNOSTIC:", message); } diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts index eee171ccf0..cb4e6498a4 100644 --- a/ext/node/polyfills/util.ts +++ b/ext/node/polyfills/util.ts @@ -234,6 +234,7 @@ function timestamp(): string { */ // deno-lint-ignore no-explicit-any export function log(...args: any[]) { + // deno-lint-ignore no-console console.log("%s - %s", timestamp(), ReflectApply(format, undefined, args)); } diff --git a/ext/node/polyfills/worker_threads.ts b/ext/node/polyfills/worker_threads.ts index 3519ae217a..eaabe9cd7e 100644 --- a/ext/node/polyfills/worker_threads.ts +++ b/ext/node/polyfills/worker_threads.ts @@ -47,7 +47,7 @@ const { const debugWorkerThreads = false; function debugWT(...args) { if (debugWorkerThreads) { - // deno-lint-ignore prefer-primordials + // deno-lint-ignore prefer-primordials no-console console.log(...args); } } diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index ea3a3110f6..69d333c0d0 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -164,6 +164,7 @@ function resolvePromiseWith(value) { function rethrowAssertionErrorRejection(e) { if (e && ObjectPrototypeIsPrototypeOf(AssertionError.prototype, e)) { queueMicrotask(() => { + // deno-lint-ignore no-console console.error(`Internal Error: ${e.stack}`); }); } diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 013f4996fe..8b0d579ab5 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -125,12 +125,15 @@ function warnOnDeprecatedApi(apiName, stack, ...suggestions) { return; } + // deno-lint-ignore no-console + const logError = console.error; + if (!verboseDeprecatedApiWarning) { if (ALREADY_WARNED_DEPRECATED.has(apiName)) { return; } ALREADY_WARNED_DEPRECATED.add(apiName); - console.error( + logError( `%cwarning: %cUse of deprecated "${apiName}" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.`, "color: yellow;", "font-weight: bold;", @@ -176,40 +179,40 @@ function warnOnDeprecatedApi(apiName, stack, ...suggestions) { } ALREADY_WARNED_DEPRECATED.add(apiName + stack); - console.error( + logError( `%cwarning: %cUse of deprecated "${apiName}" API. This API will be removed in Deno 2.`, "color: yellow;", "font-weight: bold;", ); - console.error(); - console.error( + logError(); + logError( "See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations", ); - console.error(); + logError(); if (stackLines.length > 0) { - console.error("Stack trace:"); + logError("Stack trace:"); for (let i = 0; i < stackLines.length; i++) { - console.error(` ${StringPrototypeTrim(stackLines[i])}`); + logError(` ${StringPrototypeTrim(stackLines[i])}`); } - console.error(); + logError(); } for (let i = 0; i < suggestions.length; i++) { const suggestion = suggestions[i]; - console.error( + logError( `%chint: ${suggestion}`, "font-weight: bold;", ); } if (isFromRemoteDependency) { - console.error( + logError( `%chint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.`, "font-weight: bold;", ); } - console.error(); + logError(); } function windowClose() { @@ -716,25 +719,33 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { if (mode === executionModes.serve) { if (serveIsMain && serveWorkerCount) { + // deno-lint-ignore no-console const origLog = console.log; + // deno-lint-ignore no-console const origError = console.error; const prefix = `[serve-worker-0 ]`; + // deno-lint-ignore no-console console.log = (...args) => { return origLog(prefix, ...new primordials.SafeArrayIterator(args)); }; + // deno-lint-ignore no-console console.error = (...args) => { return origError(prefix, ...new primordials.SafeArrayIterator(args)); }; } else if (serveWorkerCount !== null) { + // deno-lint-ignore no-console const origLog = console.log; + // deno-lint-ignore no-console const origError = console.error; const base = `serve-worker-${serveWorkerCount + 1}`; // 15 = "serve-worker-nn".length, assuming // serveWorkerCount < 100 const prefix = `[${StringPrototypePadEnd(base, 15, " ")}]`; + // deno-lint-ignore no-console console.log = (...args) => { return origLog(prefix, ...new primordials.SafeArrayIterator(args)); }; + // deno-lint-ignore no-console console.error = (...args) => { return origError(prefix, ...new primordials.SafeArrayIterator(args)); }; @@ -757,6 +768,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { if (mode === executionModes.serve && !serve) { if (serveIsMain) { // Only error if main worker + // deno-lint-ignore no-console console.error( `%cerror: %cdeno serve requires %cexport default { fetch }%c in the main module, did you mean to run \"deno run\"?`, "color: yellow;", @@ -770,6 +782,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { if (serve) { if (mode === executionModes.run) { + // deno-lint-ignore no-console console.error( `%cwarning: %cDetected %cexport default { fetch }%c, did you mean to run \"deno serve\"?`, "color: yellow;", diff --git a/tests/ffi/tests/event_loop_integration.ts b/tests/ffi/tests/event_loop_integration.ts index d9ada60273..e3914d9662 100644 --- a/tests/ffi/tests/event_loop_integration.ts +++ b/tests/ffi/tests/event_loop_integration.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + const targetDir = Deno.execPath().replace(/[^\/\\]+$/, ""); const [libPrefix, libSuffix] = { darwin: ["lib", "dylib"], diff --git a/tests/ffi/tests/ffi_callback_errors.ts b/tests/ffi/tests/ffi_callback_errors.ts index dbd60636ca..797ff236c1 100644 --- a/tests/ffi/tests/ffi_callback_errors.ts +++ b/tests/ffi/tests/ffi_callback_errors.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + const targetDir = Deno.execPath().replace(/[^\/\\]+$/, ""); const [libPrefix, libSuffix] = { darwin: ["lib", "dylib"], diff --git a/tests/napi/cleanup_hook_test.js b/tests/napi/cleanup_hook_test.js index 0d83bc5b4c..017674ad49 100644 --- a/tests/napi/cleanup_hook_test.js +++ b/tests/napi/cleanup_hook_test.js @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import { assertEquals, loadTestLibrary } from "./common.js"; const properties = loadTestLibrary(); diff --git a/tests/node_compat/runner/setup.ts b/tests/node_compat/runner/setup.ts index 95fee6a20a..37f1aba9b2 100755 --- a/tests/node_compat/runner/setup.ts +++ b/tests/node_compat/runner/setup.ts @@ -1,6 +1,8 @@ #!/usr/bin/env -S deno run --allow-read=. --allow-write=. --allow-run=git --config=tests/config/deno.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + /** This copies the test files according to the config file `tests/node_compat/config.jsonc` */ import { walk } from "@std/fs/walk"; diff --git a/tests/node_compat/test.ts b/tests/node_compat/test.ts index b5c9514a33..f6db4ee1ae 100644 --- a/tests/node_compat/test.ts +++ b/tests/node_compat/test.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + /** * This script will run the test files specified in the configuration file. * diff --git a/tests/node_compat/test/fixtures/child-process-spawn-node.js b/tests/node_compat/test/fixtures/child-process-spawn-node.js index da2b557c96..d403aabf91 100644 --- a/tests/node_compat/test/fixtures/child-process-spawn-node.js +++ b/tests/node_compat/test/fixtures/child-process-spawn-node.js @@ -1,7 +1,5 @@ const assert = require("assert"); -// TODO(kt3k): Uncomment this when util.debuglog is added -// const debug = require('util').debuglog('test'); -const debug = console.log; +const debug = require('util').debuglog('test'); function onmessage(m) { debug("CHILD got message:", m); diff --git a/tests/unit/console_test.ts b/tests/unit/console_test.ts index c133624196..63ffff0dcb 100644 --- a/tests/unit/console_test.ts +++ b/tests/unit/console_test.ts @@ -8,6 +8,8 @@ // std/fmt/colors auto determines whether to put colors in or not. We need // better infrastructure here so we can properly test the colors. +// deno-lint-ignore-file no-console + import { assert, assertEquals, diff --git a/tests/unit/fetch_test.ts b/tests/unit/fetch_test.ts index 9b2463bcc3..aa4ff30671 100644 --- a/tests/unit/fetch_test.ts +++ b/tests/unit/fetch_test.ts @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { assert, assertEquals, diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts index 353621154e..827a094dc4 100644 --- a/tests/unit/serve_test.ts +++ b/tests/unit/serve_test.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import { assertMatch, assertRejects } from "@std/assert"; import { Buffer, BufReader, BufWriter } from "@std/io"; import { TextProtoReader } from "../testdata/run/textproto.ts"; diff --git a/tests/unit/timers_test.ts b/tests/unit/timers_test.ts index 6e829c07fc..70619ae355 100644 --- a/tests/unit/timers_test.ts +++ b/tests/unit/timers_test.ts @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { assert, assertEquals, diff --git a/tests/unit/worker_test.ts b/tests/unit/worker_test.ts index 526618d548..e5966348fe 100644 --- a/tests/unit/worker_test.ts +++ b/tests/unit/worker_test.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + // Requires to be run with `--allow-net` flag import { assert, assertEquals, assertMatch, assertThrows } from "@std/assert"; diff --git a/tests/unit_node/_fs/_fs_write_test.ts b/tests/unit_node/_fs/_fs_write_test.ts index a140548e12..2b07d600bf 100644 --- a/tests/unit_node/_fs/_fs_write_test.ts +++ b/tests/unit_node/_fs/_fs_write_test.ts @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { write, writeSync } from "node:fs"; import { assertEquals } from "@std/assert"; import { Buffer } from "node:buffer"; diff --git a/tests/unit_node/http2_test.ts b/tests/unit_node/http2_test.ts index 7cffd04322..8e98bd28d9 100644 --- a/tests/unit_node/http2_test.ts +++ b/tests/unit_node/http2_test.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import * as http2 from "node:http2"; import { Buffer } from "node:buffer"; import { readFile } from "node:fs/promises"; diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index ec20ec7d7c..2043a00044 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import EventEmitter from "node:events"; import http, { type RequestOptions, type ServerResponse } from "node:http"; import url from "node:url"; diff --git a/tests/unit_node/net_test.ts b/tests/unit_node/net_test.ts index 521de1e73d..f49ff0ef08 100644 --- a/tests/unit_node/net_test.ts +++ b/tests/unit_node/net_test.ts @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import * as net from "node:net"; import { assert, assertEquals } from "@std/assert"; import * as path from "@std/path"; diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index cc9e4dbd4d..a647b0369e 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -1,6 +1,7 @@ -// deno-lint-ignore-file no-undef // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-undef no-console + import process, { arch as importedArch, argv, diff --git a/tests/wpt/wpt.ts b/tests/wpt/wpt.ts index 8879de1332..c42ff51e6e 100755 --- a/tests/wpt/wpt.ts +++ b/tests/wpt/wpt.ts @@ -1,6 +1,8 @@ #!/usr/bin/env -S deno run --allow-write --allow-read --allow-net --allow-env --allow-run --config=tests/config/deno.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + // This script is used to run WPT tests for Deno. import { diff --git a/tools/copyright_checker.js b/tools/copyright_checker.js index 3c46f3b1ed..24afe1dfd7 100755 --- a/tools/copyright_checker.js +++ b/tools/copyright_checker.js @@ -1,6 +1,8 @@ #!/usr/bin/env -S deno run --allow-read=. --allow-run=git --config=tests/config/deno.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import { getSources, ROOT_PATH } from "./util.js"; const copyrightYear = 2024; diff --git a/tools/lint.js b/tools/lint.js index aa02a3e2b3..8c2e0f5949 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -1,5 +1,8 @@ #!/usr/bin/env -S deno run --allow-write --allow-read --allow-run --allow-net --config=tests/config/deno.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { buildMode, getPrebuilt, getSources, join, ROOT_PATH } from "./util.js"; import { checkCopyright } from "./copyright_checker.js"; import * as ciFile from "../.github/workflows/ci.generate.ts"; @@ -44,27 +47,19 @@ async function dlint() { "*.js", "*.ts", ":!:.github/mtime_cache/action.js", - ":!:tests/testdata/swc_syntax_error.ts", - ":!:tests/testdata/error_008_checkjs.js", ":!:cli/bench/testdata/npm/*", ":!:cli/bench/testdata/express-router.js", ":!:cli/bench/testdata/react-dom.js", ":!:cli/compilers/wasm_wrap.js", ":!:cli/tsc/dts/**", + ":!:cli/tsc/*typescript.js", + ":!:cli/tsc/compiler.d.ts", + ":!:runtime/examples/", ":!:target/", ":!:tests/registry/**", ":!:tests/specs/**", - ":!:tests/testdata/encoding/**", - ":!:tests/testdata/error_syntax.js", - ":!:tests/testdata/file_extensions/ts_with_js_extension.js", - ":!:tests/testdata/fmt/**", - ":!:tests/testdata/lint/**", - ":!:tests/testdata/npm/**", - ":!:tests/testdata/run/**", - ":!:tests/testdata/tsc/**", - ":!:tests/testdata/test/glob/**", - ":!:cli/tsc/*typescript.js", - ":!:cli/tsc/compiler.d.ts", + ":!:tests/testdata/**", + ":!:tests/unit_node/testdata/**", ":!:tests/wpt/suite/**", ":!:tests/wpt/runner/**", ]); @@ -93,7 +88,7 @@ async function dlint() { }), ); } - await Promise.all(pending); + await Promise.allSettled(pending); } // `prefer-primordials` has to apply only to files related to bootstrapping, diff --git a/tools/release/00_start_release.ts b/tools/release/00_start_release.ts index b5c35ae5a5..125a76af66 100755 --- a/tools/release/00_start_release.ts +++ b/tools/release/00_start_release.ts @@ -1,5 +1,8 @@ #!/usr/bin/env -S deno run -A --quiet --lock=tools/deno.lock.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { $, createOctoKit, semver } from "./deps.ts"; const currentDirPath = $.path(import.meta).parentOrThrow(); diff --git a/tools/release/03_publish_crates.ts b/tools/release/03_publish_crates.ts index dcad8ed928..ecfb75e796 100755 --- a/tools/release/03_publish_crates.ts +++ b/tools/release/03_publish_crates.ts @@ -1,5 +1,8 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { DenoWorkspace } from "./deno_workspace.ts"; import { $, getCratesPublishOrder } from "./deps.ts"; diff --git a/tools/release/promote_to_rc.ts b/tools/release/promote_to_rc.ts index eb49336783..297f5f4628 100644 --- a/tools/release/promote_to_rc.ts +++ b/tools/release/promote_to_rc.ts @@ -1,6 +1,8 @@ #!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +// deno-lint-ignore-file no-console + import { $ } from "jsr:@david/dax@0.41.0"; import { gray } from "jsr:@std/fmt@1/colors"; import { patchver } from "jsr:@deno/patchver@0.1.0"; diff --git a/tools/upload_wptfyi.js b/tools/upload_wptfyi.js index b8f6d7c5ab..23dd4c6602 100644 --- a/tools/upload_wptfyi.js +++ b/tools/upload_wptfyi.js @@ -4,6 +4,8 @@ // passed, will automatically add a status check to the commit with a link to // the wpt.fyi page. +// deno-lint-ignore-file no-console + import { gzip } from "https://deno.land/x/compress@v0.4.1/gzip/mod.ts"; const user = Deno.env.get("WPT_FYI_USER"); diff --git a/tools/util.js b/tools/util.js index ed322d0d87..99133628ce 100644 --- a/tools/util.js +++ b/tools/util.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + import { dirname, fromFileUrl, join, resolve, toFileUrl } from "@std/path"; import { wait } from "https://deno.land/x/wait@0.1.13/mod.ts"; export { dirname, fromFileUrl, join, resolve, toFileUrl }; diff --git a/tools/verify_pr_title.js b/tools/verify_pr_title.js index d7b393bcd3..98cc30aa7e 100644 --- a/tools/verify_pr_title.js +++ b/tools/verify_pr_title.js @@ -1,4 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +// deno-lint-ignore-file no-console + const prTitle = Deno.args[0]; if (prTitle == null) {