1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00

build: migrate to dlint (#8176)

This commit migrates repository from using "eslint" 
to "dlint" for linting JavaScript code.
This commit is contained in:
Bartek Iwańczuk 2020-11-03 16:19:29 +01:00 committed by GitHub
parent e736d0f60f
commit 8e914be742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
124 changed files with 440 additions and 423 deletions

View file

@ -40,7 +40,7 @@ declare interface Performance {
declare interface PerformanceMarkOptions {
/** Metadata to be included in the mark. */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
detail?: any;
/** Timestamp to be used as the mark time. */
@ -49,7 +49,7 @@ declare interface PerformanceMarkOptions {
declare interface PerformanceMeasureOptions {
/** Metadata to be included in the measure. */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
detail?: any;
/** Timestamp to be used as the start time or string to be used as start
@ -1847,7 +1847,7 @@ declare namespace Deno {
export function metrics(): Metrics;
interface ResourceMap {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
[rid: number]: any;
}

View file

@ -3,8 +3,6 @@
// Documentation partially adapted from [MDN](https://developer.mozilla.org/),
// by Mozilla Contributors, which is licensed under CC-BY-SA 2.5.
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, no-var */
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
/// <reference lib="deno.web" />

View file

@ -1,7 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-explicit-any */
/// <reference no-default-lib="true" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.shared_globals" />
@ -51,5 +49,3 @@ declare function confirm(message?: string): boolean;
* @param defaultValue
*/
declare function prompt(message?: string, defaultValue?: string): string | null;
/* eslint-enable @typescript-eslint/no-explicit-any */

View file

@ -1,7 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */
/// <reference no-default-lib="true" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.shared_globals" />
@ -60,5 +58,3 @@ declare var onerror:
declare var close: () => void;
declare var name: string;
declare var postMessage: (message: any) => void;
/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */

View file

@ -173,8 +173,6 @@
static kClearScreenDown = "\x1b[0J";
}
/* eslint-disable @typescript-eslint/no-use-before-define */
function getClassInstanceName(instance) {
if (typeof instance != "object") {
return "";
@ -194,7 +192,9 @@
if (customInspect in value && typeof value[customInspect] === "function") {
try {
return String(value[customInspect]());
} catch {}
} catch {
// pass
}
}
// Might be Function/AsyncFunction/GeneratorFunction/AsyncGeneratorFunction
let cstrName = Object.getPrototypeOf(value)?.constructor?.name;
@ -358,7 +358,6 @@
let order = "padStart";
if (value !== undefined) {
for (let i = 0; i < entries.length; i++) {
/* eslint-disable @typescript-eslint/no-explicit-any */
if (
typeof value[i] !== "number" &&
typeof value[i] !== "bigint"
@ -366,7 +365,6 @@
order = "padEnd";
break;
}
/* eslint-enable */
}
}
// Each iteration creates a single line of grouped entries.
@ -483,6 +481,7 @@
.replace(/\t/g, "\\t")
.replace(/\v/g, "\\v")
.replace(
// deno-lint-ignore no-control-regex
/[\x00-\x1f\x7f-\x9f]/g,
(c) => "\\x" + c.charCodeAt(0).toString(16).padStart(2, "0"),
);
@ -519,11 +518,12 @@
) {
const green = maybeColor(colors.green, inspectOptions);
switch (typeof value) {
case "string":
case "string": {
const trunc = value.length > STR_ABBREVIATE_SIZE
? value.slice(0, STR_ABBREVIATE_SIZE) + "..."
: value;
return green(quoteString(trunc)); // Quoted strings are green
}
default:
return inspectValue(value, ctx, level, inspectOptions);
}
@ -784,7 +784,7 @@
: red(`[Thrown ${error.name}: ${error.message}]`);
entries.push(`${maybeQuoteString(key)}: ${inspectedValue}`);
} else {
let descriptor = Object.getOwnPropertyDescriptor(value, key);
const descriptor = Object.getOwnPropertyDescriptor(value, key);
if (descriptor.get !== undefined && descriptor.set !== undefined) {
entries.push(`${maybeQuoteString(key)}: [Getter/Setter]`);
} else if (descriptor.get !== undefined) {
@ -818,7 +818,7 @@
: red(`Thrown ${error.name}: ${error.message}`);
entries.push(`[${maybeQuoteSymbol(key)}]: ${inspectedValue}`);
} else {
let descriptor = Object.getOwnPropertyDescriptor(value, key);
const descriptor = Object.getOwnPropertyDescriptor(value, key);
if (descriptor.get !== undefined && descriptor.set !== undefined) {
entries.push(`[${maybeQuoteSymbol(key)}]: [Getter/Setter]`);
} else if (descriptor.get !== undefined) {
@ -867,7 +867,9 @@
if (customInspect in value && typeof value[customInspect] === "function") {
try {
return String(value[customInspect]());
} catch {}
} catch {
// pass
}
}
// This non-unique symbol is used to support op_crates, ie.
// in op_crates/web we don't want to depend on unique "Deno.customInspect"
@ -880,7 +882,9 @@
) {
try {
return String(value[nonUniqueCustomInspect]());
} catch {}
} catch {
// pass
}
}
if (value instanceof Error) {
return String(value.stack);
@ -1158,7 +1162,7 @@
let inValue = false;
let currentKey = null;
let parenthesesDepth = 0;
currentPart = "";
let currentPart = "";
for (let i = 0; i < cssString.length; i++) {
const c = cssString[i];
if (c == "(") {

View file

@ -1,5 +1,4 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-explicit-any */
((window) => {
const core = window.Deno.core;

View file

@ -81,7 +81,7 @@
});
/** @type {{ emittedFiles: Record<string, string>, diagnostics: any[] }} */
const result = await opCompile(payload);
let output = result.emittedFiles["deno:///bundle.js"];
const output = result.emittedFiles["deno:///bundle.js"];
util.assert(output);
const maybeDiagnostics = result.diagnostics.length === 0
? undefined

View file

@ -18,7 +18,7 @@
}
}
const openOptions = !!options.append
const openOptions = options.append
? { write: true, create: true, append: true }
: { write: true, create: true, truncate: true };
const file = openSync(path, openOptions);
@ -48,7 +48,7 @@
}
}
const openOptions = !!options.append
const openOptions = options.append
? { write: true, create: true, append: true }
: { write: true, create: true, truncate: true };
const file = await open(path, openOptions);

View file

@ -1,6 +1,8 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
__bootstrap.denoNs = {
((window) => {
const __bootstrap = window.__bootstrap;
__bootstrap.denoNs = {
test: __bootstrap.testing.test,
metrics: __bootstrap.metrics.metrics,
Process: __bootstrap.process.Process,
@ -85,9 +87,9 @@ __bootstrap.denoNs = {
fsync: __bootstrap.fs.fsync,
fdatasyncSync: __bootstrap.fs.fdatasyncSync,
fdatasync: __bootstrap.fs.fdatasync,
};
};
__bootstrap.denoNsUnstable = {
__bootstrap.denoNsUnstable = {
signal: __bootstrap.signals.signal,
signals: __bootstrap.signals.signals,
Signal: __bootstrap.signals.Signal,
@ -131,4 +133,5 @@ __bootstrap.denoNsUnstable = {
symlinkSync: __bootstrap.fs.symlinkSync,
HttpClient: __bootstrap.fetch.HttpClient,
createHttpClient: __bootstrap.fetch.createHttpClient,
};
};
})(this);

View file

@ -1,11 +1,12 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file
// This is a specialised implementation of a System module loader.
"use strict";
// @ts-nocheck
/* eslint-disable */
let System, __instantiate;
(() => {
const r = new Map();

View file

@ -1,11 +1,12 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file
// This is a specialised implementation of a System module loader.
"use strict";
// @ts-nocheck
/* eslint-disable */
var System, __instantiate;
(function () {
// deno-fmt-ignore

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file
// There was a bug where if this was executed with --reload it would throw a
// type error.
window.test = null;

View file

@ -1,4 +1,4 @@
// @ts-expect-error
// @ts-expect-error "Deno.core" is not a public interface
Deno.core.evalContext(
"(async () => console.log(await import('./subdir/mod4.js')))()",
);

View file

@ -11,10 +11,10 @@ import { loaded as loadedJsx3 } from "http://localhost:4545/cli/tests/subdir/mt_
import { loaded as loadedJsx4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx";
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
// deno-lint-ignore no-namespace
namespace JSX {
interface IntrinsicElements {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
[elemName: string]: any;
}
}

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
export namespace NS {
export function test(name: string, fn: Function): void;
export function test(options: object): void;

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
export interface D {
resolve: any;
reject: any;

View file

@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
read(files: string[]): void {
files.forEach((file) => Deno.readFileSync(file));

View file

@ -1,4 +1,5 @@
/* eslint-disable */
// deno-lint-ignore-file
function b() {
return function (
_target: any,

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
let x = {
a: {
b: {

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
export function retb() {
return "b";
}

View file

@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
const { args } = Deno;
import { createHash, SupportedAlgorithm } from "../../std/hash/mod.ts";
@ -6,6 +6,7 @@ import { Md5 } from "../../std/hash/md5.ts";
import { Sha1 } from "../../std/hash/sha1.ts";
import { Sha256 } from "../../std/hash/sha256.ts";
import { Sha512 } from "../../std/hash/sha512.ts";
// deno-lint-ignore camelcase
import { Sha3_224, Sha3_256, Sha3_384, Sha3_512 } from "../../std/hash/sha3.ts";
if (args.length < 3) Deno.exit(0);
@ -14,6 +15,7 @@ const method = args[0];
const alg = args[1];
const inputFile = args[2];
// deno-lint-ignore no-explicit-any
function getJsHash(alg: string): any {
switch (alg) {
case "md5":

View file

@ -1 +1,2 @@
// deno-lint-ignore-file
require("invalid module specifier");

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file
for (let i = 0; i < 128; i++) {
console.log(i);
debugger;

View file

@ -1,6 +1,8 @@
try {
Deno.removeSync("./lock_write_fetch.json");
} catch {}
} catch {
// pass
}
const fetchProc = Deno.run({
stdout: "null",

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
function a() {
console.log("a(): evaluated");
return (

View file

@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
readRequired(): Promise<void> {
Deno.readFileSync("README.md");

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
function a() {
console.log("a(): evaluated");
return (

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
export function boo() {
console.log("Boo!");
}

View file

@ -1,6 +1,8 @@
import order from "./order.js";
const end = Date.now() + 500;
while (end < Date.now()) {}
while (end < Date.now()) {
// pass
}
order.push("d");

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
function Decorate() {
return function (constructor: any): any {

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
import { B } from "./subdir/more_decorators.ts";

View file

@ -1,4 +1,4 @@
/* eslint-disable */
// deno-lint-ignore-file
type Foo = import("./ts_type_imports_foo.ts").Foo;

View file

@ -1,3 +1,3 @@
/* eslint-disable */
// deno-lint-ignore-file
const foo = { delete<S>() {} };

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file
/// <reference no-default-lib="true"/>
/// <reference lib="dom" />
/// <reference lib="deno.ns" />

View file

@ -1,3 +1,5 @@
// deno-lint-ignore-file
// @deno-types="./type_definitions/foo.d.ts"
import { foo } from "./type_definitions/foo.js";
// @deno-types="./type_definitions/fizz.d.ts"

View file

@ -46,7 +46,7 @@ unitTest(function blobShouldNotThrowError(): void {
let hasThrown = false;
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const options1: any = {
ending: "utf8",
hasOwnProperty: "hasOwnProperty",

View file

@ -2,7 +2,7 @@
import { assert, assertEquals, unitTest } from "./test_util.ts";
// just a hack to get a body object
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function buildBody(body: any, headers?: Headers): Body {
const stub = new Request("http://foo/", {
body: body,

View file

@ -184,7 +184,6 @@ unitTest(function consoleTestStringifyLongStrings(): void {
assertEquals(actual, veryLongString);
});
/* eslint-disable @typescript-eslint/explicit-function-return-type */
unitTest(function consoleTestStringifyCircular(): void {
class Base {
a = 1;
@ -196,7 +195,7 @@ unitTest(function consoleTestStringifyCircular(): void {
m2() {}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const nestedObj: any = {
num: 1,
bool: true,
@ -345,7 +344,6 @@ unitTest(function consoleTestStringifyCircular(): void {
// test inspect is working the same
assertEquals(stripColor(Deno.inspect(nestedObj)), nestedObjExpected);
});
/* eslint-enable @typescript-eslint/explicit-function-return-type */
unitTest(function consoleTestStringifyFunctionWithPrototypeRemoved(): void {
const f = function f() {};
@ -363,7 +361,7 @@ unitTest(function consoleTestStringifyFunctionWithPrototypeRemoved(): void {
});
unitTest(function consoleTestStringifyWithDepth(): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const nestedObj: any = { a: { b: { c: { d: { e: { f: 42 } } } } } };
assertEquals(
stripColor(inspectArgs([nestedObj], { depth: 3 })),
@ -1144,7 +1142,7 @@ class StringBuffer {
}
type ConsoleExamineFunc = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
csl: any,
out: StringBuffer,
err?: StringBuffer,

View file

@ -1,9 +1,9 @@
import { assertMatch, assertStrictEquals, unitTest } from "./test_util.ts";
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
// deno-lint-ignore no-namespace
namespace Deno {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
var core: any; // eslint-disable-line no-var
}
}

View file

@ -26,9 +26,9 @@ unitTest(async function sendAsyncStackTrace(): Promise<void> {
});
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
// deno-lint-ignore no-namespace
namespace Deno {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
var core: any; // eslint-disable-line no-var
}
}

View file

@ -75,7 +75,7 @@ unitTest(function testDomIterableScope(): void {
const domIterable = new DomIterable([["foo", 1]]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function checkScope(thisArg: any, expected: any): void {
function callback(this: typeof thisArg): void {
assertEquals(this, expected);

View file

@ -7,7 +7,7 @@ const { setPrepareStackTrace } = Deno[Deno.internal];
interface CallSite {
getThis(): unknown;
getTypeName(): string | null;
// eslint-disable-next-line @typescript-eslint/ban-types
// deno-lint-ignore ban-types
getFunction(): Function | null;
getFunctionName(): string | null;
getMethodName(): string | null;
@ -36,7 +36,7 @@ function getMockCallSite(
getTypeName(): string {
return "";
},
// eslint-disable-next-line @typescript-eslint/ban-types
// deno-lint-ignore ban-types
getFunction(): Function {
return (): void => {};
},
@ -125,7 +125,7 @@ unitTest(function errorStackMessageLine(): void {
// FIXME(bartlomieju): no longer works after migrating
// to JavaScript runtime code
unitTest({ ignore: true }, function prepareStackTrace(): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const MockError = {} as any;
setPrepareStackTrace(MockError);
assert(typeof MockError.prepareStackTrace === "function");

View file

@ -68,7 +68,7 @@ unitTest(function eventPreventDefaultSuccess(): void {
});
unitTest(function eventInitializedWithNonStringType(): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const type: any = undefined;
const event = new Event(type);
@ -94,7 +94,7 @@ unitTest(function eventIsTrusted(): void {
});
unitTest(function eventInspectOutput(): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const cases: Array<[any, (event: any) => string]> = [
[
new Event("test"),

View file

@ -84,7 +84,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyUsed(): Promise<
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
assertEquals(response.bodyUsed, false);
assertThrows((): void => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(response as any).bodyUsed = true;
});
await response.blob();

View file

@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert, assertEquals, unitTest } from "./test_util.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function testFirstArgument(arg1: any[], expectedSize: number): void {
const file = new File(arg1, "name");
assert(file instanceof File);
@ -77,7 +77,7 @@ unitTest(function fileObjectInFileBits(): void {
testFirstArgument([{}], 15);
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function testSecondArgument(arg2: any, expectedFileName: string): void {
const file = new File(["bits"], arg2);
assert(file instanceof File);

View file

@ -319,7 +319,7 @@ unitTest(
// writing null should throw an error
await assertThrowsAsync(
async (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
await file.write(null as any);
},
); // TODO: Check error kind when dispatch_minimal pipes errors properly
@ -346,7 +346,7 @@ unitTest(
// reading file into null buffer should throw an error
await assertThrowsAsync(async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
await file.read(null as any);
}, TypeError);
// TODO: Check error kind when dispatch_minimal pipes errors properly

View file

@ -41,9 +41,9 @@ unitTest(function formDataParamsGetSuccess(): void {
formData.append("a", "true");
formData.append("b", "false");
formData.append("a", "null");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
formData.append("d", undefined as any);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
formData.append("e", null as any);
assertEquals(formData.get("a"), "true");
assertEquals(formData.get("b"), "false");
@ -70,10 +70,10 @@ unitTest(function formDataParamsSetSuccess(): void {
assertEquals(formData.getAll("b"), ["false"]);
formData.set("a", "false");
assertEquals(formData.getAll("a"), ["false"]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
formData.set("d", undefined as any);
assertEquals(formData.get("d"), "undefined");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
formData.set("e", null as any);
assertEquals(formData.get("e"), "null");
});
@ -143,7 +143,7 @@ unitTest(function formDataParamsArgumentsCheck(): void {
let hasThrown = 0;
let errMsg = "";
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(formData as any)[method]();
hasThrown = 1;
} catch (err) {
@ -167,7 +167,7 @@ unitTest(function formDataParamsArgumentsCheck(): void {
let errMsg = "";
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(formData as any)[method]();
hasThrown = 1;
} catch (err) {
@ -187,7 +187,7 @@ unitTest(function formDataParamsArgumentsCheck(): void {
hasThrown = 0;
errMsg = "";
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(formData as any)[method]("foo");
hasThrown = 1;
} catch (err) {

View file

@ -27,7 +27,7 @@ unitTest(function formatDiagnosticBasic() {
unitTest(function formatDiagnosticError() {
let thrown = false;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const bad = ([{ hello: 123 }] as any) as Deno.Diagnostic[];
try {
Deno.formatDiagnostics(bad);

View file

@ -60,7 +60,6 @@ unitTest(function webAssemblyExists(): void {
assert(typeof WebAssembly.compile === "function");
});
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
declare global {
// deno-lint-ignore no-namespace
namespace Deno {
@ -68,26 +67,25 @@ declare global {
var core: any;
}
}
/* eslint-enable */
unitTest(function DenoNamespaceImmutable(): void {
const denoCopy = window.Deno;
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(Deno as any) = 1;
} catch {
// pass
}
assert(denoCopy === Deno);
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(window as any).Deno = 1;
} catch {
// pass
}
assert(denoCopy === Deno);
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
delete (window as any).Deno;
} catch {
// pass
@ -96,14 +94,14 @@ unitTest(function DenoNamespaceImmutable(): void {
const { readFile } = Deno;
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(Deno as any).readFile = 1;
} catch {
// pass
}
assert(readFile === Deno.readFile);
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
delete (window as any).Deno.readFile;
} catch {
// pass

View file

@ -22,7 +22,7 @@ unitTest(function newHeaderTest(): void {
new Headers(undefined);
new Headers({});
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
new Headers(null as any);
} catch (e) {
assertEquals(
@ -36,11 +36,11 @@ const headerDict: Record<string, string> = {
name1: "value1",
name2: "value2",
name3: "value3",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
name4: undefined as any,
"Content-Type": "value4",
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const headerSeq: any[] = [];
for (const name in headerDict) {
headerSeq.push([name, headerDict[name]]);
@ -273,7 +273,7 @@ unitTest(function headerParamsArgumentsCheck(): void {
let hasThrown = 0;
let errMsg = "";
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(headers as any)[method]();
hasThrown = 1;
} catch (err) {
@ -297,7 +297,7 @@ unitTest(function headerParamsArgumentsCheck(): void {
let errMsg = "";
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(headers as any)[method]();
hasThrown = 1;
} catch (err) {
@ -317,7 +317,7 @@ unitTest(function headerParamsArgumentsCheck(): void {
hasThrown = 0;
errMsg = "";
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(headers as any)[method]("foo");
hasThrown = 1;
} catch (err) {

View file

@ -3,7 +3,7 @@ import { assertThrows, assertThrowsAsync, unitTest } from "./test_util.ts";
unitTest(async function permissionInvalidName(): Promise<void> {
await assertThrowsAsync(async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
await Deno.permissions.query({ name: "foo" as any });
}, Error);
});

View file

@ -10,7 +10,7 @@ unitTest(function fromInit(): void {
},
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assertEquals("ahoyhoy", (req as any)._bodySource);
assertEquals(req.url, "http://foo/");
assertEquals(req.headers.get("test-header"), "value");
@ -18,13 +18,13 @@ unitTest(function fromInit(): void {
unitTest(function fromRequest(): void {
const r = new Request("http://foo/");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(r as any)._bodySource = "ahoyhoy";
r.headers.set("test-header", "value");
const req = new Request(r);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assertEquals((req as any)._bodySource, (r as any)._bodySource);
assertEquals(req.url, r.url);
assertEquals(req.headers.get("test-header"), r.headers.get("test-header"));
@ -64,6 +64,6 @@ unitTest(async function cloneRequestBodyStream(): Promise<void> {
assertEquals(b1, b2);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assert((r1 as any)._bodySource !== (r2 as any)._bodySource);
});

View file

@ -2,7 +2,7 @@
import { assertThrows, unitTest } from "./test_util.ts";
unitTest(function streamReadableHwmError() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const invalidHwm: any[] = [NaN, Number("NaN"), {}, -1, "two"];
for (const highWaterMark of invalidHwm) {
assertThrows(
@ -17,14 +17,14 @@ unitTest(function streamReadableHwmError() {
assertThrows(() => {
new ReadableStream<number>(
undefined,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
{ highWaterMark: Symbol("hwk") as any },
);
}, TypeError);
});
unitTest(function streamWriteableHwmError() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const invalidHwm: any[] = [NaN, Number("NaN"), {}, -1, "two"];
for (const highWaterMark of invalidHwm) {
assertThrows(
@ -42,14 +42,14 @@ unitTest(function streamWriteableHwmError() {
assertThrows(() => {
new WritableStream(
undefined,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") as any }),
);
}, TypeError);
});
unitTest(function streamTransformHwmError() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const invalidHwm: any[] = [NaN, Number("NaN"), {}, -1, "two"];
for (const highWaterMark of invalidHwm) {
assertThrows(
@ -65,7 +65,7 @@ unitTest(function streamTransformHwmError() {
new TransformStream(
undefined,
undefined,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
{ highWaterMark: Symbol("hwmk") as any },
);
}, TypeError);

View file

@ -506,7 +506,7 @@ unitTest(async function transformStreamStartCalledOnce() {
unitTest(function transformStreamReadableTypeThrows() {
assertThrows(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
() => new TransformStream({ readableType: "bytes" as any }),
RangeError,
undefined,
@ -516,7 +516,7 @@ unitTest(function transformStreamReadableTypeThrows() {
unitTest(function transformStreamWirtableTypeThrows() {
assertThrows(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
() => new TransformStream({ writableType: "bytes" as any }),
RangeError,
undefined,

View file

@ -189,7 +189,7 @@ export function unitTest(
export interface ResolvableMethods<T> {
resolve: (value?: T | PromiseLike<T>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
reject: (reason?: any) => void;
}
@ -208,7 +208,7 @@ export function createResolvable<T>(): Resolvable<T> {
const encoder = new TextEncoder();
// Replace functions with null, errors with their stack strings, and JSONify.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function serializeTestMessage(message: any): string {
return JSON.stringify({
start: message.start && {
@ -225,7 +225,7 @@ function serializeTestMessage(message: any): string {
},
end: message.end && {
...message.end,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
results: message.end.results.map((result: any) => ({
...result,
error: result.error?.stack,
@ -236,7 +236,7 @@ function serializeTestMessage(message: any): string {
export async function reportToConn(
conn: Deno.Conn,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
message: any,
): Promise<void> {
const line = serializeTestMessage(message);

View file

@ -15,15 +15,15 @@ import {
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
const internalObj = Deno[Deno.internal];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const reportToConsole = internalObj.reportToConsole as (message: any) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const runTests = internalObj.runTests as (options: any) => Promise<any>;
interface PermissionSetTestResult {
perms: Permissions;
passed: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
endMessage: any;
permsStr: string;
}
@ -135,12 +135,12 @@ async function runTestsForPermissionSet(
const conn = await listener.accept();
let expectedPassedTests;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
let endMessage: any;
try {
for await (const line of readLines(conn)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const message = JSON.parse(line) as any;
reportToConsole(message);
if (message.start != null) {

View file

@ -102,7 +102,7 @@ unitTest(function urlSearchParamsInitRecord(): void {
unitTest(function urlSearchParamsInit(): void {
const params1 = new URLSearchParams("a=b");
assertEquals(params1.toString(), "a=b");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const params2 = new URLSearchParams(params1 as any);
assertEquals(params2.toString(), "a=b");
});
@ -257,7 +257,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void {
const searchParams = new URLSearchParams();
let hasThrown = 0;
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(searchParams as any)[method]();
hasThrown = 1;
} catch (err) {
@ -274,7 +274,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void {
const searchParams = new URLSearchParams();
let hasThrown = 0;
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(searchParams as any)[method]("foo");
hasThrown = 1;
} catch (err) {
@ -315,7 +315,7 @@ unitTest(function urlSearchParamsCustomSymbolIterator(): void {
unitTest(
function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void {
const params = {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(params as any)[Symbol.iterator] = function* (): IterableIterator<
[number, number]
> {

View file

@ -7,7 +7,7 @@ const cmdsPerWorker = 400;
export interface ResolvableMethods<T> {
resolve: (value?: T | PromiseLike<T>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
reject: (reason?: any) => void;
}

View file

@ -11,7 +11,7 @@ import { assert, assertEquals } from "../../std/testing/asserts.ts";
export interface ResolvableMethods<T> {
resolve: (value?: T | PromiseLike<T>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
reject: (reason?: any) => void;
}
@ -93,7 +93,7 @@ Deno.test({
{ type: "module" },
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
throwingWorker.onerror = (e: any): void => {
e.preventDefault();
assert(/Uncaught Error: Thrown error/.test(e.message));
@ -133,7 +133,7 @@ Deno.test({
{ type: "module" },
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
fetchingWorker.onerror = (e: any): void => {
e.preventDefault();
promise.reject(e.message);

View file

@ -1,5 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-undef
// This module is the entry point for "compiler" isolate, ie. the one
// that is created when Deno needs to type check TypeScript, and in some
// instances convert TypeScript to JavaScript.
@ -234,7 +236,7 @@ delete Object.prototype.__proto__;
specifiers,
base,
});
let r = resolved.map(([resolvedFileName, extension]) => ({
const r = resolved.map(([resolvedFileName, extension]) => ({
resolvedFileName,
extension,
isExternalLibraryImport: false,
@ -357,7 +359,7 @@ delete Object.prototype.__proto__;
/** @type {{ buildSpecifier: string; libs: string[] }} */
const { buildSpecifier, libs } = core.jsonOpSync("op_build_info", {});
for (const lib of libs) {
let specifier = `lib.${lib}.d.ts`;
const specifier = `lib.${lib}.d.ts`;
// we are using internal APIs here to "inject" our custom libraries into
// tsc, so things like `"lib": [ "deno.ns" ]` are supported.
if (!ts.libs.includes(lib)) {

View file

@ -16,8 +16,6 @@ SharedQueue Binary Layout
+---------------------------------------------------------------+
*/
/* eslint-disable @typescript-eslint/no-use-before-define */
((window) => {
const MAX_RECORDS = 100;
const INDEX_NUM_RECORDS = 0;

View file

@ -1,4 +1,9 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
function assert(cond) {
if (!cond) {
throw Error("assert");
}
}
function assertArrayEquals(a1, a2) {
if (a1.length !== a2.length) throw Error("assert");

View file

@ -295,7 +295,7 @@ let x: any;
Should rather be:
```typescript
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
let x: any;
```

View file

@ -154,7 +154,7 @@ it's required to specify the ignored rule name:
// eslint-disable-next-line no-empty
while (true) {}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function bar(a: any) {
// ...
}

View file

@ -7,10 +7,23 @@
// comments which point to steps of the specification that are not implemented.
((window) => {
/* eslint-disable @typescript-eslint/no-explicit-any,require-await */
const customInspect = Symbol.for("Deno.customInspect");
function cloneArrayBuffer(
srcBuffer,
srcByteOffset,
srcLength,
_cloneConstructor,
) {
// this function fudges the return type but SharedArrayBuffer is disabled for a while anyway
return srcBuffer.slice(
srcByteOffset,
srcByteOffset + srcLength,
);
}
const objectCloneMemo = new WeakMap();
/** Clone a value in a similar way to structured cloning. It is similar to a
* StructureDeserialize(StructuredSerialize(...)). */
function cloneValue(value) {
@ -88,6 +101,7 @@
}
case "symbol":
case "function":
// fallthrough
default:
throw new DOMException("Uncloneable value in stream", "DataCloneError");
}
@ -2151,10 +2165,10 @@
let canceled2 = false;
let reason1 = undefined;
let reason2 = undefined;
/* eslint-disable prefer-const */
// deno-lint-ignore prefer-const
let branch1;
// deno-lint-ignore prefer-const
let branch2;
/* eslint-enable prefer-const */
const cancelPromise = getDeferred();
const pullAlgorithm = () => {
if (reading) {
@ -3365,7 +3379,6 @@
}
stream[sym.backpressure] = backpressure;
}
/* eslint-enable */
class CountQueuingStrategy {
constructor({ highWaterMark }) {

View file

@ -166,6 +166,7 @@
if (typeof str !== "string") {
return false;
}
// deno-lint-ignore no-control-regex
return /^[\x00-\x7F]*$/.test(str);
}
@ -1349,7 +1350,8 @@
});
return new Response(null, responseInit);
case "follow":
default:
// fallthrough
default: {
let redirectUrl = response.headers.get("Location");
if (redirectUrl == null) {
return response; // Unspecified
@ -1364,6 +1366,7 @@
redirected = true;
remRedirectCount--;
}
}
} else {
return response;
}

View file

@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, no-var */
// deno-lint-ignore-file no-explicit-any
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
@ -101,7 +101,7 @@ interface QueuingStrategy<T = any> {
size?: QueuingStrategySizeCallback<T>;
}
/** This Streams API interface provides a built-in byte length queuing strategy
/** This Streams API interface provides a built-in byte length queuing strategy
* that can be used when constructing streams. */
declare class CountQueuingStrategy implements QueuingStrategy {
constructor(options: { highWaterMark: number });
@ -182,7 +182,7 @@ interface UnderlyingSink<W = any> {
write?: WritableStreamDefaultControllerWriteCallback<W>;
}
/** This Streams API interface provides a standard abstraction for writing
/** This Streams API interface provides a standard abstraction for writing
* streaming data to a destination, known as a sink. This object comes with
* built-in backpressure and queuing. */
declare class WritableStream<W = any> {
@ -351,8 +351,8 @@ type HeadersInit = Headers | string[][] | Record<string, string>;
/** This Fetch API interface allows you to perform various actions on HTTP
* request and response headers. These actions include retrieving, setting,
* adding to, and removing. A Headers object has an associated header list,
* which is initially empty and consists of zero or more name and value pairs.
*  You can add to this using methods like append() (see Examples.) In all
* which is initially empty and consists of zero or more name and value pairs.
* You can add to this using methods like append() (see Examples). In all
* methods of this interface, header names are matched by case-insensitive byte
* sequence. */
interface Headers {

View file

@ -8,6 +8,7 @@
if (key !== illegalConstructorKey) {
throw new TypeError("Illegal constructor.");
}
super();
}
get [Symbol.toStringTag]() {
@ -20,6 +21,7 @@
if (key != illegalConstructorKey) {
throw new TypeError("Illegal constructor.");
}
super();
}
get [Symbol.toStringTag]() {
@ -32,6 +34,7 @@
if (key != illegalConstructorKey) {
throw new TypeError("Illegal constructor.");
}
super();
}
get [Symbol.toStringTag]() {

View file

@ -593,7 +593,9 @@
try {
const isSpecial = specialSchemes.includes(parts.get(this).protocol);
parts.get(this).hostname = encodeHostname(value, isSpecial);
} catch {}
} catch {
// pass
}
}
get href() {

View file

@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, no-var */
// deno-lint-ignore-file no-explicit-any
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -14,11 +14,11 @@ export function deepAssign<T, U, V, W>(
source3: W,
): T & U & V & W;
export function deepAssign(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
target: Record<string, any>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
...sources: any[]
): // eslint-disable-next-line @typescript-eslint/ban-types
): // deno-lint-ignore ban-types
object | undefined {
for (let i = 0; i < sources.length; i++) {
const source = sources[i];

View file

@ -297,7 +297,7 @@ export interface TarMeta extends TarInfo {
fileSize?: number;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// deno-lint-ignore no-empty-interface
interface TarEntry extends TarMeta {}
/**

View file

@ -6,7 +6,7 @@
// At the time of writing, the github issue is closed but the problem remains.
export interface Deferred<T> extends Promise<T> {
resolve: (value?: T | PromiseLike<T>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
reject: (reason?: any) => void;
}

View file

@ -14,7 +14,7 @@ interface TaggedYieldedValue<T> {
export class MuxAsyncIterator<T> implements AsyncIterable<T> {
private iteratorCount = 0;
private yields: Array<TaggedYieldedValue<T>> = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
private throws: any[] = [];
private signal: Deferred<void> = deferred();

View file

@ -310,9 +310,10 @@ export class DateTimeFormatter {
string += digits(value, Number(token.value));
break;
}
// FIXME(bartlomieju)
case "timeZoneName": {
// string += utc ? "Z" : token.value
// break
break;
}
case "dayPeriod": {
string += token.value ? (date.getHours() >= 12 ? "PM" : "AM") : "";

View file

@ -64,11 +64,11 @@ Deno.test({
name: "[std/datetime] invalidParseDateTimeFormatThrows",
fn: () => {
assertThrows((): void => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(datetime as any).parse("2019-01-01 00:00", "x-y-z");
}, Error);
assertThrows((): void => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(datetime as any).parse("2019-01-01", "x-y-z");
}, Error);
},

View file

@ -3,8 +3,6 @@
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable max-len */
import { YAMLError } from "../error.ts";
import type { RepresentFn, StyleVariant, Type } from "../type.ts";
import * as common from "../utils.ts";

View file

@ -1,5 +1,4 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { parse } from "../../yaml.ts";
@ -7,7 +6,7 @@ import { parse } from "../../yaml.ts";
const yml = Deno.readFileSync(`${Deno.cwd()}/example/sample_document.yml`);
const document = new TextDecoder().decode(yml);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const obj = parse(document) as Record<string, any>;
console.log(obj);

View file

@ -3,8 +3,6 @@
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable max-len */
import { YAMLError } from "../error.ts";
import { Mark } from "../mark.ts";
import type { Type } from "../type.ts";
@ -31,7 +29,6 @@ const PATTERN_NON_PRINTABLE =
const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
const PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
const PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
/* eslint-disable-next-line max-len */
const PATTERN_TAG_URI =
/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;

View file

@ -22,7 +22,7 @@ export interface LoaderStateOptions {
onWarning?(this: null, e?: YAMLError): void;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
export type ResultType = any[] | Record<string, any> | string;
export class LoaderState extends State {

View file

@ -3,7 +3,7 @@
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
export type Any = any;
export function isNothing(subject: unknown): subject is never {

View file

@ -452,7 +452,7 @@ class Parser {
}
obj[k] = v;
if (v instanceof Object) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
this._propertyClean(v as any);
}
}
@ -486,7 +486,7 @@ class Dumper {
this.srcObject = srcObjc;
}
dump(): string[] {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
this.output = this._parse(this.srcObject as any);
this.output = this._format();
return this.output;

View file

@ -6,13 +6,12 @@
// Install using `deno install`
// $ deno install --allow-read https://deno.land/std/examples/catj.ts
/* eslint-disable @typescript-eslint/no-use-before-define */
import { parse } from "../flags/mod.ts";
import * as colors from "../fmt/colors.ts";
const decoder = new TextDecoder();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function isObject(arg: any): arg is Record<string, unknown> {
return !!arg && arg.constructor === Object;
}
@ -72,7 +71,7 @@ function printArray(array: unknown[], path: string): void {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function print(data: any[] | Record<string, unknown>): void {
if (Array.isArray(data)) {
printArray(data, "");

View file

@ -2,12 +2,10 @@
import { parse } from "../flags/mod.ts";
import { readStringDelim } from "../io/bufio.ts";
/* eslint-disable-next-line max-len */
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction.
const AsyncFunction = Object.getPrototypeOf(async function (): Promise<void> {})
.constructor;
/* eslint-disable max-len */
const HELP_MSG = `xeval
Run a script for each new-line or otherwise delimited chunk of standard input.
@ -28,7 +26,6 @@ OPTIONS:
-I, --replvar <replvar> Set variable name to be used in eval, defaults to $
ARGS:
<code>`;
/* eslint-enable max-len */
export type XevalFunc = (v: string) => void;

View file

@ -6,7 +6,7 @@ export interface Args {
/** Contains all the arguments that didn't have an option associated with
* them. */
_: Array<string | number>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
[key: string]: any;
}

View file

@ -278,7 +278,7 @@ class Printf {
}
handleLessThan(): string {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const arg = this.args[this.argNum] as any;
if ((arg || {}).constructor.name !== "Array") {
throw new Error(`arg ${arg} is not an array. Todo better error handling`);
@ -315,7 +315,7 @@ class Printf {
this.state = State.PASSTHROUGH;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
_handleVerb(arg: any): string {
switch (this.verb) {
case "t":

View file

@ -230,7 +230,7 @@ Deno.test("testZero", function (): void {
});
// relevant test cases from fmt_test.go
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const tests: Array<[string, any, string]> = [
["%d", 12345, "12345"],
["%v", 12345, "12345"],

View file

@ -32,7 +32,7 @@ async function encodeWasm(wasmPath: string): Promise<string> {
async function generate(wasm: string, output: string): Promise<void> {
const initScript = await Deno.readTextFile(`${output}/deno_hash.js`);
const denoHashScript =
"/* eslint-disable */\n" +
"// deno-lint-ignore-file\n" +
"//deno-fmt-ignore-file\n" +
"//deno-lint-ignore-file\n" +
`import * as base64 from "../../encoding/base64.ts";` +

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,7 @@ import { getLevelByName, getLevelName, LogLevels } from "./levels.ts";
import type { LevelName } from "./levels.ts";
import type { BaseHandler } from "./handlers.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
export type GenericFunction = (...args: any[]) => any;
export interface LogRecordOptions {

View file

@ -26,7 +26,7 @@ export interface FormFile {
}
/** Type guard for FormFile */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
export function isFormFile(x: any): x is FormFile {
return hasOwnProperty(x, "filename") && hasOwnProperty(x, "type");
}

View file

@ -145,7 +145,7 @@ Deno.test("multipartMultipartWriter3", async function (): Promise<void> {
);
await assertThrowsAsync(
async (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
await mw.writeFile("bar", "file", null as any);
},
Error,

View file

@ -49,7 +49,7 @@ export function getEncoding(
optOrCallback?:
| FileOptions
| WriteFileOptions
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
| ((...args: any[]) => any)
| Encodings
| null,

View file

@ -18,7 +18,7 @@ export default class Dir {
return this.dirPath;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
read(callback?: (...args: any[]) => void): Promise<Dirent | null> {
return new Promise((resolve, reject) => {
if (!this.asyncIterator) {
@ -57,7 +57,7 @@ export default class Dir {
* directories, and therefore does not need to close directories when
* finished reading.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
close(callback?: (...args: any[]) => void): Promise<void> {
return new Promise((resolve, reject) => {
try {

View file

@ -7,7 +7,7 @@ Deno.test({
name: "Closing current directory with callback is successful",
fn() {
let calledBack = false;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
new Dir(".").close((valOrErr: any) => {
assert(!valOrErr);
calledBack = true;
@ -51,7 +51,7 @@ Deno.test({
let calledBack = false;
const fileFromCallback: Dirent | null = await new Dir(
testDir,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
).read((err: any, res: Dirent) => {
assert(res === null);
assert(err === null);
@ -81,7 +81,7 @@ Deno.test({
const dir: Dir = new Dir(testDir);
const firstRead: Dirent | null = await dir.read();
const secondRead: Dirent | null = await dir.read(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(err: any, secondResult: Dirent) => {
assert(
secondResult.name === "bar.txt" ||

View file

@ -84,7 +84,7 @@ function callbackify<Arg1T, Arg2T, Arg3T, Arg4T, Arg5T, ResultT>(
callback: Callback<ResultT>,
) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function callbackify(original: any): any {
if (typeof original !== "function") {
throw new NodeInvalidArgTypeError('"original"');

View file

@ -105,10 +105,10 @@ Deno.test(
});
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const thenableFn = (): PromiseLike<any> => {
return {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
then(onfulfilled): PromiseLike<any> {
assert(onfulfilled);
onfulfilled(value);
@ -150,11 +150,11 @@ Deno.test(
if ("reason" in err) {
assert(!value);
assertStrictEquals(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(err as any).code,
"ERR_FALSY_VALUE_REJECTION",
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assertStrictEquals((err as any).reason, value);
} else {
assertStrictEquals(String(value).endsWith(err.message), true);
@ -186,11 +186,11 @@ Deno.test(
if ("reason" in err) {
assert(!value);
assertStrictEquals(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(err as any).code,
"ERR_FALSY_VALUE_REJECTION",
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assertStrictEquals((err as any).reason, value);
} else {
assertStrictEquals(String(value).endsWith(err.message), true);
@ -220,11 +220,11 @@ Deno.test(
if ("reason" in err) {
assert(!value);
assertStrictEquals(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(err as any).code,
"ERR_FALSY_VALUE_REJECTION",
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assertStrictEquals((err as any).reason, value);
} else {
assertStrictEquals(String(value).endsWith(err.message), true);
@ -341,12 +341,12 @@ Deno.test("callbackify preserves the `this` binding", async () => {
Deno.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
// deno-lint-ignore 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
// deno-lint-ignore no-explicit-any
assertStrictEquals((err as any).code, "ERR_INVALID_ARG_TYPE");
assertStrictEquals(err.name, "TypeError");
assertStrictEquals(
@ -365,7 +365,7 @@ Deno.test(
return 42;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const cb = callbackify(asyncFn) as any;
const args: unknown[] = [];
@ -377,7 +377,7 @@ Deno.test(
throw Error("We should never reach this error");
} catch (err) {
assert(err instanceof TypeError);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
assertStrictEquals((err as any).code, "ERR_INVALID_ARG_TYPE");
assertStrictEquals(err.name, "TypeError");
assertStrictEquals(

View file

@ -57,16 +57,16 @@ class NodeInvalidArgTypeError extends TypeError {
}
export function promisify(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
original: (...args: any[]) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
): (...args: any[]) => Promise<any> {
if (typeof original !== "function") {
throw new NodeInvalidArgTypeError("original", "Function", original);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
if ((original as any)[kCustomPromisifiedSymbol]) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const fn = (original as any)[kCustomPromisifiedSymbol];
if (typeof fn !== "function") {
throw new NodeInvalidArgTypeError(
@ -85,9 +85,9 @@ export function promisify(
// Names to create an object from in case the callback receives multiple
// arguments, e.g. ['bytesRead', 'buffer'] for fs.read.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
const argumentNames = (original as any)[kCustomPromisifyArgsSymbol];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
function fn(this: any, ...args: unknown[]): Promise<unknown> {
return new Promise((resolve, reject) => {
original.call(this, ...args, (err: Error, ...values: unknown[]) => {
@ -97,7 +97,7 @@ export function promisify(
if (argumentNames !== undefined && values.length > 1) {
const obj = {};
for (let i = 0; i < argumentNames.length; i++) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
(obj as any)[argumentNames[i]] = values[i];
}
resolve(obj);

View file

@ -29,7 +29,7 @@ import {
import { promisify } from "./_util_promisify.ts";
import * as fs from "../fs.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore no-explicit-any
type VoidFunction = (...args: any[]) => void;
const readFile = promisify(fs.readFile);

View file

@ -18,10 +18,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
// deno-lint-ignore 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
// deno-lint-ignore no-explicit-any
...args: any[]
): void {
func(...args)
@ -30,11 +30,11 @@ export function intoCallbackAPI<T>(
}
export function intoCallbackAPIWithIntercept<T1, T2>(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// deno-lint-ignore 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
// deno-lint-ignore no-explicit-any
...args: any[]
): void {
func(...args)

Some files were not shown because too many files have changed in this diff Show more