build: lint cli/tests/unit using deno lint (#6327)

This commit is contained in:
Alan Gou 2020-06-19 02:05:37 -07:00 committed by GitHub
parent 36ad5e4402
commit ffedbd79ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 19 deletions

View file

@ -47,7 +47,9 @@ unitTest(function webAssemblyExists(): void {
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
declare global {
// deno-lint-ignore no-namespace
namespace Deno {
// deno-lint-ignore no-explicit-any
var core: any;
}
}
@ -58,37 +60,51 @@ unitTest(function DenoNamespaceImmutable(): void {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(Deno as any) = 1;
} catch {}
} catch {
// pass
}
assert(denoCopy === Deno);
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).Deno = 1;
} catch {}
} catch {
// pass
}
assert(denoCopy === Deno);
try {
delete window.Deno;
} catch {}
} catch {
// pass
}
assert(denoCopy === Deno);
const { readFile } = Deno;
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(Deno as any).readFile = 1;
} catch {}
} catch {
// pass
}
assert(readFile === Deno.readFile);
try {
delete window.Deno.readFile;
} catch {}
} catch {
// pass
}
assert(readFile === Deno.readFile);
const { print } = Deno.core;
try {
Deno.core.print = 1;
} catch {}
} catch {
// pass
}
assert(print === Deno.core.print);
try {
delete Deno.core.print;
} catch {}
} catch {
// pass
}
assert(print === Deno.core.print);
});