mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Git - remove usages of any (#270075)
* Git - remove usages of `any`
* 💄 fix check
This commit is contained in:
@@ -2381,12 +2381,8 @@ export class CommandCenter {
|
||||
let promptToSaveFilesBeforeCommit = config.get<'always' | 'staged' | 'never'>('promptToSaveFilesBeforeCommit');
|
||||
|
||||
// migration
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
if (promptToSaveFilesBeforeCommit as any === true) {
|
||||
promptToSaveFilesBeforeCommit = 'always';
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
} else if (promptToSaveFilesBeforeCommit as any === false) {
|
||||
promptToSaveFilesBeforeCommit = 'never';
|
||||
if (typeof promptToSaveFilesBeforeCommit === 'boolean') {
|
||||
promptToSaveFilesBeforeCommit = promptToSaveFilesBeforeCommit ? 'always' : 'never';
|
||||
}
|
||||
|
||||
let enableSmartCommit = config.get<boolean>('enableSmartCommit') === true;
|
||||
|
||||
@@ -24,8 +24,7 @@ export async function ensureEmojis() {
|
||||
|
||||
async function loadEmojiMap() {
|
||||
const context = getExtensionContext();
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
const uri = (Uri as any).joinPath(context.extensionUri, 'resources', 'emojis.json');
|
||||
const uri = Uri.joinPath(context.extensionUri, 'resources', 'emojis.json');
|
||||
emojiMap = JSON.parse(new TextDecoder('utf8').decode(await workspace.fs.readFile(uri)));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { fileURLToPath } from 'url';
|
||||
import which from 'which';
|
||||
import { EventEmitter } from 'events';
|
||||
import * as filetype from 'file-type';
|
||||
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter, Versions, isWindows, pathEquals, isMacintosh, isDescendant, relativePathWithNoFallback } from './util';
|
||||
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter, Versions, isWindows, pathEquals, isMacintosh, isDescendant, relativePathWithNoFallback, Mutable } from './util';
|
||||
import { CancellationError, CancellationToken, ConfigurationChangeEvent, LogOutputChannel, Progress, Uri, workspace } from 'vscode';
|
||||
import { Commit as ApiCommit, Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, RefQuery as ApiRefQuery, InitOptions } from './api/git';
|
||||
import * as byline from 'byline';
|
||||
@@ -307,9 +307,8 @@ export class GitError extends Error {
|
||||
stderr: this.stderr
|
||||
}, null, 2);
|
||||
|
||||
if (this.error) {
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
result += (<any>this.error).stack;
|
||||
if (this.error?.stack) {
|
||||
result += this.error.stack;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2973,10 +2972,8 @@ export class Repository {
|
||||
const result = await this.exec(['rev-list', '--left-right', '--count', `${branch.name}...${branch.upstream.remote}/${branch.upstream.name}`]);
|
||||
const [ahead, behind] = result.stdout.trim().split('\t');
|
||||
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
(branch as any).ahead = Number(ahead) || 0;
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
(branch as any).behind = Number(behind) || 0;
|
||||
(branch as Mutable<Branch>).ahead = Number(ahead) || 0;
|
||||
(branch as Mutable<Branch>).behind = Number(behind) || 0;
|
||||
} catch { }
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,7 @@ async function createModel(context: ExtensionContext, logger: LogOutputChannel,
|
||||
|
||||
const git = new Git({
|
||||
gitPath: info.path,
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
userAgent: `git/${info.version} (${(os as any).version?.() ?? os.type()} ${os.release()}; ${os.platform()} ${os.arch()}) vscode/${vscodeVersion} (${env.appName})`,
|
||||
userAgent: `git/${info.version} (${os.version() ?? os.type()} ${os.release()}; ${os.platform()} ${os.arch()}) vscode/${vscodeVersion} (${env.appName})`,
|
||||
version: info.version,
|
||||
env: environment,
|
||||
});
|
||||
|
||||
@@ -15,6 +15,10 @@ export const isRemote = env.remoteName !== undefined;
|
||||
export const isLinux = process.platform === 'linux';
|
||||
export const isLinuxSnap = isLinux && !!process.env['SNAP'] && !!process.env['SNAP_REVISION'];
|
||||
|
||||
export type Mutable<T> = {
|
||||
-readonly [P in keyof T]: T[P]
|
||||
};
|
||||
|
||||
export function log(...args: any[]): void {
|
||||
console.log.apply(console, ['git:', ...args]);
|
||||
}
|
||||
@@ -238,8 +242,7 @@ export function readBytes(stream: Readable, bytes: number): Promise<Buffer> {
|
||||
bytesRead += bytesToRead;
|
||||
|
||||
if (bytesRead === bytes) {
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
(stream as any).destroy(); // Will trigger the close event eventually
|
||||
stream.destroy(); // Will trigger the close event eventually
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user