Update @typescript-eslint/* to v2.1.0 (#2878)

This commit is contained in:
Yoshiya Hinosawa 2019-09-08 01:27:18 +09:00 committed by Ryan Dahl
parent a205e8a3c2
commit f12acdb50b
31 changed files with 100 additions and 83 deletions

View File

@ -2,7 +2,8 @@
"root": true, "root": true,
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"project": "./tsconfig.json" "project": "./tsconfig.json",
"createDefaultProgram": true
}, },
"plugins": ["@typescript-eslint"], "plugins": ["@typescript-eslint"],
"extends": [ "extends": [
@ -11,7 +12,10 @@
"prettier/@typescript-eslint" "prettier/@typescript-eslint"
], ],
"rules": { "rules": {
"@typescript-eslint/array-type": ["error", "array-simple"], "@typescript-eslint/array-type": [
"error",
{ "default": "array-simple" }
],
"@typescript-eslint/explicit-member-accessibility": ["off"], "@typescript-eslint/explicit-member-accessibility": ["off"],
"@typescript-eslint/no-non-null-assertion": ["off"], "@typescript-eslint/no-non-null-assertion": ["off"],
"@typescript-eslint/no-use-before-define": ["off"], "@typescript-eslint/no-use-before-define": ["off"],
@ -19,6 +23,17 @@
"@typescript-eslint/no-unused-vars": [ "@typescript-eslint/no-unused-vars": [
"error", "error",
{ "argsIgnorePattern": "^_" } { "argsIgnorePattern": "^_" }
] ],
} "@typescript-eslint/ban-ts-ignore": ["off"],
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/explicit-function-return-type": ["off"]
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/explicit-function-return-type": ["error"]
}
}
]
} }

View File

@ -3,6 +3,7 @@
// A simple runtime that doesn't involve typescript or protobufs to test // A simple runtime that doesn't involve typescript or protobufs to test
// libdeno. Invoked by libdeno_test.cc // libdeno. Invoked by libdeno_test.cc
// eslint-disable-next-line @typescript-eslint/no-this-alias
const global = this; const global = this;
function assert(cond) { function assert(cond) {

View File

@ -48,7 +48,7 @@ SharedQueue Binary Layout
} }
function init() { function init() {
let shared = Deno.core.shared; const shared = Deno.core.shared;
assert(shared.byteLength > 0); assert(shared.byteLength > 0);
assert(sharedBytes == null); assert(sharedBytes == null);
assert(shared32 == null); assert(shared32 == null);
@ -113,9 +113,9 @@ SharedQueue Binary Layout
} }
function push(opId, buf) { function push(opId, buf) {
let off = head(); const off = head();
let end = off + buf.byteLength; const end = off + buf.byteLength;
let index = numRecords(); const index = numRecords();
if (end > shared32.byteLength || index >= MAX_RECORDS) { if (end > shared32.byteLength || index >= MAX_RECORDS) {
// console.log("shared_queue.js push fail"); // console.log("shared_queue.js push fail");
return false; return false;
@ -130,7 +130,7 @@ SharedQueue Binary Layout
/// Returns null if empty. /// Returns null if empty.
function shift() { function shift() {
let i = shared32[INDEX_NUM_SHIFTED_OFF]; const i = shared32[INDEX_NUM_SHIFTED_OFF];
if (size() == 0) { if (size() == 0) {
assert(i == 0); assert(i == 0);
return null; return null;
@ -164,7 +164,7 @@ SharedQueue Binary Layout
asyncHandler(opId, buf); asyncHandler(opId, buf);
} else { } else {
while (true) { while (true) {
let opIdBuf = shift(); const opIdBuf = shift();
if (opIdBuf == null) { if (opIdBuf == null) {
break; break;
} }

View File

@ -25,11 +25,11 @@ function fullRecords(q) {
function main() { function main() {
const q = Deno.core.sharedQueue; const q = Deno.core.sharedQueue;
let h = q.head(); const h = q.head();
assert(h > 0); assert(h > 0);
let r = new Uint8Array([1, 2, 3, 4, 5]); let r = new Uint8Array([1, 2, 3, 4, 5]);
let len = r.byteLength + h; const len = r.byteLength + h;
assert(q.push(99, r)); assert(q.push(99, r));
assert(q.head() == len); assert(q.head() == len);

View File

@ -5,7 +5,7 @@ const lookup: string[] = [];
const revLookup: number[] = []; const revLookup: number[] = [];
const code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (var i = 0, len = code.length; i < len; ++i) { for (let i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i]; lookup[i] = code[i];
revLookup[code.charCodeAt(i)] = i; revLookup[code.charCodeAt(i)] = i;
} }
@ -16,7 +16,7 @@ revLookup["-".charCodeAt(0)] = 62;
revLookup["_".charCodeAt(0)] = 63; revLookup["_".charCodeAt(0)] = 63;
function getLens(b64: string): [number, number] { function getLens(b64: string): [number, number] {
var len = b64.length; const len = b64.length;
if (len % 4 > 0) { if (len % 4 > 0) {
throw new Error("Invalid string. Length must be a multiple of 4"); throw new Error("Invalid string. Length must be a multiple of 4");
@ -24,19 +24,19 @@ function getLens(b64: string): [number, number] {
// Trim off extra bytes after placeholder bytes are found // Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42 // See: https://github.com/beatgammit/base64-js/issues/42
var validLen = b64.indexOf("="); let validLen = b64.indexOf("=");
if (validLen === -1) validLen = len; if (validLen === -1) validLen = len;
var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4); const placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4);
return [validLen, placeHoldersLen]; return [validLen, placeHoldersLen];
} }
// base64 is 4/3 + up to two characters of the original data // base64 is 4/3 + up to two characters of the original data
export function byteLength(b64: string): number { export function byteLength(b64: string): number {
var lens = getLens(b64); const lens = getLens(b64);
var validLen = lens[0]; const validLen = lens[0];
var placeHoldersLen = lens[1]; const placeHoldersLen = lens[1];
return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen; return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen;
} }
@ -49,19 +49,20 @@ function _byteLength(
} }
export function toByteArray(b64: string): Uint8Array { export function toByteArray(b64: string): Uint8Array {
var tmp; let tmp;
var lens = getLens(b64); const lens = getLens(b64);
var validLen = lens[0]; const validLen = lens[0];
var placeHoldersLen = lens[1]; const placeHoldersLen = lens[1];
var arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen)); const arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen));
var curByte = 0; let curByte = 0;
// if there are placeholders, only get up to the last complete 4 chars // if there are placeholders, only get up to the last complete 4 chars
var len = placeHoldersLen > 0 ? validLen - 4 : validLen; const len = placeHoldersLen > 0 ? validLen - 4 : validLen;
for (var i = 0; i < len; i += 4) { let i;
for (i = 0; i < len; i += 4) {
tmp = tmp =
(revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 1)] << 12) |
@ -101,9 +102,9 @@ function tripletToBase64(num: number): string {
} }
function encodeChunk(uint8: Uint8Array, start: number, end: number): string { function encodeChunk(uint8: Uint8Array, start: number, end: number): string {
var tmp; let tmp;
var output = []; const output = [];
for (var i = start; i < end; i += 3) { for (let i = start; i < end; i += 3) {
tmp = tmp =
((uint8[i] << 16) & 0xff0000) + ((uint8[i] << 16) & 0xff0000) +
((uint8[i + 1] << 8) & 0xff00) + ((uint8[i + 1] << 8) & 0xff00) +
@ -114,14 +115,14 @@ function encodeChunk(uint8: Uint8Array, start: number, end: number): string {
} }
export function fromByteArray(uint8: Uint8Array): string { export function fromByteArray(uint8: Uint8Array): string {
var tmp; let tmp;
var len = uint8.length; const len = uint8.length;
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes const extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
var parts = []; const parts = [];
var maxChunkLength = 16383; // must be multiple of 3 const maxChunkLength = 16383; // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later // go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { for (let i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push( parts.push(
encodeChunk( encodeChunk(
uint8, uint8,

View File

@ -7,7 +7,7 @@ import { build } from "./build.ts";
export const bytesSymbol = Symbol("bytes"); export const bytesSymbol = Symbol("bytes");
function convertLineEndingsToNative(s: string): string { function convertLineEndingsToNative(s: string): string {
let nativeLineEnd = build.os == "win" ? "\r\n" : "\n"; const nativeLineEnd = build.os == "win" ? "\r\n" : "\n";
let position = 0; let position = 0;
@ -19,7 +19,7 @@ function convertLineEndingsToNative(s: string): string {
let result = token; let result = token;
while (position < s.length) { while (position < s.length) {
let c = s.charAt(position); const c = s.charAt(position);
if (c == "\r") { if (c == "\r") {
result += nativeLineEnd; result += nativeLineEnd;
position++; position++;

View File

@ -54,7 +54,7 @@ test(function nativeEndLine(): void {
const options: object = { const options: object = {
ending: "native" ending: "native"
}; };
let blob = new Blob(["Hello\nWorld"], options); const blob = new Blob(["Hello\nWorld"], options);
assertEquals(blob.size, Deno.build.os === "win" ? 12 : 11); assertEquals(blob.size, Deno.build.os === "win" ? 12 : 11);
}); });

View File

@ -45,7 +45,7 @@ async function fillBytes(
): Promise<string> { ): Promise<string> {
check(buf, s); check(buf, s);
for (; n > 0; n--) { for (; n > 0; n--) {
let m = await buf.write(fub); const m = await buf.write(fub);
assertEquals(m, fub.byteLength); assertEquals(m, fub.byteLength);
const decoder = new TextDecoder(); const decoder = new TextDecoder();
s += decoder.decode(fub); s += decoder.decode(fub);
@ -84,7 +84,7 @@ test(function bufferNewBuffer(): void {
test(async function bufferBasicOperations(): Promise<void> { test(async function bufferBasicOperations(): Promise<void> {
init(); init();
let buf = new Buffer(); const buf = new Buffer();
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
check(buf, ""); check(buf, "");
@ -123,9 +123,9 @@ test(async function bufferBasicOperations(): Promise<void> {
test(async function bufferReadEmptyAtEOF(): Promise<void> { test(async function bufferReadEmptyAtEOF(): Promise<void> {
// check that EOF of 'buf' is not reached (even though it's empty) if // check that EOF of 'buf' is not reached (even though it's empty) if
// results are written to buffer that has 0 length (ie. it can't store any data) // results are written to buffer that has 0 length (ie. it can't store any data)
let buf = new Buffer(); const buf = new Buffer();
const zeroLengthTmp = new Uint8Array(0); const zeroLengthTmp = new Uint8Array(0);
let result = await buf.read(zeroLengthTmp); const result = await buf.read(zeroLengthTmp);
assertEquals(result, 0); assertEquals(result, 0);
}); });
@ -211,9 +211,9 @@ test(async function bufferReadFromSync(): Promise<void> {
test(async function bufferTestGrow(): Promise<void> { test(async function bufferTestGrow(): Promise<void> {
const tmp = new Uint8Array(72); const tmp = new Uint8Array(72);
for (let startLen of [0, 100, 1000, 10000, 100000]) { for (const startLen of [0, 100, 1000, 10000, 100000]) {
const xBytes = repeat("x", startLen); const xBytes = repeat("x", startLen);
for (let growLen of [0, 100, 1000, 10000, 100000]) { for (const growLen of [0, 100, 1000, 10000, 100000]) {
const buf = new Buffer(xBytes.buffer as ArrayBuffer); const buf = new Buffer(xBytes.buffer as ArrayBuffer);
// If we read, this affects buf.off, which is good to test. // If we read, this affects buf.off, which is good to test.
const result = await buf.read(tmp); const result = await buf.read(tmp);

View File

@ -11,7 +11,7 @@ interface Code {
regexp: RegExp; regexp: RegExp;
} }
let enabled = !noColor; const enabled = !noColor;
function code(open: number, close: number): Code { function code(open: number, close: number): Code {
return { return {

View File

@ -61,7 +61,7 @@ interface ConfigureResponse {
/** Options that either do nothing in Deno, or would cause undesired behavior /** Options that either do nothing in Deno, or would cause undesired behavior
* if modified. */ * if modified. */
const ignoredCompilerOptions: ReadonlyArray<string> = [ const ignoredCompilerOptions: readonly string[] = [
"allowSyntheticDefaultImports", "allowSyntheticDefaultImports",
"baseUrl", "baseUrl",
"build", "build",
@ -415,7 +415,7 @@ class Host implements ts.CompilerHost {
data: string, data: string,
writeByteOrderMark: boolean, writeByteOrderMark: boolean,
onError?: (message: string) => void, onError?: (message: string) => void,
sourceFiles?: ReadonlyArray<ts.SourceFile> sourceFiles?: readonly ts.SourceFile[]
): void { ): void {
util.log("writeFile", fileName); util.log("writeFile", fileName);
try { try {

View File

@ -490,7 +490,7 @@ const isConsoleInstance = Symbol("isConsoleInstance");
export class Console { export class Console {
indentLevel: number; indentLevel: number;
[isConsoleInstance]: boolean = false; [isConsoleInstance] = false;
/** @internal */ /** @internal */
constructor(private printFunc: PrintFunc) { constructor(private printFunc: PrintFunc) {
@ -501,7 +501,7 @@ export class Console {
// For historical web-compatibility reasons, the namespace object for // For historical web-compatibility reasons, the namespace object for
// console must have as its [[Prototype]] an empty object, created as if // console must have as its [[Prototype]] an empty object, created as if
// by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%. // by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%.
let console = Object.create({}) as Console; const console = Object.create({}) as Console;
Object.assign(console, this); Object.assign(console, this);
return console; return console;
} }

View File

@ -204,7 +204,7 @@ function parseRelatedInformation(
export function fromTypeScriptDiagnostic( export function fromTypeScriptDiagnostic(
diagnostics: readonly ts.Diagnostic[] diagnostics: readonly ts.Diagnostic[]
): Diagnostic { ): Diagnostic {
let items: DiagnosticItem[] = []; const items: DiagnosticItem[] = [];
for (const sourceDiagnostic of diagnostics) { for (const sourceDiagnostic of diagnostics) {
const item: DiagnosticItem = parseDiagnostic(sourceDiagnostic); const item: DiagnosticItem = parseDiagnostic(sourceDiagnostic);
if (sourceDiagnostic.relatedInformation) { if (sourceDiagnostic.relatedInformation) {

View File

@ -50,7 +50,7 @@ export function isShadowInclusiveAncestor(
export function getRoot( export function getRoot(
node: domTypes.EventTarget | null node: domTypes.EventTarget | null
): domTypes.EventTarget | null { ): domTypes.EventTarget | null {
let root = node; const root = node;
// for (const ancestor of domSymbolTree.ancestorsIterator(node)) { // for (const ancestor of domSymbolTree.ancestorsIterator(node)) {
// root = ancestor; // root = ancestor;

View File

@ -115,7 +115,7 @@ export function writeSync(rid: number, p: Uint8Array): number {
* *
*/ */
export async function write(rid: number, p: Uint8Array): Promise<number> { export async function write(rid: number, p: Uint8Array): Promise<number> {
let result = await sendAsyncMinimal(dispatch.OP_WRITE, rid, p); const result = await sendAsyncMinimal(dispatch.OP_WRITE, rid, p);
if (result < 0) { if (result < 0) {
throw new Error("write error"); throw new Error("write error");
} else { } else {

View File

@ -323,7 +323,7 @@ testPerm({ read: true }, async function seekMode(): Promise<void> {
// We should still be able to read the file // We should still be able to read the file
// since it is still open. // since it is still open.
let buf = new Uint8Array(1); const buf = new Uint8Array(1);
await file.read(buf); // "H" await file.read(buf); // "H"
assertEquals(new TextDecoder().decode(buf), "H"); assertEquals(new TextDecoder().decode(buf), "H");
}); });

View File

@ -6,7 +6,7 @@
// TODO(kt3k): EOF should be `unique symbol` type. // TODO(kt3k): EOF should be `unique symbol` type.
// That might require some changes of ts_library_builder. // That might require some changes of ts_library_builder.
// See #2591 for more details. // See #2591 for more details.
export const EOF: null = null; export const EOF = null;
export type EOF = null; export type EOF = null;
// Seek whence values. // Seek whence values.

View File

@ -13,7 +13,7 @@ import { setLocation } from "./location.ts";
import { setBuildInfo } from "./build.ts"; import { setBuildInfo } from "./build.ts";
import { setSignals } from "./process.ts"; import { setSignals } from "./process.ts";
function denoMain(preserveDenoNamespace: boolean = true, name?: string): void { function denoMain(preserveDenoNamespace = true, name?: string): void {
const s = os.start(preserveDenoNamespace, name); const s = os.start(preserveDenoNamespace, name);
setBuildInfo(s.os, s.arch); setBuildInfo(s.os, s.arch);

View File

@ -10,7 +10,7 @@ const knownPermissions: Deno.Permission[] = [
"hrtime" "hrtime"
]; ];
for (let grant of knownPermissions) { for (const grant of knownPermissions) {
testPerm({ [grant]: true }, function envGranted(): void { testPerm({ [grant]: true }, function envGranted(): void {
const perms = Deno.permissions(); const perms = Deno.permissions();
assert(perms !== null); assert(perms !== null);

View File

@ -44,10 +44,10 @@ testPerm({ run: true }, async function runSuccess(): Promise<void> {
testPerm({ run: true }, async function runCommandFailedWithCode(): Promise< testPerm({ run: true }, async function runCommandFailedWithCode(): Promise<
void void
> { > {
let p = run({ const p = run({
args: ["python", "-c", "import sys;sys.exit(41 + 1)"] args: ["python", "-c", "import sys;sys.exit(41 + 1)"]
}); });
let status = await p.status(); const status = await p.status();
assertEquals(status.success, false); assertEquals(status.success, false);
assertEquals(status.code, 42); assertEquals(status.code, 42);
assertEquals(status.signal, undefined); assertEquals(status.signal, undefined);
@ -133,8 +133,8 @@ testPerm({ run: true }, async function runStdinPiped(): Promise<void> {
assert(!p.stdout); assert(!p.stdout);
assert(!p.stderr); assert(!p.stderr);
let msg = new TextEncoder().encode("hello"); const msg = new TextEncoder().encode("hello");
let n = await p.stdin.write(msg); const n = await p.stdin.write(msg);
assertEquals(n, msg.byteLength); assertEquals(n, msg.byteLength);
p.stdin.close(); p.stdin.close();
@ -307,7 +307,7 @@ testPerm({ run: true }, async function runClose(): Promise<void> {
p.close(); p.close();
const data = new Uint8Array(10); const data = new Uint8Array(10);
let r = await p.stderr.read(data); const r = await p.stderr.read(data);
assertEquals(r, Deno.EOF); assertEquals(r, Deno.EOF);
}); });

View File

@ -138,7 +138,7 @@ export class Request extends body.Body implements domTypes.Request {
headersList.push(header); headersList.push(header);
} }
let body2 = this._bodySource; const body2 = this._bodySource;
const cloned = new Request(this.url, { const cloned = new Request(this.url, {
body: body2, body: body2,

View File

@ -481,7 +481,7 @@ export class TextEncoder {
break; break;
} }
if (Array.isArray(result)) { if (Array.isArray(result)) {
output.push.apply(output, result); output.push(...result);
} else { } else {
output.push(result); output.push(result);
} }

View File

@ -24,8 +24,8 @@ test(function atobWithAsciiWhitespace(): void {
d29ybGQ=` d29ybGQ=`
]; ];
for (let encoded of encodedList) { for (const encoded of encodedList) {
let decoded = atob(encoded); const decoded = atob(encoded);
assertEquals(decoded, "hello world"); assertEquals(decoded, "hello world");
} }
}); });

View File

@ -48,7 +48,7 @@ async function setGlobalTimeout(due: number, now: number): Promise<void> {
// Since JS and Rust don't use the same clock, pass the time to rust as a // Since JS and Rust don't use the same clock, pass the time to rust as a
// relative time value. On the Rust side we'll turn that into an absolute // relative time value. On the Rust side we'll turn that into an absolute
// value again. // value again.
let timeout = due - now; const timeout = due - now;
assert(timeout >= 0); assert(timeout >= 0);
// Send message to the backend. // Send message to the backend.
@ -229,7 +229,7 @@ function setTimer(
/** Sets a timer which executes a function once after the timer expires. */ /** Sets a timer which executes a function once after the timer expires. */
export function setTimeout( export function setTimeout(
cb: (...args: Args) => void, cb: (...args: Args) => void,
delay: number = 0, delay = 0,
...args: Args ...args: Args
): number { ): number {
checkBigInt(delay); checkBigInt(delay);
@ -241,7 +241,7 @@ export function setTimeout(
/** Repeatedly calls a function , with a fixed time delay between each call. */ /** Repeatedly calls a function , with a fixed time delay between each call. */
export function setInterval( export function setInterval(
cb: (...args: Args) => void, cb: (...args: Args) => void,
delay: number = 0, delay = 0,
...args: Args ...args: Args
): number { ): number {
checkBigInt(delay); checkBigInt(delay);
@ -263,7 +263,7 @@ function clearTimer(id: number): void {
idMap.delete(timer.id); idMap.delete(timer.id);
} }
export function clearTimeout(id: number = 0): void { export function clearTimeout(id = 0): void {
checkBigInt(id); checkBigInt(id);
if (id === 0) { if (id === 0) {
return; return;
@ -271,7 +271,7 @@ export function clearTimeout(id: number = 0): void {
clearTimer(id); clearTimer(id);
} }
export function clearInterval(id: number = 0): void { export function clearInterval(id = 0): void {
checkBigInt(id); checkBigInt(id);
if (id === 0) { if (id === 0) {
return; return;

View File

@ -55,7 +55,7 @@ async function hostGetMessage(rid: number): Promise<any> {
} }
// Stuff for workers // Stuff for workers
export let onmessage: (e: { data: any }) => void = (): void => {}; export const onmessage: (e: { data: any }) => void = (): void => {};
export function postMessage(data: any): void { export function postMessage(data: any): void {
const dataIntArray = encodeMessage(data); const dataIntArray = encodeMessage(data);
@ -122,7 +122,7 @@ export interface DenoWorkerOptions extends WorkerOptions {
export class WorkerImpl implements Worker { export class WorkerImpl implements Worker {
private readonly rid: number; private readonly rid: number;
private isClosing: boolean = false; private isClosing = false;
private readonly isClosedPromise: Promise<void>; private readonly isClosedPromise: Promise<void>;
public onerror?: () => void; public onerror?: () => void;
public onmessage?: (data: any) => void; public onmessage?: (data: any) => void;

View File

@ -48,7 +48,7 @@ async function* chunks(
let inspectIndex = 0; let inspectIndex = 0;
let matchIndex = 0; let matchIndex = 0;
while (true) { while (true) {
let result = await reader.read(inspectArr); const result = await reader.read(inspectArr);
if (result === EOF) { if (result === EOF) {
// Yield last chunk. // Yield last chunk.
const lastChunk = inputBuffer.toString(); const lastChunk = inputBuffer.toString();
@ -59,7 +59,7 @@ async function* chunks(
// Discard all remaining and silently fail. // Discard all remaining and silently fail.
return; return;
} }
let sliceRead = inspectArr.subarray(0, result as number); const sliceRead = inspectArr.subarray(0, result as number);
await writeAll(inputBuffer, sliceRead); await writeAll(inputBuffer, sliceRead);
let sliceToProcess = inputBuffer.bytes(); let sliceToProcess = inputBuffer.bytes();

View File

@ -2,8 +2,8 @@
"name": "deno", "name": "deno",
"devDependencies": { "devDependencies": {
"@types/prettier": "1.16.1", "@types/prettier": "1.16.1",
"@typescript-eslint/eslint-plugin": "1.6.0", "@typescript-eslint/eslint-plugin": "2.1.0",
"@typescript-eslint/parser": "1.6.0", "@typescript-eslint/parser": "2.1.0",
"eslint": "5.15.1", "eslint": "5.15.1",
"eslint-config-prettier": "4.1.0", "eslint-config-prettier": "4.1.0",
"magic-string": "0.25.2", "magic-string": "0.25.2",

View File

@ -1,2 +1,2 @@
import { redirect } from "./redirect1.ts"; import { redirect } from "./redirect1.ts";
export const value: string = `4 imports ${redirect}`; export const value = `4 imports ${redirect}`;

View File

@ -16,8 +16,8 @@ const bytes = new Uint8Array([
]); ]);
async function main() { async function main() {
let wasm = await WebAssembly.instantiate(bytes); const wasm = await WebAssembly.instantiate(bytes);
let result = wasm.instance.exports.add(1, 3); const result = wasm.instance.exports.add(1, 3);
console.log("1 + 3 =", result); console.log("1 + 3 =", result);
if (result != 4) { if (result != 4) {
throw Error("bad"); throw Error("bad");

View File

@ -38,7 +38,7 @@ function handleAsyncMsgFromWorker(
async function main(): Promise<void> { async function main(): Promise<void> {
const workers: Array<[Map<number, Resolvable<string>>, Worker]> = []; const workers: Array<[Map<number, Resolvable<string>>, Worker]> = [];
for (var i = 1; i <= workerCount; ++i) { for (let i = 1; i <= workerCount; ++i) {
const worker = new Worker("./subdir/bench_worker.ts"); const worker = new Worker("./subdir/bench_worker.ts");
const promise = new Promise( const promise = new Promise(
(resolve): void => { (resolve): void => {

View File

@ -3,7 +3,7 @@ const workerCount = 50;
async function bench(): Promise<void> { async function bench(): Promise<void> {
const workers: Worker[] = []; const workers: Worker[] = [];
for (var i = 1; i <= workerCount; ++i) { for (let i = 1; i <= workerCount; ++i) {
const worker = new Worker("./subdir/bench_worker.ts"); const worker = new Worker("./subdir/bench_worker.ts");
const promise = new Promise( const promise = new Promise(
(resolve): void => { (resolve): void => {

@ -1 +1 @@
Subproject commit d75b8c9c2b758d9450859081c8560ea673a5d81c Subproject commit c3b4aceb2444180334634aa5eb70580bfe592e11