fix eslint errors

This commit is contained in:
Alexander 2019-08-04 15:49:41 +03:00
parent a292ae1789
commit 4d23429d98
5 changed files with 15 additions and 15 deletions

View file

@ -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 = [];

View file

@ -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 its 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;
};

View file

@ -83,7 +83,7 @@ namespace ts {
let currentSourceFile: SourceFile;
let refs: Map<SourceFile>;
let libs: Map<boolean>;
let emittedImports: readonly AnyImportSyntax[] | undefined; // must be declared in container so it can be `undefined` while transformer's first pass
let emittedImports: ReadonlyArray<AnyImportSyntax> | 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);

View file

@ -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:

View file

@ -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<T>(arr: T[][]): readonly T[] {
function flatArray<T>(arr: T[][]): ReadonlyArray<T> {
return flatMap(arr, identity);
}
function pkgs<T>(cb: (index: number) => T): T[] {