auto-fixed prefer-const violation

This commit is contained in:
Johannes
2022-06-08 17:49:21 +02:00
parent aa23a0dbb7
commit 0656d21d11
862 changed files with 6489 additions and 6489 deletions

View File

@@ -80,7 +80,7 @@ export class Askpass implements IIPCHandler {
};
}
let env: { [key: string]: string } = {
const env: { [key: string]: string } = {
...this.ipc.getEnv(),
VSCODE_GIT_ASKPASS_NODE: process.execPath,
VSCODE_GIT_ASKPASS_EXTRA_ARGS: (process.versions['electron'] && process.versions['microsoft-build']) ? '--ms-enable-electron-run-as-node' : '',

View File

@@ -418,8 +418,8 @@ export class CommandCenter {
type InputData = { uri: Uri; detail?: string; description?: string };
const mergeUris = toMergeUris(uri);
let input1: InputData = { uri: mergeUris.ours };
let input2: InputData = { uri: mergeUris.theirs };
const input1: InputData = { uri: mergeUris.ours };
const input2: InputData = { uri: mergeUris.theirs };
try {
const [head, mergeHead] = await Promise.all([repo.getCommit('HEAD'), repo.getCommit('MERGE_HEAD')]);
@@ -1561,7 +1561,7 @@ export class CommandCenter {
}
}
let message = await getCommitMessage();
const message = await getCommitMessage();
if (!message && !opts.amend) {
return false;
@@ -1627,7 +1627,7 @@ export class CommandCenter {
let _message: string | undefined = message;
if (!_message) {
let value: string | undefined = undefined;
const value: string | undefined = undefined;
if (opts && opts.amend && repository.HEAD && repository.HEAD.commit) {
return undefined;

View File

@@ -106,7 +106,7 @@ class GitDecorationProvider implements FileDecorationProvider {
}
private onDidRunGitStatus(): void {
let newDecorations = new Map<string, FileDecoration>();
const newDecorations = new Map<string, FileDecoration>();
this.collectSubmoduleDecorationData(newDecorations);
this.collectDecorationData(this.repository.indexGroup, newDecorations);

View File

@@ -50,7 +50,7 @@ const JSCHARDET_TO_ICONV_ENCODINGS: { [name: string]: string } = {
};
export function detectEncoding(buffer: Buffer): string | null {
let result = detectEncodingByBOM(buffer);
const result = detectEncodingByBOM(buffer);
if (result) {
return result;

View File

@@ -406,7 +406,7 @@ export class Git {
}
async clone(url: string, options: ICloneOptions, cancellationToken?: CancellationToken): Promise<string> {
let baseFolderName = decodeURI(url).replace(/[\/]+$/, '').replace(/^.*[\/\\]/, '').replace(/\.git$/, '') || 'repository';
const baseFolderName = decodeURI(url).replace(/[\/]+$/, '').replace(/^.*[\/\\]/, '').replace(/\.git$/, '') || 'repository';
let folderName = baseFolderName;
let folderPath = path.join(options.parentPath, folderName);
let count = 1;
@@ -447,7 +447,7 @@ export class Git {
};
try {
let command = ['clone', url.includes(' ') ? encodeURI(url) : url, folderPath, '--progress'];
const command = ['clone', url.includes(' ') ? encodeURI(url) : url, folderPath, '--progress'];
if (options.recursive) {
command.push('--recursive');
}
@@ -481,7 +481,7 @@ export class Git {
const pathUri = Uri.file(repositoryPath);
if (repoUri.authority.length !== 0 && pathUri.authority.length === 0) {
// eslint-disable-next-line code-no-look-behind-regex
let match = /(?<=^\/?)([a-zA-Z])(?=:\/)/.exec(pathUri.path);
const match = /(?<=^\/?)([a-zA-Z])(?=:\/)/.exec(pathUri.path);
if (match !== null) {
const [, letter] = match;
@@ -794,7 +794,7 @@ export function parseGitmodules(raw: string): Submodule[] {
const commitRegex = /([0-9a-f]{40})\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)(?:\n([^]*?))?(?:\x00)/gm;
export function parseGitCommits(data: string): Commit[] {
let commits: Commit[] = [];
const commits: Commit[] = [];
let ref;
let authorName;
@@ -1543,7 +1543,7 @@ export class Repository {
}
async deleteTag(name: string): Promise<void> {
let args = ['tag', '-d', name];
const args = ['tag', '-d', name];
await this.exec(args);
}

View File

@@ -9,7 +9,7 @@ export function applyLineChanges(original: TextDocument, modified: TextDocument,
const result: string[] = [];
let currentLine = 0;
for (let diff of diffs) {
for (const diff of diffs) {
const isInsertion = diff.originalEndLineNumber === 0;
const isDeletion = diff.modifiedEndLineNumber === 0;

View File

@@ -89,7 +89,7 @@ export function eventToPromise<T>(event: Event<T>): Promise<T> {
}
export function once(fn: (...args: any[]) => any): (...args: any[]) => any {
let didRun = false;
const didRun = false;
return (...args) => {
if (didRun) {
@@ -219,11 +219,11 @@ export async function grep(filename: string, pattern: RegExp): Promise<boolean>
export function readBytes(stream: Readable, bytes: number): Promise<Buffer> {
return new Promise<Buffer>((complete, error) => {
let done = false;
let buffer = Buffer.allocUnsafe(bytes);
const buffer = Buffer.allocUnsafe(bytes);
let bytesRead = 0;
stream.on('data', (data: Buffer) => {
let bytesToRead = Math.min(bytes - bytesRead, data.length);
const bytesToRead = Math.min(bytes - bytesRead, data.length);
data.copy(buffer, bytesRead, 0, bytesToRead);
bytesRead += bytesToRead;