Skip to content

Commit 8f07681

Browse files
committed
Aligns "empties"
1 parent 117d3aa commit 8f07681

File tree

7 files changed

+10
-29
lines changed

7 files changed

+10
-29
lines changed

src/api/api.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import { Container } from '../container';
33
import { builtInActionRunnerName } from './actionRunners';
44
import type { Action, ActionContext, ActionRunner, GitLensApi } from './gitlens';
55

6-
const emptyDisposable = Object.freeze({
7-
dispose: () => {
8-
/* noop */
9-
},
10-
});
6+
const emptyDisposable: Disposable = Object.freeze({ dispose: () => {} });
117

128
export class Api implements GitLensApi {
139
readonly #container: Container;

src/env/node/git/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import type { RunOptions, RunResult } from './shell';
5050
import { fsExists, isWindows, runSpawn } from './shell';
5151
import { CancelledRunError, RunError } from './shell.errors';
5252

53-
const emptyArray = Object.freeze([]) as unknown as any[];
53+
const emptyArray: readonly any[] = Object.freeze([]);
5454
const emptyObj = Object.freeze({});
5555

5656
const gitBranchDefaultConfigs = Object.freeze(['-c', 'color.branch=false']);

src/git/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface RepositoryInfo {
2323
user?: GitUser | null;
2424
}
2525

26-
const emptyArray = Object.freeze([]) as unknown as any[];
26+
const emptyArray: readonly any[] = Object.freeze([]);
2727

2828
export class GitCache implements Disposable {
2929
private readonly _disposable: Disposable;

src/git/fsProvider.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { GitUri, isGitUri } from './gitUri';
1212
import { deletedOrMissing } from './models/revision';
1313
import type { GitTreeEntry } from './models/tree';
1414

15-
const emptyArray = new Uint8Array(0);
15+
const emptyArray = Object.freeze(new Uint8Array(0));
16+
const emptyDisposable: Disposable = Object.freeze({ dispose: () => {} });
1617

1718
export function fromGitLensFSUri(uri: Uri): { path: string; ref: string; repoPath: string } {
1819
const gitUri = isGitUri(uri) ? uri : GitUri.fromRevisionUri(uri);
@@ -128,11 +129,7 @@ export class GitFileSystemProvider implements FileSystemProvider, Disposable {
128129
}
129130

130131
watch(): Disposable {
131-
return {
132-
dispose: () => {
133-
// nothing to dispose
134-
},
135-
};
132+
return emptyDisposable;
136133
}
137134

138135
writeFile(uri: Uri): void | Thenable<void> {

src/git/gitProviderService.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,8 @@ import { calculateDistribution } from './utils/contributor.utils';
8484
import { getRemoteThemeIconString, getVisibilityCacheKey } from './utils/remote.utils';
8585
import { createRevisionRange } from './utils/revision.utils';
8686

87-
const emptyArray = Object.freeze([]) as unknown as any[];
88-
const emptyDisposable = Object.freeze({
89-
dispose: () => {
90-
/* noop */
91-
},
92-
});
87+
const emptyArray: readonly any[] = Object.freeze([]);
88+
const emptyDisposable: Disposable = Object.freeze({ dispose: () => {} });
9389

9490
const maxDefaultBranchWeight = 100;
9591
const weightedDefaultBranches = new Map<string, number>([

src/views/nodes/branchNode.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,7 @@ export async function getBranchNodeParts(
756756
};
757757
}
758758

759-
const emptyDisposable = Object.freeze({
760-
dispose: () => {
761-
/* noop */
762-
},
763-
});
759+
const emptyDisposable: Disposable = Object.freeze({ dispose: () => {} });
764760

765761
export class CommitsCurrentBranchNode extends SubscribeableViewNode<'commits-current-branch'> {
766762
private repo: Repository | undefined;

src/webviews/home/homeWebview.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,7 @@ import {
119119
} from './protocol';
120120
import type { HomeWebviewShowingArgs } from './registration';
121121

122-
const emptyDisposable = Object.freeze({
123-
dispose: () => {
124-
/* noop */
125-
},
126-
});
122+
const emptyDisposable: Disposable = Object.freeze({ dispose: () => {} });
127123

128124
interface RepositoryBranchData {
129125
repo: Repository;

0 commit comments

Comments
 (0)