diff --git a/src/annotations/annotationProvider.ts b/src/annotations/annotationProvider.ts index 6feceac..686888f 100644 --- a/src/annotations/annotationProvider.ts +++ b/src/annotations/annotationProvider.ts @@ -50,8 +50,8 @@ export abstract class AnnotationProviderBase implements Disposable { ); } - async dispose() { - await this.clear(); + dispose() { + this.clear(); this.disposable && this.disposable.dispose(); } @@ -129,7 +129,7 @@ export abstract class AnnotationProviderBase implements Disposable { highlightDecoration: TextEditorDecorationType | undefined; }) { if (changes !== undefined) { - await this.clear(); + this.clear(); this.decoration = changes.decoration; this.highlightDecoration = changes.highlightDecoration; diff --git a/src/annotations/fileAnnotationController.ts b/src/annotations/fileAnnotationController.ts index d1390bf..1f0d906 100644 --- a/src/annotations/fileAnnotationController.ts +++ b/src/annotations/fileAnnotationController.ts @@ -442,7 +442,7 @@ export class FileAnnotationController implements Disposable { Logger.log(`${reason}:`, `Clear annotations for ${key}`); this._annotationProviders.delete(key); - await provider.dispose(); + provider.dispose(); if (this._annotationProviders.size === 0 || key === AnnotationProviderBase.getCorrelationKey(this._editor)) { await setCommandContext(CommandContext.AnnotationStatus, undefined); diff --git a/src/commands/diffWithRevision.ts b/src/commands/diffWithRevision.ts index 8112a7e..e2476e9 100644 --- a/src/commands/diffWithRevision.ts +++ b/src/commands/diffWithRevision.ts @@ -107,17 +107,16 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand { currentCommand: currentCommand, nextPageCommand: args.nextPageCommand, previousPageCommand: previousPageCommand, - showAllCommand: - log !== undefined && log.truncated - ? new CommandQuickPickItem( - { - label: `$(sync) Show All Commits`, - description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while` - }, - Commands.DiffWithRevision, - [uri, { ...args, maxCount: 0 } as DiffWithRevisionCommandArgs] - ) - : undefined + showAllCommand: log.truncated + ? new CommandQuickPickItem( + { + label: `$(sync) Show All Commits`, + description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while` + }, + Commands.DiffWithRevision, + [uri, { ...args, maxCount: 0 } as DiffWithRevisionCommandArgs] + ) + : undefined }); if (pick === undefined) return undefined; diff --git a/src/commands/openFileRevision.ts b/src/commands/openFileRevision.ts index 9a96b28..a2225f2 100644 --- a/src/commands/openFileRevision.ts +++ b/src/commands/openFileRevision.ts @@ -137,17 +137,16 @@ export class OpenFileRevisionCommand extends ActiveEditorCommand { currentCommand: currentCommand, nextPageCommand: args.nextPageCommand, previousPageCommand: previousPageCommand, - showAllCommand: - log !== undefined && log.truncated - ? new CommandQuickPickItem( - { - label: `$(sync) Show All Commits`, - description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while` - }, - Commands.OpenFileRevision, - [uri, { ...args, maxCount: 0 } as OpenFileRevisionCommandArgs] - ) - : undefined + showAllCommand: log.truncated + ? new CommandQuickPickItem( + { + label: `$(sync) Show All Commits`, + description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while` + }, + Commands.OpenFileRevision, + [uri, { ...args, maxCount: 0 } as OpenFileRevisionCommandArgs] + ) + : undefined }); if (pick === undefined) return undefined; diff --git a/src/commands/showCommitSearch.ts b/src/commands/showCommitSearch.ts index 5349661..8537b15 100644 --- a/src/commands/showCommitSearch.ts +++ b/src/commands/showCommitSearch.ts @@ -143,7 +143,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand { } if (args.showInResults) { - Container.resultsView.addSearchResults( + void Container.resultsView.addSearchResults( repoPath, Container.git.getLogForSearch(repoPath, args.search!, args.searchBy!, { maxCount: args.maxCount diff --git a/src/configuration.ts b/src/configuration.ts index cfeed32..2d40a94 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -10,11 +10,11 @@ import { Uri, workspace } from 'vscode'; -import { CommandContext, extensionId, setCommandContext } from './constants'; +import { extensionId } from './constants'; import { Container } from './container'; import { clearGravatarCache } from './git/gitService'; import { Functions } from './system'; -import { Config, KeyMap } from './ui/config'; +import { Config } from './ui/config'; const emptyConfig: any = new Proxy({} as Config, { get(target, propKey, receiver) { diff --git a/src/git/formatters/formatter.ts b/src/git/formatters/formatter.ts index 079ab78..d21c9c3 100644 --- a/src/git/formatters/formatter.ts +++ b/src/git/formatters/formatter.ts @@ -56,17 +56,7 @@ export abstract class Formatter 0 && options.truncateTo !== undefined) { - s = Strings.padLeft(s, diff, undefined, width); - } - } + this.collapsableWhitespace = 0; } else { max += this.collapsableWhitespace; diff --git a/src/git/git.ts b/src/git/git.ts index 91fd4c0..98e43f2 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -658,7 +658,7 @@ export class Git { return data === '' ? undefined : data.trim(); } - static async revparse_currentBranch(repoPath: string): Promise<[string, string?] | undefined> { + static async revparse_currentBranch(repoPath: string): Promise<[string, string | undefined] | undefined> { const params = ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@', '@{u}']; const opts = { diff --git a/src/git/gitService.ts b/src/git/gitService.ts index e4d032a..288d4c0 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -451,7 +451,7 @@ export class GitService implements Disposable { } Logger.error(ex); - Messages.showGenericErrorMessage(`Unable to apply changes`); + void Messages.showGenericErrorMessage(`Unable to apply changes`); } } diff --git a/src/git/models/branch.ts b/src/git/models/branch.ts index 955c51c..ef40a53 100644 --- a/src/git/models/branch.ts +++ b/src/git/models/branch.ts @@ -1,8 +1,7 @@ +'use strict'; import { Git } from '../git'; import { GitStatus } from './status'; -'use strict'; - export class GitBranch { readonly detached: boolean; readonly name: string; diff --git a/src/git/models/commit.ts b/src/git/models/commit.ts index 77a766f..da3f5c1 100644 --- a/src/git/models/commit.ts +++ b/src/git/models/commit.ts @@ -143,9 +143,7 @@ export abstract class GitCommit { } get previousUri(): Uri { - return this.previousFileName - ? Uri.file(paths.resolve(this.repoPath, (this.previousFileName || this.originalFileName)!)) - : this.uri; + return this.previousFileName ? Uri.file(paths.resolve(this.repoPath, this.previousFileName)) : this.uri; } get uri(): Uri { diff --git a/src/git/parsers/stashParser.ts b/src/git/parsers/stashParser.ts index 51e1d5e..efc03e8 100644 --- a/src/git/parsers/stashParser.ts +++ b/src/git/parsers/stashParser.ts @@ -121,8 +121,7 @@ export class GitStashParser { } } - let commit = commits.get(entry.ref!); - commit = GitStashParser.parseEntry(entry, commit, repoPath, commits); + GitStashParser.parseEntry(entry, repoPath, commits); } } @@ -132,12 +131,8 @@ export class GitStashParser { } as GitStash; } - private static parseEntry( - entry: StashEntry, - commit: GitStashCommit | undefined, - repoPath: string, - commits: Map - ): GitStashCommit | undefined { + private static parseEntry(entry: StashEntry, repoPath: string, commits: Map) { + let commit = commits.get(entry.ref!); if (commit === undefined) { commit = new GitStashCommit( GitCommitType.Stash, @@ -153,6 +148,5 @@ export class GitStashParser { } commits.set(entry.ref!, commit); - return commit; } } diff --git a/src/quickpicks/commonQuickPicks.ts b/src/quickpicks/commonQuickPicks.ts index cea513b..1234736 100644 --- a/src/quickpicks/commonQuickPicks.ts +++ b/src/quickpicks/commonQuickPicks.ts @@ -145,9 +145,7 @@ export class ChooseFromBranchesAndTagsQuickPickItem extends CommandQuickPickItem super(item, undefined, undefined); } - async execute( - options: TextDocumentShowOptions = { preserveFocus: false, preview: false } - ): Promise { + async execute(): Promise { const progressCancellation = BranchesAndTagsQuickPick.showProgress(this.placeHolder); try { @@ -244,9 +242,7 @@ export class ShowCommitInResultsQuickPickItem extends CommandQuickPickItem { super(item, undefined, undefined); } - async execute( - options: TextDocumentShowOptions = { preserveFocus: false, preview: false } - ): Promise<{} | undefined> { + async execute(): Promise<{} | undefined> { await Container.resultsView.addCommit(this.commit); return undefined; } @@ -264,9 +260,7 @@ export class ShowCommitsInResultsQuickPickItem extends CommandQuickPickItem { super(item, undefined, undefined); } - async execute( - options: TextDocumentShowOptions = { preserveFocus: false, preview: false } - ): Promise<{} | undefined> { + async execute(): Promise<{} | undefined> { await Container.resultsView.addSearchResults(this.results.repoPath, this.results, this.resultsLabel); return undefined; } diff --git a/src/system/decorators.ts b/src/system/decorators.ts index f700479..680afff 100644 --- a/src/system/decorators.ts +++ b/src/system/decorators.ts @@ -85,14 +85,14 @@ export function log( if (Logger.level === LogLevel.Debug || (Logger.level === LogLevel.Verbose && !options.debug)) { let instanceName: string; if (this != null) { - instanceName = this.constructor.name; + instanceName = this.constructor != null ? this.constructor.name : ''; // Strip webpack module name (since I never name classes with an _) const index = instanceName.indexOf('_'); if (index !== -1) { instanceName = instanceName.substr(index + 1); } - if (this.constructor && this.constructor[LogInstanceNameFn]) { + if (this.constructor != null && this.constructor[LogInstanceNameFn]) { instanceName = target.constructor[LogInstanceNameFn](this, instanceName); } } diff --git a/src/system/function.ts b/src/system/function.ts index 6392c19..4d96da8 100644 --- a/src/system/function.ts +++ b/src/system/function.ts @@ -1,6 +1,6 @@ +'use strict'; import { Disposable } from 'vscode'; -'use strict'; const _debounce = require('lodash.debounce'); const _once = require('lodash.once'); diff --git a/src/trackers/documentTracker.ts b/src/trackers/documentTracker.ts index 0c08a53..2ee0175 100644 --- a/src/trackers/documentTracker.ts +++ b/src/trackers/documentTracker.ts @@ -170,7 +170,7 @@ export class DocumentTracker implements Disposable { } private onTextDocumentSaved(document: TextDocument) { - let doc = this._documentMap.get(document); + const doc = this._documentMap.get(document); if (doc !== undefined) { void doc.update({ forceBlameChange: true }); @@ -179,7 +179,7 @@ export class DocumentTracker implements Disposable { // If we are saving the active document make sure we are tracking it if (isActiveDocument(document)) { - doc = this.addCore(document); + void this.addCore(document); } } diff --git a/src/views/fileHistoryView.ts b/src/views/fileHistoryView.ts index 78edee5..577db78 100644 --- a/src/views/fileHistoryView.ts +++ b/src/views/fileHistoryView.ts @@ -21,7 +21,7 @@ export class FileHistoryView extends ViewBase { } protected registerCommands() { - Container.viewCommands; + void Container.viewCommands; commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand( this.getQualifiedCommand('refreshNode'), diff --git a/src/views/lineHistoryView.ts b/src/views/lineHistoryView.ts index ad26816..e22ee3c 100644 --- a/src/views/lineHistoryView.ts +++ b/src/views/lineHistoryView.ts @@ -21,7 +21,7 @@ export class LineHistoryView extends ViewBase { } protected registerCommands() { - Container.viewCommands; + void Container.viewCommands; commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand( this.getQualifiedCommand('refreshNode'), diff --git a/src/views/nodes/repositoriesNode.ts b/src/views/nodes/repositoriesNode.ts index 3fe79b0..1c39332 100644 --- a/src/views/nodes/repositoriesNode.ts +++ b/src/views/nodes/repositoriesNode.ts @@ -76,7 +76,7 @@ export class RepositoriesNode extends SubscribeableViewNode { const child = (this._children as RepositoryNode[]).find(c => c.repo.normalizedPath === normalizedPath); if (child !== undefined) { children.push(child); - child.refresh(); + void child.refresh(); } else { children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this, this.view)); @@ -133,7 +133,7 @@ export class RepositoriesNode extends SubscribeableViewNode { parent = parent.getParent(); } - this.view.reveal(node); + void this.view.reveal(node); } catch (ex) { Logger.error(ex); diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index 037191e..a4e9b7e 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -143,7 +143,7 @@ export abstract class SubscribeableViewNode extends ViewNode @debug() dispose() { - this.unsubscribe(); + void this.unsubscribe(); if (this._disposable !== undefined) { this._disposable.dispose(); diff --git a/src/views/repositoriesView.ts b/src/views/repositoriesView.ts index 28be39d..74ecc22 100644 --- a/src/views/repositoriesView.ts +++ b/src/views/repositoriesView.ts @@ -27,7 +27,7 @@ export class RepositoriesView extends ViewBase { } protected registerCommands() { - Container.viewCommands; + void Container.viewCommands; commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand( diff --git a/src/views/resultsView.ts b/src/views/resultsView.ts index 33d960e..46f2d4f 100644 --- a/src/views/resultsView.ts +++ b/src/views/resultsView.ts @@ -33,7 +33,7 @@ export class ResultsView extends ViewBase { } protected registerCommands() { - Container.viewCommands; + void Container.viewCommands; commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand( this.getQualifiedCommand('refreshNode'), diff --git a/src/views/viewCommands.ts b/src/views/viewCommands.ts index d5d75b6..c03e709 100644 --- a/src/views/viewCommands.ts +++ b/src/views/viewCommands.ts @@ -369,16 +369,16 @@ export class ViewCommands implements Disposable { } as OpenFileInRemoteCommandArgs); } - stageFile(node: CommitFileNode | StatusFileNode) { + private async stageFile(node: CommitFileNode | StatusFileNode) { if (!(node instanceof CommitFileNode) && !(node instanceof StatusFileNode)) return; - Container.git.stageFile(node.repoPath, node.file.fileName); + void (await Container.git.stageFile(node.repoPath, node.file.fileName)); } - unstageFile(node: CommitFileNode | StatusFileNode) { + private async unstageFile(node: CommitFileNode | StatusFileNode) { if (!(node instanceof CommitFileNode) && !(node instanceof StatusFileNode)) return; - Container.git.unStageFile(node.repoPath, node.file.fileName); + void (await Container.git.unStageFile(node.repoPath, node.file.fileName)); } async terminalCheckoutBranch(node: ViewNode) {