From fbccf2428fd671378202de43ff99deff66168a13 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 15 Nov 2023 12:13:41 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84prettiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc | 4 -- src/annotations/blameAnnotationProvider.ts | 8 +-- src/annotations/gutterChangesAnnotationProvider.ts | 4 +- src/commands/git/push.ts | 16 ++--- src/commands/quickCommand.ts | 16 ++--- src/errors.ts | 4 +- src/extension.ts | 4 +- src/plus/github/github.ts | 32 +++++----- src/plus/github/githubGitProvider.ts | 8 +-- src/plus/gk/checkin.ts | 4 +- src/quickpicks/referencePicker.ts | 8 +-- src/system/configuration.ts | 4 +- src/system/serialize.ts | 20 +++---- src/views/nodes/abstract/viewNode.ts | 68 +++++++++++----------- src/views/nodes/autolinkedItemNode.ts | 12 ++-- src/views/nodes/branchNode.ts | 14 +++-- src/views/nodes/commitNode.ts | 8 +-- src/views/nodes/fileHistoryNode.ts | 12 ++-- src/views/nodes/fileRevisionAsCommitNode.ts | 4 +- src/views/nodes/remoteNode.ts | 14 +++-- src/views/nodes/resultsCommitsNode.ts | 4 +- src/views/nodes/resultsFilesNode.ts | 4 +- src/views/nodes/worktreeNode.ts | 12 ++-- src/views/viewCommands.ts | 8 +-- .../plus/focus/components/gk-pull-request-row.ts | 8 +-- src/webviews/apps/plus/timeline/chart.ts | 4 +- .../components/list/file-change-list-item.ts | 68 +++++++++++----------- src/webviews/webviewController.ts | 4 +- 28 files changed, 190 insertions(+), 186 deletions(-) diff --git a/.prettierrc b/.prettierrc index 5a24bc3..df7b601 100644 --- a/.prettierrc +++ b/.prettierrc @@ -14,10 +14,6 @@ { "files": "*.md", "options": { "tabWidth": 2 } - }, - { - "files": "*.svg", - "options": { "parser": "html" } } ] } diff --git a/src/annotations/blameAnnotationProvider.ts b/src/annotations/blameAnnotationProvider.ts index 3c8b47d..de6bf5f 100644 --- a/src/annotations/blameAnnotationProvider.ts +++ b/src/annotations/blameAnnotationProvider.ts @@ -107,10 +107,10 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase Array.isArray(lookupTable) ? lookupTable : unified - ? lookupTable.hot.concat(lookupTable.cold) - : date.getTime() < coldThresholdTimestamp - ? lookupTable.cold - : lookupTable.hot; + ? lookupTable.hot.concat(lookupTable.cold) + : date.getTime() < coldThresholdTimestamp + ? lookupTable.cold + : lookupTable.hot; const computeRelativeAge = (date: Date, lookup: number[]) => { const time = date.getTime(); diff --git a/src/annotations/gutterChangesAnnotationProvider.ts b/src/annotations/gutterChangesAnnotationProvider.ts index 7423157..5ce7927 100644 --- a/src/annotations/gutterChangesAnnotationProvider.ts +++ b/src/annotations/gutterChangesAnnotationProvider.ts @@ -211,8 +211,8 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase { useForceIfIncludes ? ' (with lease and if includes)' : useForceWithLease - ? ' (with lease)' - : '' + ? ' (with lease)' + : '' }`, description: `--force${ useForceWithLease @@ -254,8 +254,8 @@ export class PushGitCommand extends QuickCommand { useForceIfIncludes ? ' (with lease and if includes)' : useForceWithLease - ? ' (with lease)' - : '' + ? ' (with lease)' + : '' } ${branch?.state.ahead ? ` ${pluralize('commit', branch.state.ahead)}` : ''}${ branch.getRemoteName() ? ` to ${branch.getRemoteName()}` : '' }${ @@ -406,8 +406,8 @@ export class PushGitCommand extends QuickCommand { useForceIfIncludes ? ' (with lease and if includes)' : useForceWithLease - ? ' (with lease)' - : '' + ? ' (with lease)' + : '' }`, description: `--force${ useForceWithLease @@ -418,8 +418,8 @@ export class PushGitCommand extends QuickCommand { useForceIfIncludes ? ' (with lease and if includes)' : useForceWithLease - ? ' (with lease)' - : '' + ? ' (with lease)' + : '' } ${pushDetails}${ status != null && status.state.behind > 0 ? `, overwriting ${pluralize('commit', status.state.behind)}${ diff --git a/src/commands/quickCommand.ts b/src/commands/quickCommand.ts index d4c6bd3..91a3714 100644 --- a/src/commands/quickCommand.ts +++ b/src/commands/quickCommand.ts @@ -88,10 +88,10 @@ export type StepGenerator = export type StepItemType = T extends CustomStep ? U : T extends QuickPickStep - ? U[] - : T extends QuickInputStep - ? string - : never; + ? U[] + : T extends QuickInputStep + ? string + : never; export type StepNavigationKeys = Exclude; export const StepResultBreak = Symbol('BreakStep'); export type StepResult = typeof StepResultBreak | T; @@ -112,10 +112,10 @@ export type AsyncStepResultGenerator = AsyncGenerator< export type StepSelection = T extends CustomStep ? U | Directive : T extends QuickPickStep - ? U[] | Directive - : T extends QuickInputStep - ? string | Directive - : never; + ? U[] | Directive + : T extends QuickInputStep + ? string | Directive + : never; export type PartialStepState = Partial & { counter: number; confirm?: boolean; startingStep?: number }; export type StepState> = T & { counter: number; confirm?: boolean; startingStep?: number }; diff --git a/src/errors.ts b/src/errors.ts index 173b4cf..143ec67 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -192,8 +192,8 @@ export class ProviderNotFoundError extends Error { pathOrUri == null ? String(pathOrUri) : typeof pathOrUri === 'string' - ? pathOrUri - : pathOrUri.toString(true) + ? pathOrUri + : pathOrUri.toString(true) }'`, ); diff --git a/src/extension.ts b/src/extension.ts index c6553c6..d40e64c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -273,8 +273,8 @@ function registerBuiltInActionRunners(container: Container): void { compare: ctx.branch.isRemote ? getBranchNameWithoutRemote(ctx.branch.name) : ctx.branch.upstream - ? getBranchNameWithoutRemote(ctx.branch.upstream) - : ctx.branch.name, + ? getBranchNameWithoutRemote(ctx.branch.upstream) + : ctx.branch.name, remote: ctx.remote?.name ?? '', repoPath: ctx.repoPath, })); diff --git a/src/plus/github/github.ts b/src/plus/github/github.ts index e2aaae4..38f70a2 100644 --- a/src/plus/github/github.ts +++ b/src/plus/github/github.ts @@ -298,14 +298,14 @@ export class GitHubApi implements Disposable { !author.avatarUrl || isGitHubDotCom(options) ? author.avatarUrl ?? undefined : author.email && options?.baseUrl != null - ? await this.createEnterpriseAvatarUrl( - provider, - token, - options.baseUrl, - author.email, - options.avatarSize, - ) - : undefined, + ? await this.createEnterpriseAvatarUrl( + provider, + token, + options.baseUrl, + author.email, + options.avatarSize, + ) + : undefined, }; } catch (ex) { if (ex instanceof ProviderRequestNotFoundError) return undefined; @@ -385,14 +385,14 @@ export class GitHubApi implements Disposable { !author.avatarUrl || isGitHubDotCom(options) ? author.avatarUrl ?? undefined : author.email && options?.baseUrl != null - ? await this.createEnterpriseAvatarUrl( - provider, - token, - options.baseUrl, - author.email, - options.avatarSize, - ) - : undefined, + ? await this.createEnterpriseAvatarUrl( + provider, + token, + options.baseUrl, + author.email, + options.avatarSize, + ) + : undefined, }; } catch (ex) { if (ex instanceof ProviderRequestNotFoundError) return undefined; diff --git a/src/plus/github/githubGitProvider.ts b/src/plus/github/githubGitProvider.ts index 5ee1466..3cc75f3 100644 --- a/src/plus/github/githubGitProvider.ts +++ b/src/plus/github/githubGitProvider.ts @@ -2924,8 +2924,8 @@ export class GitHubGitProvider implements GitProvider, Disposable { options?.ordering === 'date' ? 'committer-date' : options?.ordering === 'author-date' - ? 'author-date' - : undefined, + ? 'author-date' + : undefined, }); if (result == null) return undefined; @@ -3116,8 +3116,8 @@ export class GitHubGitProvider implements GitProvider, Disposable { options?.ordering === 'date' ? 'committer-date' : options?.ordering === 'author-date' - ? 'author-date' - : undefined, + ? 'author-date' + : undefined, }); if (result == null || options?.cancellation?.isCancellationRequested) { diff --git a/src/plus/gk/checkin.ts b/src/plus/gk/checkin.ts index 9a5b4d6..73d2814 100644 --- a/src/plus/gk/checkin.ts +++ b/src/plus/gk/checkin.ts @@ -90,8 +90,8 @@ export function getSubscriptionFromCheckIn(data: GKCheckInResponse): Partial> = P extends `${infer Key}.${infer Re : never : never : P extends keyof T - ? T[P] - : never; + ? T[P] + : never; export type ConfigPath = Path; export type ConfigPathValue

= PathValue; diff --git a/src/system/serialize.ts b/src/system/serialize.ts index 151cbf1..7cec955 100644 --- a/src/system/serialize.ts +++ b/src/system/serialize.ts @@ -3,16 +3,16 @@ import type { Branded } from './brand'; export type Serialized = T extends Function ? never : T extends Date - ? number - : T extends Branded - ? U - : T extends any[] - ? Serialized[] - : T extends object - ? { - [K in keyof T]: T[K] extends Date ? number : Serialized; - } - : T; + ? number + : T extends Branded + ? U + : T extends any[] + ? Serialized[] + : T extends object + ? { + [K in keyof T]: T[K] extends Date ? number : Serialized; + } + : T; export function serialize(obj: T): Serialized; export function serialize(obj: T | undefined): Serialized | undefined; diff --git a/src/views/nodes/abstract/viewNode.ts b/src/views/nodes/abstract/viewNode.ts index 3a4d74e..7d366d2 100644 --- a/src/views/nodes/abstract/viewNode.ts +++ b/src/views/nodes/abstract/viewNode.ts @@ -370,40 +370,40 @@ type TreeViewNodesByType = { [T in TreeViewNodeTypes]: T extends 'branch' ? BranchNode : T extends 'commit' - ? CommitNode - : T extends 'commit-file' - ? CommitFileNode - : T extends 'compare-branch' - ? CompareBranchNode - : T extends 'compare-results' - ? CompareResultsNode - : T extends 'conflict-file' - ? MergeConflictFileNode - : T extends 'file-commit' - ? FileRevisionAsCommitNode - : T extends 'folder' - ? FolderNode - : T extends 'line-history-tracker' - ? LineHistoryTrackerNode - : T extends 'repository' - ? RepositoryNode - : T extends 'repo-folder' - ? RepositoryFolderNode - : T extends 'results-commits' - ? ResultsCommitsNode - : T extends 'results-file' - ? ResultsFileNode - : T extends 'stash' - ? StashNode - : T extends 'stash-file' - ? StashFileNode - : T extends 'status-file' - ? StatusFileNode - : T extends 'tag' - ? TagNode - : T extends 'uncommitted-file' - ? UncommittedFileNode - : ViewNode; + ? CommitNode + : T extends 'commit-file' + ? CommitFileNode + : T extends 'compare-branch' + ? CompareBranchNode + : T extends 'compare-results' + ? CompareResultsNode + : T extends 'conflict-file' + ? MergeConflictFileNode + : T extends 'file-commit' + ? FileRevisionAsCommitNode + : T extends 'folder' + ? FolderNode + : T extends 'line-history-tracker' + ? LineHistoryTrackerNode + : T extends 'repository' + ? RepositoryNode + : T extends 'repo-folder' + ? RepositoryFolderNode + : T extends 'results-commits' + ? ResultsCommitsNode + : T extends 'results-file' + ? ResultsFileNode + : T extends 'stash' + ? StashNode + : T extends 'stash-file' + ? StashFileNode + : T extends 'status-file' + ? StatusFileNode + : T extends 'tag' + ? TagNode + : T extends 'uncommitted-file' + ? UncommittedFileNode + : ViewNode; }; export function isViewNode(node: unknown): node is ViewNode; diff --git a/src/views/nodes/autolinkedItemNode.ts b/src/views/nodes/autolinkedItemNode.ts index 6a8be01..4783556 100644 --- a/src/views/nodes/autolinkedItemNode.ts +++ b/src/views/nodes/autolinkedItemNode.ts @@ -56,10 +56,10 @@ export class AutolinkedItemNode extends ViewNode<'autolink', ViewsWithCommits> { pending ? 'loading~spin' : autolink.type == null - ? 'link' - : autolink.type === 'pullrequest' - ? 'git-pull-request' - : 'issues', + ? 'link' + : autolink.type === 'pullrequest' + ? 'git-pull-request' + : 'issues', ); item.contextValue = ContextValues.AutolinkedItem; item.tooltip = new MarkdownString( @@ -70,8 +70,8 @@ export class AutolinkedItemNode extends ViewNode<'autolink', ViewsWithCommits> { autolink.type == null ? 'Autolinked' : autolink.type === 'pullrequest' - ? 'Autolinked Pull Request' - : 'Autolinked Issue' + ? 'Autolinked Pull Request' + : 'Autolinked Issue' } ${autolink.prefix}${autolink.id}` } \\\n[${autolink.url}](${autolink.url}${autolink.title != null ? ` "${autolink.title}"` : ''})`, ); diff --git a/src/views/nodes/branchNode.ts b/src/views/nodes/branchNode.ts index f32a1b9..56b690e 100644 --- a/src/views/nodes/branchNode.ts +++ b/src/views/nodes/branchNode.ts @@ -500,11 +500,15 @@ export class BranchNode pendingPullRequest != null ? new ThemeIcon('loading~spin') : this.options.showAsCommits - ? new ThemeIcon('git-commit', color) - : { - dark: this.view.container.context.asAbsolutePath(`images/dark/icon-branch${iconSuffix}.svg`), - light: this.view.container.context.asAbsolutePath(`images/light/icon-branch${iconSuffix}.svg`), - }; + ? new ThemeIcon('git-commit', color) + : { + dark: this.view.container.context.asAbsolutePath( + `images/dark/icon-branch${iconSuffix}.svg`, + ), + light: this.view.container.context.asAbsolutePath( + `images/light/icon-branch${iconSuffix}.svg`, + ), + }; item.tooltip = tooltip; item.resourceUri = Uri.parse( `gitlens-view://branch/status/${await this.branch.getStatus()}${ diff --git a/src/views/nodes/commitNode.ts b/src/views/nodes/commitNode.ts index 95d27f9..70b35b5 100644 --- a/src/views/nodes/commitNode.ts +++ b/src/views/nodes/commitNode.ts @@ -188,10 +188,10 @@ export class CommitNode extends ViewRefNode<'commit', ViewsWithCommits | FileHis pendingPullRequest != null ? new ThemeIcon('loading~spin') : this.unpublished - ? new ThemeIcon('arrow-up', new ThemeColor('gitlens.unpublishedCommitIconColor' satisfies Colors)) - : this.view.config.avatars - ? await this.commit.getAvatarUri({ defaultStyle: configuration.get('defaultGravatarsStyle') }) - : undefined; + ? new ThemeIcon('arrow-up', new ThemeColor('gitlens.unpublishedCommitIconColor' satisfies Colors)) + : this.view.config.avatars + ? await this.commit.getAvatarUri({ defaultStyle: configuration.get('defaultGravatarsStyle') }) + : undefined; // item.tooltip = this.tooltip; return item; diff --git a/src/views/nodes/fileHistoryNode.ts b/src/views/nodes/fileHistoryNode.ts index a0b2147..3df1d11 100644 --- a/src/views/nodes/fileHistoryNode.ts +++ b/src/views/nodes/fileHistoryNode.ts @@ -129,12 +129,12 @@ export class FileHistoryNode }, ) : c.file != null - ? new FileRevisionAsCommitNode(this.view, this, c.file, c, { - branch: this.branch, - getBranchAndTagTips: getBranchAndTagTips, - unpublished: unpublishedCommits?.has(c.ref), - }) - : undefined, + ? new FileRevisionAsCommitNode(this.view, this, c.file, c, { + branch: this.branch, + getBranchAndTagTips: getBranchAndTagTips, + unpublished: unpublishedCommits?.has(c.ref), + }) + : undefined, ), this, ), diff --git a/src/views/nodes/fileRevisionAsCommitNode.ts b/src/views/nodes/fileRevisionAsCommitNode.ts index 96afcdd..c5bcecb 100644 --- a/src/views/nodes/fileRevisionAsCommitNode.ts +++ b/src/views/nodes/fileRevisionAsCommitNode.ts @@ -139,8 +139,8 @@ export class FileRevisionAsCommitNode extends ViewRefFileNode< return this.commit.file?.hasConflicts ? `${ContextValues.File}+conflicted` : this.commit.isUncommittedStaged - ? `${ContextValues.File}+staged` - : `${ContextValues.File}+unstaged`; + ? `${ContextValues.File}+staged` + : `${ContextValues.File}+unstaged`; } override getCommand(): Command | undefined { diff --git a/src/views/nodes/remoteNode.ts b/src/views/nodes/remoteNode.ts index f3c4aad..4eeec86 100644 --- a/src/views/nodes/remoteNode.ts +++ b/src/views/nodes/remoteNode.ts @@ -92,11 +92,15 @@ export class RemoteNode extends ViewNode<'remote', ViewsWithRemotes> { provider.avatarUri != null && this.view.config.avatars ? provider.avatarUri : provider.icon === 'remote' - ? new ThemeIcon('cloud') - : { - dark: this.view.container.context.asAbsolutePath(`images/dark/icon-${provider.icon}.svg`), - light: this.view.container.context.asAbsolutePath(`images/light/icon-${provider.icon}.svg`), - }; + ? new ThemeIcon('cloud') + : { + dark: this.view.container.context.asAbsolutePath( + `images/dark/icon-${provider.icon}.svg`, + ), + light: this.view.container.context.asAbsolutePath( + `images/light/icon-${provider.icon}.svg`, + ), + }; if (provider.hasRichIntegration()) { const connected = provider.maybeConnected ?? (await provider.isConnected()); diff --git a/src/views/nodes/resultsCommitsNode.ts b/src/views/nodes/resultsCommitsNode.ts index ba866a4..3b34901 100644 --- a/src/views/nodes/resultsCommitsNode.ts +++ b/src/views/nodes/resultsCommitsNode.ts @@ -156,8 +156,8 @@ export class ResultsCommitsNode { diff --git a/src/views/nodes/resultsFilesNode.ts b/src/views/nodes/resultsFilesNode.ts index 309e34f..627516f 100644 --- a/src/views/nodes/resultsFilesNode.ts +++ b/src/views/nodes/resultsFilesNode.ts @@ -156,8 +156,8 @@ export class ResultsFilesNode extends ViewNode<'results-files', ViewsWithCommits files == null || files.length === 0 ? TreeItemCollapsibleState.None : this._options.expand - ? TreeItemCollapsibleState.Expanded - : TreeItemCollapsibleState.Collapsed; + ? TreeItemCollapsibleState.Expanded + : TreeItemCollapsibleState.Collapsed; } } catch (ex) { if (ex instanceof PromiseCancelledError) { diff --git a/src/views/nodes/worktreeNode.ts b/src/views/nodes/worktreeNode.ts index 99459f9..85a15fc 100644 --- a/src/views/nodes/worktreeNode.ts +++ b/src/views/nodes/worktreeNode.ts @@ -202,8 +202,8 @@ export class WorktreeNode extends CacheableChildrenViewNode<'worktree', ViewsWit this.worktree.main ? `_Main${this.worktree.opened ? ', Active_' : '_'}` : this.worktree.opened - ? '_Active_' - : '' + ? '_Active_' + : '' } ` : ''; @@ -367,14 +367,14 @@ export class WorktreeNode extends CacheableChildrenViewNode<'worktree', ViewsWit pendingPullRequest != null ? new ThemeIcon('loading~spin') : this.worktree.opened - ? new ThemeIcon('check') - : icon; + ? new ThemeIcon('check') + : icon; item.tooltip = tooltip; item.resourceUri = missing ? Uri.parse('gitlens-view://worktree/missing') : hasChanges - ? Uri.parse('gitlens-view://worktree/changes') - : undefined; + ? Uri.parse('gitlens-view://worktree/changes') + : undefined; return item; } diff --git a/src/views/viewCommands.ts b/src/views/viewCommands.ts index 962c513..91ec006 100644 --- a/src/views/viewCommands.ts +++ b/src/views/viewCommands.ts @@ -417,8 +417,8 @@ export class ViewCommands { node instanceof ViewRefNode || node instanceof ViewRefFileNode ? node?.ref : node instanceof BranchTrackingStatusNode - ? node.branch - : undefined; + ? node.branch + : undefined; if (from == null) { const branch = await this.container.git.getBranch( node?.repoPath ?? this.container.git.getBestRepository()?.uri, @@ -467,8 +467,8 @@ export class ViewCommands { node instanceof ViewRefNode || node instanceof ViewRefFileNode ? node?.ref : node instanceof BranchTrackingStatusNode - ? node.branch - : undefined; + ? node.branch + : undefined; if (from == null) { const branch = await this.container.git.getBranch( node?.repoPath ?? this.container.git.getBestRepository()?.uri, diff --git a/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts b/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts index 39c6ac5..61a39f2 100644 --- a/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts +++ b/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts @@ -264,8 +264,8 @@ export class GkPullRequestRow extends LitElement { aria-label="${this.isCurrentBranch ? 'Already on this branch' : this.hasWorktree - ? 'This branch has a worktree' - : 'Switch to Branch...'}" + ? 'This branch has a worktree' + : 'Switch to Branch...'}" @click="${this.onSwitchBranchClick}" > @@ -273,8 +273,8 @@ export class GkPullRequestRow extends LitElement { >${this.isCurrentBranch ? 'Already on this branch' : this.hasWorktree - ? 'This branch has a worktree' - : 'Switch to Branch...'} diff --git a/src/webviews/apps/plus/timeline/chart.ts b/src/webviews/apps/plus/timeline/chart.ts index 3f5195e..2589b73 100644 --- a/src/webviews/apps/plus/timeline/chart.ts +++ b/src/webviews/apps/plus/timeline/chart.ts @@ -339,8 +339,8 @@ export class TimelineChart implements Disposable { this.compact ? '' : typeof x === 'number' - ? x - : formatDate(x, this._shortDateFormat ?? 'short'), + ? x + : formatDate(x, this._shortDateFormat ?? 'short'), multiline: false, show: false, outer: !this.compact, diff --git a/src/webviews/apps/shared/components/list/file-change-list-item.ts b/src/webviews/apps/shared/components/list/file-change-list-item.ts index faa390e..a246d19 100644 --- a/src/webviews/apps/shared/components/list/file-change-list-item.ts +++ b/src/webviews/apps/shared/components/list/file-change-list-item.ts @@ -169,40 +169,40 @@ export class FileChangeListItem extends LitElement { ` : !this.uncommitted - ? html` - - - - ${this.stash - ? nothing - : html` - - - - - - - `} - ` - : nothing} + ? html` + + + + ${this.stash + ? nothing + : html` + + + + + + + `} + ` + : nothing} `; diff --git a/src/webviews/webviewController.ts b/src/webviews/webviewController.ts index 93789f9..d4c6702 100644 --- a/src/webviews/webviewController.ts +++ b/src/webviews/webviewController.ts @@ -40,8 +40,8 @@ function nextIpcId() { type GetParentType = T extends WebviewPanelDescriptor ? WebviewPanel : T extends WebviewViewDescriptor - ? WebviewView - : never; + ? WebviewView + : never; export type WebviewShowingArgs = T | [{ state: Partial }] | [];