Update typescript-eslint to latest (#43381)

This commit is contained in:
Ron Buckton 2021-03-25 14:46:16 -07:00 committed by GitHub
parent eb804a9706
commit fbd7f7db20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 10697 additions and 142 deletions

10762
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -53,9 +53,9 @@
"@types/source-map-support": "latest",
"@types/through2": "latest",
"@types/xml2js": "^0.4.0",
"@typescript-eslint/eslint-plugin": "4.5.0",
"@typescript-eslint/experimental-utils": "4.5.0",
"@typescript-eslint/parser": "4.5.0",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/experimental-utils": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"async": "latest",
"azure-devops-node-api": "^10.1.0",
"browser-resolve": "^1.11.2",
@ -94,7 +94,7 @@
"remove-internal": "^2.9.2",
"source-map-support": "latest",
"through2": "latest",
"typescript": "^4.0.0-dev.20200624",
"typescript": "^4.2.3",
"vinyl": "latest",
"vinyl-sourcemaps-apply": "latest",
"xml2js": "^0.4.19"
@ -129,6 +129,5 @@
},
"volta": {
"node": "14.15.5"
},
"dependencies": {}
}
}

View file

@ -11616,7 +11616,7 @@ namespace ts {
}
}
result.declarations = declarations!;
result.declarations = declarations;
result.nameType = nameType;
if (propTypes.length > 2) {
// When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed

View file

@ -1166,8 +1166,8 @@ namespace ts {
tempFlagsStack = [];
tempFlags = TempFlags.Auto;
reservedNamesStack = [];
currentSourceFile = undefined!;
currentLineMap = undefined!;
currentSourceFile = undefined;
currentLineMap = undefined;
detachedCommentsInfo = undefined;
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
}
@ -3153,10 +3153,10 @@ namespace ts {
let body = node.body;
if (!body) return writeTrailingSemicolon();
while (body.kind === SyntaxKind.ModuleDeclaration) {
while (body && isModuleDeclaration(body)) {
writePunctuation(".");
emit((<ModuleDeclaration>body).name);
body = (<ModuleDeclaration>body).body!;
emit(body.name);
body = body.body;
}
writeSpace();

View file

@ -555,9 +555,9 @@ namespace ts {
// NOTE: The following properties are commonly set by the binder and are added here to
// ensure declarations have a stable shape.
node.symbol = undefined!; // initialized by binder
node.localSymbol = undefined!; // initialized by binder
node.locals = undefined!; // initialized by binder
node.nextContainer = undefined!; // initialized by binder
node.localSymbol = undefined; // initialized by binder
node.locals = undefined; // initialized by binder
node.nextContainer = undefined; // initialized by binder
return node;
}

View file

@ -1014,7 +1014,7 @@ namespace ts {
jsDocDiagnostics = undefined!;
parsingContext = 0;
identifiers = undefined!;
notParenthesizedArrow = undefined!;
notParenthesizedArrow = undefined;
topLevel = true;
}

View file

@ -534,7 +534,7 @@ namespace ts {
if (shouldTransformPrivateElements) {
if (isDestructuringAssignment(node)) {
const savedPendingExpressions = pendingExpressions;
pendingExpressions = undefined!;
pendingExpressions = undefined;
node = factory.updateBinaryExpression(
node,
visitNode(node.left, visitorDestructuringTarget),

View file

@ -133,7 +133,7 @@ namespace ts {
moduleInfo = undefined!;
exportFunction = undefined!;
contextObject = undefined!;
hoistedStatements = undefined!;
hoistedStatements = undefined;
enclosingBlockScopedContainer = undefined!;
return updated;
}

View file

@ -5628,8 +5628,8 @@ namespace ts {
function Symbol(this: Symbol, flags: SymbolFlags, name: __String) {
this.flags = flags;
this.escapedName = name;
this.declarations = undefined!;
this.valueDeclaration = undefined!;
this.declarations = undefined;
this.valueDeclaration = undefined;
this.id = undefined;
this.mergeId = undefined;
this.parent = undefined;

View file

@ -962,12 +962,14 @@ namespace FourSlash {
}
/** Use `getProgram` instead of accessing this directly. */
private _program: ts.Program | undefined;
private _program: ts.Program | undefined | "missing";
/** Use `getChecker` instead of accessing this directly. */
private _checker: ts.TypeChecker | undefined;
private getProgram(): ts.Program {
return this._program || (this._program = this.languageService.getProgram()!); // TODO: GH#18217
if (!this._program) this._program = this.languageService.getProgram() || "missing";
if (this._program === "missing") ts.Debug.fail("Could not retrieve program from language service");
return this._program;
}
private getChecker() {

View file

@ -772,9 +772,9 @@ namespace ts.server {
this.rootFiles = undefined!;
this.rootFilesMap = undefined!;
this.externalFiles = undefined!;
this.program = undefined!;
this.builderState = undefined!;
this.externalFiles = undefined;
this.program = undefined;
this.builderState = undefined;
this.resolutionCache.clear();
this.resolutionCache = undefined!;
this.cachedUnresolvedImportsPerFile = undefined!;
@ -784,7 +784,7 @@ namespace ts.server {
// Clean up file watchers waiting for missing files
if (this.missingFilesMap) {
clearMap(this.missingFilesMap, closeFileWatcher);
this.missingFilesMap = undefined!;
this.missingFilesMap = undefined;
}
this.clearGeneratedFileWatch();
this.clearInvalidateResolutionOfFailedLookupTimer();
@ -1087,7 +1087,7 @@ namespace ts.server {
const start = timestamp();
this.hasInvalidatedResolution = this.resolutionCache.createHasInvalidatedResolution();
this.resolutionCache.startCachingPerDirectoryResolution();
this.program = this.languageService.getProgram()!; // TODO: GH#18217
this.program = this.languageService.getProgram(); // TODO: GH#18217
this.dirty = false;
this.resolutionCache.finishCachingPerDirectoryResolution();
@ -1096,8 +1096,9 @@ namespace ts.server {
// bump up the version if
// - oldProgram is not set - this is a first time updateGraph is called
// - newProgram is different from the old program and structure of the old program was not reused.
const hasNewProgram = this.program && (!oldProgram || (this.program !== oldProgram && !(this.program.structureIsReused & StructureIsReused.Completely)));
if (hasNewProgram) {
let hasNewProgram = false;
if (this.program && (!oldProgram || (this.program !== oldProgram && !(this.program.structureIsReused & StructureIsReused.Completely)))) {
hasNewProgram = true;
if (oldProgram) {
for (const f of oldProgram.getSourceFiles()) {
const newFile = this.program.getSourceFileByPath(f.resolvedPath);
@ -1163,7 +1164,7 @@ namespace ts.server {
}
if (!this.importSuggestionsCache.isEmpty()) {
if (this.hasAddedorRemovedFiles || oldProgram && !this.program.structureIsReused) {
if (this.hasAddedorRemovedFiles || oldProgram && !this.program!.structureIsReused) {
this.importSuggestionsCache.clear();
}
else if (this.dirtyFilesForSuggestions && oldProgram && this.program) {
@ -1204,7 +1205,7 @@ namespace ts.server {
this.print(/*writeProjectFileNames*/ true);
}
else if (this.program !== oldProgram) {
this.writeLog(`Different program with same set of files:: structureIsReused:: ${this.program.structureIsReused}`);
this.writeLog(`Different program with same set of files:: structureIsReused:: ${this.program?.structureIsReused}`);
}
return hasNewProgram;
}

View file

@ -1326,7 +1326,7 @@ namespace ts {
public close(): void {
// Forget all the registered shims
clear(this._shims);
this.documentRegistry = undefined!;
this.documentRegistry = undefined;
}
public registerShim(shim: Shim): void {

View file

@ -197,13 +197,13 @@ namespace ts.SymbolDisplay {
}
if (callExpressionLike) {
signature = typeChecker.getResolvedSignature(callExpressionLike)!; // TODO: GH#18217
signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217
const useConstructSignatures = callExpressionLike.kind === SyntaxKind.NewExpression || (isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === SyntaxKind.SuperKeyword);
const allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!contains(allSignatures, signature.target) && !contains(allSignatures, signature)) {
if (signature && !contains(allSignatures, signature.target) && !contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
// either the original signature or its target, so check for either
signature = allSignatures.length ? allSignatures[0] : undefined;
@ -278,7 +278,7 @@ namespace ts.SymbolDisplay {
if (locationIsSymbolDeclaration) {
const allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration)!; // TODO: GH#18217
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); // TODO: GH#18217
}
else {
signature = allSignatures[0];
@ -294,8 +294,9 @@ namespace ts.SymbolDisplay {
addPrefixForAnyFunctionOrVar(functionDeclaration.kind === SyntaxKind.CallSignature &&
!(type.symbol.flags & SymbolFlags.TypeLiteral || type.symbol.flags & SymbolFlags.ObjectLiteral) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
if (signature) {
addSignatureDisplayParts(signature, allSignatures);
}
hasAddedSymbolInfo = true;
hasMultipleSignatures = allSignatures.length > 1;
}