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

View file

@ -11616,7 +11616,7 @@ namespace ts {
} }
} }
result.declarations = declarations!; result.declarations = declarations;
result.nameType = nameType; result.nameType = nameType;
if (propTypes.length > 2) { if (propTypes.length > 2) {
// When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed // 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 = []; tempFlagsStack = [];
tempFlags = TempFlags.Auto; tempFlags = TempFlags.Auto;
reservedNamesStack = []; reservedNamesStack = [];
currentSourceFile = undefined!; currentSourceFile = undefined;
currentLineMap = undefined!; currentLineMap = undefined;
detachedCommentsInfo = undefined; detachedCommentsInfo = undefined;
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined); setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
} }
@ -3153,10 +3153,10 @@ namespace ts {
let body = node.body; let body = node.body;
if (!body) return writeTrailingSemicolon(); if (!body) return writeTrailingSemicolon();
while (body.kind === SyntaxKind.ModuleDeclaration) { while (body && isModuleDeclaration(body)) {
writePunctuation("."); writePunctuation(".");
emit((<ModuleDeclaration>body).name); emit(body.name);
body = (<ModuleDeclaration>body).body!; body = body.body;
} }
writeSpace(); writeSpace();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -962,12 +962,14 @@ namespace FourSlash {
} }
/** Use `getProgram` instead of accessing this directly. */ /** 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. */ /** Use `getChecker` instead of accessing this directly. */
private _checker: ts.TypeChecker | undefined; private _checker: ts.TypeChecker | undefined;
private getProgram(): ts.Program { 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() { private getChecker() {

View file

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

View file

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

View file

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