Skip to content

Update typescript-eslint to latest #43381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10,762 changes: 10,657 additions & 105 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -129,6 +129,5 @@
},
"volta": {
"node": "14.15.5"
},
"dependencies": {}
}
}
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/factory/nodeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ namespace ts {
jsDocDiagnostics = undefined!;
parsingContext = 0;
identifiers = undefined!;
notParenthesizedArrow = undefined!;
notParenthesizedArrow = undefined;
topLevel = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/classFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/module/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace ts {
moduleInfo = undefined!;
exportFunction = undefined!;
contextObject = undefined!;
hoistedStatements = undefined!;
hoistedStatements = undefined;
enclosingBlockScopedContainer = undefined!;
return updated;
}
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/harness/fourslashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
19 changes: 10 additions & 9 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!;
Expand All @@ -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();
Expand Down Expand Up @@ -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();

Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions src/services/symbolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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;
}
Expand Down