From d54ef02dfe4455c043c3ccb3d1d15e5fcc302756 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Tue, 6 Jun 2023 04:57:01 +0900 Subject: [PATCH] chore: update deno_lint to 0.46.0 (#19372) --- Cargo.lock | 4 ++-- cli/Cargo.toml | 2 +- ext/cache/01_cache.js | 2 ++ ext/console/01_console.js | 3 ++- ext/fetch/21_formdata.js | 3 ++- ext/fetch/22_body.js | 1 + ext/http/00_serve.js | 6 ++++-- ext/url/00_url.js | 1 + ext/web/06_streams.js | 1 + ext/web/09_file.js | 1 + ext/websocket/01_websocket.js | 1 + third_party | 2 +- 12 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ded396c9f..6b2c8a9065 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1101,9 +1101,9 @@ dependencies = [ [[package]] name = "deno_lint" -version = "0.45.0" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3867178bfb6579aaf9ed79599d3181d134f13dfcd38fdd93cae7d53a37bece8d" +checksum = "afc515e82ae97f2cc562ec482251700e96570c8fde997579629f4666e70066d7" dependencies = [ "anyhow", "deno_ast", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 885ef1c863..df045a754a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -45,7 +45,7 @@ deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] deno_doc = "0.62.0" deno_emit = "0.20.0" deno_graph = "=0.48.1" -deno_lint = { version = "0.45.0", features = ["docs"] } +deno_lint = { version = "0.46.0", features = ["docs"] } deno_lockfile.workspace = true deno_npm.workspace = true deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "include_js_files_for_snapshotting"] } diff --git a/ext/cache/01_cache.js b/ext/cache/01_cache.js index 9b5404acbb..9476420efa 100644 --- a/ext/cache/01_cache.js +++ b/ext/cache/01_cache.js @@ -128,6 +128,7 @@ class Cache { "op_cache_put", { cacheId: this[_id], + // deno-lint-ignore prefer-primordials requestUrl: reqUrl.toString(), responseHeaders: innerResponse.headerList, requestHeaders: innerRequest.headerList, @@ -243,6 +244,7 @@ class Cache { "op_cache_match", { cacheId: this[_id], + // deno-lint-ignore prefer-primordials requestUrl: url.toString(), requestHeaders: innerRequest.headerList, }, diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 11b6c549ce..6cf3c6dcac 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -37,6 +37,7 @@ const { Error, ErrorCaptureStackTrace, ErrorPrototype, + ErrorPrototypeToString, FunctionPrototypeBind, FunctionPrototypeCall, FunctionPrototypeToString, @@ -1578,7 +1579,7 @@ function inspectError(value, ctx) { if (stack?.includes("\n at")) { finalMessage += stack; } else { - finalMessage += `[${stack || value.toString()}]`; + finalMessage += `[${stack || ErrorPrototypeToString(value)}]`; } } finalMessage += ArrayPrototypeJoin( diff --git a/ext/fetch/21_formdata.js b/ext/fetch/21_formdata.js index 1ddd5f6564..1f0f00088f 100644 --- a/ext/fetch/21_formdata.js +++ b/ext/fetch/21_formdata.js @@ -31,6 +31,7 @@ const { SafeRegExp, Symbol, StringFromCharCode, + StringPrototypeCharCodeAt, StringPrototypeTrim, StringPrototypeSlice, StringPrototypeSplit, @@ -368,7 +369,7 @@ function parseContentDisposition(value) { function decodeLatin1StringAsUtf8(latin1String) { const buffer = new Uint8Array(latin1String.length); for (let i = 0; i < latin1String.length; i++) { - buffer[i] = latin1String.charCodeAt(i); + buffer[i] = StringPrototypeCharCodeAt(latin1String, i); } return core.decode(buffer); } diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js index 82703af761..9fe00b1445 100644 --- a/ext/fetch/22_body.js +++ b/ext/fetch/22_body.js @@ -424,6 +424,7 @@ function extractBody(object) { ObjectPrototypeIsPrototypeOf(URLSearchParamsPrototype, object) ) { // TODO(@satyarohith): not sure what primordial here. + // deno-lint-ignore prefer-primordials source = object.toString(); contentType = "application/x-www-form-urlencoded;charset=UTF-8"; } else if (ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, object)) { diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js index dbdc227056..ba8080e27b 100644 --- a/ext/http/00_serve.js +++ b/ext/http/00_serve.js @@ -37,6 +37,8 @@ import { import { listen, TcpConn } from "ext:deno_net/01_net.js"; import { listenTls } from "ext:deno_net/02_tls.js"; const { + ArrayPrototypeFlat, + ArrayPrototypePush, ObjectPrototypeIsPrototypeOf, PromisePrototypeCatch, SafeSet, @@ -337,7 +339,7 @@ class InnerRequest { const headers = []; const reqHeaders = op_http_get_request_headers(this.#slabId); for (let i = 0; i < reqHeaders.length; i += 2) { - headers.push([reqHeaders[i], reqHeaders[i + 1]]); + ArrayPrototypePush(headers, [reqHeaders[i], reqHeaders[i + 1]]); } return headers; } @@ -575,7 +577,7 @@ function mapToCallback(context, callback, onError) { if (headers.length == 1) { op_http_set_response_header(req, headers[0][0], headers[0][1]); } else { - op_http_set_response_headers(req, headers.flat()); + op_http_set_response_headers(req, ArrayPrototypeFlat(headers)); } } diff --git a/ext/url/00_url.js b/ext/url/00_url.js index b4bc34b927..49dd2c46f3 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -149,6 +149,7 @@ class URLSearchParams { if (url === null) { return; } + // deno-lint-ignore prefer-primordials url[_updateUrlSearch](this.toString()); } diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index c0cbb30498..21207c3729 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -1261,6 +1261,7 @@ function readableByteStreamControllerEnqueueClonedChunkToQueue( ); } else { // TODO(lucacasonato): add SharedArrayBuffer to primordials + // deno-lint-ignore prefer-primordials cloneResult = buffer.slice(byteOffset, byteOffset + byteLength); } } catch (e) { diff --git a/ext/web/09_file.js b/ext/web/09_file.js index d65a512f93..79a9c41b29 100644 --- a/ext/web/09_file.js +++ b/ext/web/09_file.js @@ -326,6 +326,7 @@ class Blob { relativeStart -= size; relativeEnd -= size; } else { + // deno-lint-ignore prefer-primordials const chunk = part.slice( relativeStart, MathMin(part.size, relativeEnd), diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js index c4c686b9c7..e71cae44a8 100644 --- a/ext/websocket/01_websocket.js +++ b/ext/websocket/01_websocket.js @@ -344,6 +344,7 @@ class WebSocket extends EventTarget { if (ObjectPrototypeIsPrototypeOf(BlobPrototype, data)) { PromisePrototypeThen( + // deno-lint-ignore prefer-primordials data.slice().arrayBuffer(), (ab) => sendTypedArray( diff --git a/third_party b/third_party index ee59830ca2..7882a6c776 160000 --- a/third_party +++ b/third_party @@ -1 +1 @@ -Subproject commit ee59830ca23fd0aa423a3905005835c586e73e77 +Subproject commit 7882a6c7763efbda55318e019b239bec7704765f