From 0c265a0af33bd34d1ba902851e8b1d627303a58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 17 Jan 2021 00:32:59 +0100 Subject: [PATCH] chore: Enforce ban-untagged-todo lint rule (denoland/deno#9135) --- encoding/_yaml/loader/loader.ts | 2 +- encoding/toml.ts | 2 +- fmt/printf.ts | 5 +++-- fmt/printf_test.ts | 24 +++++++++++++++--------- fs/copy_test.ts | 2 +- fs/expand_glob.ts | 1 - http/_io.ts | 2 +- http/cookie.ts | 2 +- http/file_server.ts | 6 +++--- http/file_server_test.ts | 2 +- io/bufio_test.ts | 2 +- mime/multipart_test.ts | 2 +- node/_fs/_fs_access.ts | 6 +++--- node/_fs/_fs_appendFile.ts | 4 ++-- node/global_test.ts | 2 +- node/module.ts | 6 +++--- node/timers.ts | 2 +- node/url.ts | 2 +- wasi/snapshot_preview1.ts | 14 ++++++++------ 19 files changed, 48 insertions(+), 40 deletions(-) diff --git a/encoding/_yaml/loader/loader.ts b/encoding/_yaml/loader/loader.ts index 8bd623347a61..322f5ce0d394 100644 --- a/encoding/_yaml/loader/loader.ts +++ b/encoding/_yaml/loader/loader.ts @@ -667,7 +667,7 @@ function readDoubleQuotedScalar( if (isEOL(ch)) { skipSeparationSpace(state, false, nodeIndent); - // TODO: rework to inline fn with no type cast? + // TODO(bartlomieju): rework to inline fn with no type cast? } else if (ch < 256 && simpleEscapeCheck[ch]) { state.result += simpleEscapeMap[ch]; state.position++; diff --git a/encoding/toml.ts b/encoding/toml.ts index 0bd0ee984320..6cd8faa71a78 100644 --- a/encoding/toml.ts +++ b/encoding/toml.ts @@ -464,7 +464,7 @@ class Parser { for (let i = 0; i < this.tomlLines.length; i++) { const line = this.tomlLines[i]; - // TODO (zekth) Handle unflat of array of tables + // TODO(zekth): Handle unflat of array of tables if (this._isGroup(line)) { // if the current group is an array we push the // parsed objects in it. diff --git a/fmt/printf.ts b/fmt/printf.ts index 4f8a83933bf2..6a821f208913 100644 --- a/fmt/printf.ts +++ b/fmt/printf.ts @@ -151,7 +151,8 @@ class Printf { } } // switch c break; - case State.POSITIONAL: // either a verb or * only verb for now, TODO + case State.POSITIONAL: + // TODO(bartlomieju): either a verb or * only verb for now if (c === "*") { const worp = this.flags.precision === -1 ? WorP.WIDTH @@ -689,7 +690,7 @@ class Printf { if (i !== 0 && this.flags.space) { hex += sharp ? " 0x" : " "; } - // TODO: for now only taking into account the + // TODO(bartlomieju): for now only taking into account the // lower half of the codePoint, ie. as if a string // is a list of 8bit values instead of UCS2 runes const c = (val.charCodeAt(i) & 0xff).toString(16); diff --git a/fmt/printf_test.ts b/fmt/printf_test.ts index 6b6e25a3723c..f2408584816c 100644 --- a/fmt/printf_test.ts +++ b/fmt/printf_test.ts @@ -266,17 +266,18 @@ const tests: Array<[string, any, string]> = [ ["%3c", "⌘".charCodeAt(0), " ⌘"], ["%-3c", "⌘".charCodeAt(0), "⌘ "], // Runes that are not printable. - // {"%c", '\U00000e00', "\u0e00"}, // TODO check if \U escape exists in js + // {"%c", '\U00000e00', "\u0e00"}, + // TODO(bartlomieju) check if \U escape exists in js //["%c", '\U0010ffff'.codePointAt(0), "\U0010ffff"], // Runes that are not valid. ["%c", -1, "�"], - // TODO surrogate half, doesn't make sense in itself, how + // TODO(bartomieju): surrogate half, doesn't make sense in itself, how // to determine in JS? // ["%c", 0xDC80, "�"], ["%c", 0x110000, "�"], ["%c", 0xfffffffff, "�"], - // TODO + // TODO(bartlomieju): // escaped characters // Runes that are not printable. // Runes that are not valid. @@ -291,7 +292,8 @@ const tests: Array<[string, any, string]> = [ ["%.0s", "日本語日本語", ""], ["%.5s", "日本語日本語", "日本語日本"], ["%.10s", "日本語日本語", "日本語日本語"], - // ["%08q", "abc", `000"abc"`], // TODO verb q + // ["%08q", "abc", `000"abc"`], + // TODO(bartlomieju): verb q // ["%-8q", "abc", `"abc" `], //["%.5q", "abcdefghijklmnopqrstuvwxyz", `"abcde"`], ["%.5x", "abcdefghijklmnopqrstuvwxyz", "6162636465"], @@ -301,7 +303,8 @@ const tests: Array<[string, any, string]> = [ // our %x takes lower byte of string "%.1x", "日本語", "e6"],, ["%.1x", "日本語", "e5"], //["%10.1q", "日本語日本語", ` "日"`], - // ["%10v", null, " "], // TODO null, undefined ... + // ["%10v", null, " "], + // TODO(bartlomieju): null, undefined ... // ["%-10v", null, " "], // integers @@ -353,8 +356,10 @@ const tests: Array<[string, any, string]> = [ ["%-#20.8x", 0x1234abc, "0x01234abc "], ["%-#20.8X", 0x1234abc, "0X01234ABC "], ["%-#20.8o", parseInt("01234", 8), "00001234 "], - // Test correct f.intbuf overflow checks. // TODO, lazy - // unicode format // TODO, decide whether unicode verb makes sense %U + // Test correct f.intbuf overflow checks. + // TODO(bartlomieju): lazy + // unicode format + // TODO(bartlomieju): decide whether unicode verb makes sense %U // floats ["%+.3e", 0.0, "+0.000e+00"], @@ -490,10 +495,11 @@ const tests: Array<[string, any, string]> = [ ["%g", 1.23456789e-3, "0.00123457"], // see above prec6 = precdef6 - (-3+1) //["%g", 1.23456789e20, "1.23456789e+20"], ["%g", 1.23456789e20, "1.23457e+20"], - // arrays // TODO + // arrays + // TODO(bartlomieju): // slice : go specific - // TODO decide how to handle deeper types, arrays, objects + // TODO(bartlomieju): decide how to handle deeper types, arrays, objects // byte arrays and slices with %b,%c,%d,%o,%U and %v // f.space should and f.plus should not have an effect with %v. // f.space and f.plus should have an effect with %d. diff --git a/fs/copy_test.ts b/fs/copy_test.ts index 32933b8e09ae..40d7cb19a7a1 100644 --- a/fs/copy_test.ts +++ b/fs/copy_test.ts @@ -327,7 +327,7 @@ testCopySync( assert(destStatInfo.atime instanceof Date); assert(destStatInfo.mtime instanceof Date); - // TODO: Activate test when https://github.com/denoland/deno/issues/2411 + // TODO(bartlomieju): Activate test when https://github.com/denoland/deno/issues/2411 // is fixed // assertEquals(destStatInfo.atime, srcStatInfo.atime); // assertEquals(destStatInfo.mtime, srcStatInfo.mtime); diff --git a/fs/expand_glob.ts b/fs/expand_glob.ts index 358206558170..ec0f560d8281 100644 --- a/fs/expand_glob.ts +++ b/fs/expand_glob.ts @@ -32,7 +32,6 @@ interface SplitPath { winRoot?: string; } -// TODO: Maybe make this public somewhere. function split(path: string): SplitPath { const s = SEP_PATTERN.source; const segments = path diff --git a/http/_io.ts b/http/_io.ts index 5bdf930e6c6f..529f59cb5275 100644 --- a/http/_io.ts +++ b/http/_io.ts @@ -65,7 +65,7 @@ export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader { } const line = await tp.readLine(); if (line === null) throw new Deno.errors.UnexpectedEof(); - // TODO: handle chunk extension + // TODO(bartlomieju): handle chunk extension const [chunkSizeString] = line.split(";"); const chunkSize = parseInt(chunkSizeString, 16); if (Number.isNaN(chunkSize) || chunkSize < 0) { diff --git a/http/cookie.ts b/http/cookie.ts index c48a94d959db..486afd6c646d 100644 --- a/http/cookie.ts +++ b/http/cookie.ts @@ -178,7 +178,7 @@ export function setCookie(res: { headers?: Headers }, cookie: Cookie): void { if (!res.headers) { res.headers = new Headers(); } - // TODO (zekth) : Add proper parsing of Set-Cookie headers + // TODO(zekth) : Add proper parsing of Set-Cookie headers // Parsing cookie headers to make consistent set-cookie header // ref: https://tools.ietf.org/html/rfc6265#section-4.1.1 const v = toString(cookie); diff --git a/http/file_server.ts b/http/file_server.ts index 5b8811c08ddf..8fd2e748429a 100644 --- a/http/file_server.ts +++ b/http/file_server.ts @@ -2,8 +2,8 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // This program serves files in the current directory over HTTP. -// TODO Stream responses instead of reading them into memory. -// TODO Add tests like these: +// TODO(bartlomieju): Stream responses instead of reading them into memory. +// TODO(bartlomieju): Add tests like these: // https://github.com/indexzero/http-server/blob/master/test/http-server-test.js import { extname, posix } from "../path/mod.ts"; @@ -141,7 +141,7 @@ export async function serveFile( }; } -// TODO: simplify this after deno.stat and deno.readDir are fixed +// TODO(bartlomieju): simplify this after deno.stat and deno.readDir are fixed async function serveDir( req: ServerRequest, dirPath: string, diff --git a/http/file_server_test.ts b/http/file_server_test.ts index beb0c830d703..638121b45ae9 100644 --- a/http/file_server_test.ts +++ b/http/file_server_test.ts @@ -201,7 +201,7 @@ Deno.test("serveDirectory", async function (): Promise { assert(page.includes("README.md")); // `Deno.FileInfo` is not completely compatible with Windows yet - // TODO: `mode` should work correctly in the future. + // TODO(bartlomieju): `mode` should work correctly in the future. // Correct this test case accordingly. Deno.build.os !== "windows" && assert(/(\s)*\([a-zA-Z-]{10}\)(\s)*<\/td>/.test(page)); diff --git a/io/bufio_test.ts b/io/bufio_test.ts index 8715cc3b8395..d6a0856deb93 100644 --- a/io/bufio_test.ts +++ b/io/bufio_test.ts @@ -55,7 +55,7 @@ const readMakers: ReadMaker[] = [ fn: (r): iotest.OneByteReader => new iotest.OneByteReader(r), }, { name: "half", fn: (r): iotest.HalfReader => new iotest.HalfReader(r) }, - // TODO { name: "data+err", r => new iotest.DataErrReader(r) }, + // TODO(bartlomieju): { name: "data+err", r => new iotest.DataErrReader(r) }, // { name: "timeout", fn: r => new iotest.TimeoutReader(r) }, ]; diff --git a/mime/multipart_test.ts b/mime/multipart_test.ts index 6d392f7c229b..eee3005f1f3c 100644 --- a/mime/multipart_test.ts +++ b/mime/multipart_test.ts @@ -236,7 +236,7 @@ Deno.test({ assert(file.tempfile != null); assertEquals(file.size, size); assertEquals(file.type, "application/octet-stream"); - // TODO checksum of tmp & sampleFile + // TODO(bartlomieju): checksum of tmp & sampleFile } finally { await Deno.remove(multipartFile); await Deno.remove(sampleFile); diff --git a/node/_fs/_fs_access.ts b/node/_fs/_fs_access.ts index cb1903677f4d..3211e1640070 100644 --- a/node/_fs/_fs_access.ts +++ b/node/_fs/_fs_access.ts @@ -4,7 +4,7 @@ import { notImplemented } from "../_utils.ts"; /** Revist once https://github.com/denoland/deno/issues/4017 lands */ -//TODO - 'path' can also be a Buffer. Neither of these polyfills +// TODO(bartlomieju) 'path' can also be a Buffer. Neither of these polyfills //is available yet. See https://github.com/denoland/deno/issues/3403 export function access( _path: string | URL, @@ -14,8 +14,8 @@ export function access( notImplemented("Not yet available"); } -//TODO - 'path' can also be a Buffer. Neither of these polyfills -//is available yet. See https://github.com/denoland/deno/issues/3403 +// TODO(bartlomieju) 'path' can also be a Buffer. Neither of these polyfills +// is available yet. See https://github.com/denoland/deno/issues/3403 // eslint-disable-next-line @typescript-eslint/no-unused-vars export function accessSync(path: string | URL, mode?: number): void { notImplemented("Not yet available"); diff --git a/node/_fs/_fs_appendFile.ts b/node/_fs/_fs_appendFile.ts index 5a761763255f..fab72d0f7328 100644 --- a/node/_fs/_fs_appendFile.ts +++ b/node/_fs/_fs_appendFile.ts @@ -45,7 +45,7 @@ export function appendFile( : undefined; if (mode) { - //TODO rework once https://github.com/denoland/deno/issues/4017 completes + // TODO(bartlomieju) rework once https://github.com/denoland/deno/issues/4017 completes notImplemented("Deno does not yet support setting mode on create"); } Deno.open(pathOrRid as string, getOpenOptions(flag)) @@ -100,7 +100,7 @@ export function appendFileSync( : undefined; if (mode) { - // TODO rework once https://github.com/denoland/deno/issues/4017 completes + // TODO(bartlomieju) rework once https://github.com/denoland/deno/issues/4017 completes notImplemented("Deno does not yet support setting mode on create"); } diff --git a/node/global_test.ts b/node/global_test.ts index 60c997daf493..2ff768f887c8 100644 --- a/node/global_test.ts +++ b/node/global_test.ts @@ -7,7 +7,7 @@ import timers from "./timers.ts"; // Definitions for this are quite delicate // This ensures modifications to the global namespace don't break on TypeScript -// TODO +// TODO(bartlomieju): // Deno lint marks globals defined by this module as undefined // probably gonna change in the future diff --git a/node/module.ts b/node/module.ts index a7052668ae4f..6716b02d954d 100644 --- a/node/module.ts +++ b/node/module.ts @@ -389,7 +389,7 @@ class Module { const module = new Module(filename, parent); if (isMain) { - // TODO: set process info + // TODO(bartlomieju): set process info // process.mainModule = module; module.id = "."; } @@ -1052,7 +1052,7 @@ type RequireWrapper = ( ) => void; function wrapSafe(filename: string, content: string): RequireWrapper { - // TODO: fix this + // TODO(bartlomieju): fix this const wrapper = Module.wrap(content); // deno-lint-ignore no-explicit-any const [f, err] = (Deno as any).core.evalContext(wrapper, filename); @@ -1135,7 +1135,7 @@ function makeRequireFunction(mod: Module): RequireFunction { } resolve.paths = paths; - // TODO: set main + // TODO(bartlomieju): set main // require.main = process.mainModule; // Enable support to add extra extension types. diff --git a/node/timers.ts b/node/timers.ts index acc2610f727f..44c150aaf0e4 100644 --- a/node/timers.ts +++ b/node/timers.ts @@ -1,5 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// TODO: implement the 'NodeJS.Timeout' and 'NodeJS.Immediate' versions of the timers. +// TODO(bartlomieju): implement the 'NodeJS.Timeout' and 'NodeJS.Immediate' versions of the timers. // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1163ead296d84e7a3c80d71e7c81ecbd1a130e9a/types/node/v12/globals.d.ts#L1120-L1131 export const setTimeout = window.setTimeout; export const clearTimeout = window.clearTimeout; diff --git a/node/url.ts b/node/url.ts index a0a3e5f33752..9d2fbe75786c 100644 --- a/node/url.ts +++ b/node/url.ts @@ -76,7 +76,7 @@ function getPathFromURLWin(url: URL): string { pathname = pathname.replace(forwardSlashRegEx, "\\"); pathname = decodeURIComponent(pathname); if (hostname !== "") { - //TODO add support for punycode encodings + // TODO(bartlomieju): add support for punycode encodings return `\\\\${hostname}${pathname}`; } else { // Otherwise, it's a local path that requires a drive letter diff --git a/wasi/snapshot_preview1.ts b/wasi/snapshot_preview1.ts index b15557e0047c..9a1796e2ee7c 100644 --- a/wasi/snapshot_preview1.ts +++ b/wasi/snapshot_preview1.ts @@ -590,8 +590,10 @@ export default class Context { const memoryView = new DataView(this.#memory.buffer); memoryView.setUint8(offset, entry.type!); memoryView.setUint16(offset + 2, entry.flags!, true); - memoryView.setBigUint64(offset + 8, 0n, true); // TODO - memoryView.setBigUint64(offset + 16, 0n, true); // TODO + // TODO(bartlomieju) + memoryView.setBigUint64(offset + 8, 0n, true); + // TODO(bartlomieju) + memoryView.setBigUint64(offset + 16, 0n, true); return ERRNO_SUCCESS; }), @@ -1371,19 +1373,19 @@ export default class Context { } if ((fdflags & FDFLAGS_DSYNC) != 0) { - // TODO (caspervonb) review if we can emulate this. + // TODO(caspervonb): review if we can emulate this. } if ((fdflags & FDFLAGS_NONBLOCK) != 0) { - // TODO (caspervonb) review if we can emulate this. + // TODO(caspervonb): review if we can emulate this. } if ((fdflags & FDFLAGS_RSYNC) != 0) { - // TODO (caspervonb) review if we can emulate this. + // TODO(caspervonb): review if we can emulate this. } if ((fdflags & FDFLAGS_SYNC) != 0) { - // TODO (caspervonb) review if we can emulate this. + // TODO(caspervonb): review if we can emulate this. } if (!options.read && !options.write && !options.truncate) {