From 4d23429d98dc181267b28fb31027237bae320430 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 4 Aug 2019 15:49:41 +0300 Subject: [PATCH] fix eslint errors --- src/compiler/program.ts | 2 +- src/compiler/scanner.ts | 12 ++++++------ src/compiler/transformers/declarations.ts | 2 +- src/services/codefixes/importFixes.ts | 4 ++-- src/testRunner/unittests/tsbuild/watchEnvironment.ts | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b4a99ddc321..785e98c3f3b 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -814,7 +814,7 @@ namespace ts { // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`. let structuralIsReused: StructureIsReused | undefined; - structuralIsReused = tryReuseStructureFromOldProgram(); + structuralIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const if (structuralIsReused !== StructureIsReused.Completely) { processingDefaultLibFiles = []; processingOtherFiles = []; diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 4ec4cfff7da..3234260b0a8 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -2225,17 +2225,17 @@ namespace ts { const size = str.length; // Account for out-of-bounds indices: if (i < 0 || i >= size) { - return undefined!; // String.codePointAt returns `undefined` for OOB indexes + return undefined!; // String.codePointAt returns `undefined` for OOB indexes } // Get the first code unit const first = str.charCodeAt(i); // check if it’s the start of a surrogate pair if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit - const second = str.charCodeAt(i + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } + const second = str.charCodeAt(i + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } } return first; }; diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index c655c8667b1..115cbe108ee 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -83,7 +83,7 @@ namespace ts { let currentSourceFile: SourceFile; let refs: Map; let libs: Map; - let emittedImports: readonly AnyImportSyntax[] | undefined; // must be declared in container so it can be `undefined` while transformer's first pass + let emittedImports: ReadonlyArray | undefined; // must be declared in container so it can be `undefined` while transformer's first pass const resolver = context.getEmitResolver(); const options = context.getCompilerOptions(); const newLine = getNewLineCharacter(options); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 281dd47d47b..62a2cc9077d 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -360,8 +360,8 @@ namespace ts.codefix { case ModuleKind.UMD: if (isInJSFile(importingFile)) { return isExternalModule(importingFile) ? ImportKind.Namespace : ImportKind.ConstEquals; - } - return ImportKind.Equals; + } + return ImportKind.Equals; case ModuleKind.System: case ModuleKind.ES2015: case ModuleKind.ESNext: diff --git a/src/testRunner/unittests/tsbuild/watchEnvironment.ts b/src/testRunner/unittests/tsbuild/watchEnvironment.ts index d20dd7a0022..f73b9f1174e 100644 --- a/src/testRunner/unittests/tsbuild/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuild/watchEnvironment.ts @@ -29,10 +29,10 @@ namespace ts.tscWatch { solutionBuilder.build(); checkOutputErrorsInitial(system, emptyArray, /*disableConsoleClears*/ undefined, [ `Projects in this build: \r\n${ - concatenate( - pkgs(index => ` * pkg${index}/tsconfig.json`), - [" * tsconfig.json"] - ).join("\r\n")}\n\n`, + concatenate( + pkgs(index => ` * pkg${index}/tsconfig.json`), + [" * tsconfig.json"] + ).join("\r\n")}\n\n`, ...flatArray(pkgs(index => [ `Project 'pkg${index}/tsconfig.json' is out of date because output file 'pkg${index}/index.js' does not exist\n\n`, `Building project '${project}/pkg${index}/tsconfig.json'...\n\n` @@ -70,7 +70,7 @@ namespace ts.tscWatch { system.writeFile(typing.path, `${typing.content}export const typing1 = 10;`); system.checkTimeoutQueueLength(0); - function flatArray(arr: T[][]): readonly T[] { + function flatArray(arr: T[][]): ReadonlyArray { return flatMap(arr, identity); } function pkgs(cb: (index: number) => T): T[] {