Browse Source

💄prettiers

main
Eric Amodio 1 year ago
parent
commit
fbccf2428f
28 changed files with 190 additions and 186 deletions
  1. +0
    -4
      .prettierrc
  2. +4
    -4
      src/annotations/blameAnnotationProvider.ts
  3. +2
    -2
      src/annotations/gutterChangesAnnotationProvider.ts
  4. +8
    -8
      src/commands/git/push.ts
  5. +8
    -8
      src/commands/quickCommand.ts
  6. +2
    -2
      src/errors.ts
  7. +2
    -2
      src/extension.ts
  8. +16
    -16
      src/plus/github/github.ts
  9. +4
    -4
      src/plus/github/githubGitProvider.ts
  10. +2
    -2
      src/plus/gk/checkin.ts
  11. +4
    -4
      src/quickpicks/referencePicker.ts
  12. +2
    -2
      src/system/configuration.ts
  13. +10
    -10
      src/system/serialize.ts
  14. +34
    -34
      src/views/nodes/abstract/viewNode.ts
  15. +6
    -6
      src/views/nodes/autolinkedItemNode.ts
  16. +9
    -5
      src/views/nodes/branchNode.ts
  17. +4
    -4
      src/views/nodes/commitNode.ts
  18. +6
    -6
      src/views/nodes/fileHistoryNode.ts
  19. +2
    -2
      src/views/nodes/fileRevisionAsCommitNode.ts
  20. +9
    -5
      src/views/nodes/remoteNode.ts
  21. +2
    -2
      src/views/nodes/resultsCommitsNode.ts
  22. +2
    -2
      src/views/nodes/resultsFilesNode.ts
  23. +6
    -6
      src/views/nodes/worktreeNode.ts
  24. +4
    -4
      src/views/viewCommands.ts
  25. +4
    -4
      src/webviews/apps/plus/focus/components/gk-pull-request-row.ts
  26. +2
    -2
      src/webviews/apps/plus/timeline/chart.ts
  27. +34
    -34
      src/webviews/apps/shared/components/list/file-change-list-item.ts
  28. +2
    -2
      src/webviews/webviewController.ts

+ 0
- 4
.prettierrc View File

@ -14,10 +14,6 @@
{
"files": "*.md",
"options": { "tabWidth": 2 }
},
{
"files": "*.svg",
"options": { "parser": "html" }
}
]
}

+ 4
- 4
src/annotations/blameAnnotationProvider.ts View File

@ -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();

+ 2
- 2
src/annotations/gutterChangesAnnotationProvider.ts View File

@ -211,8 +211,8 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase
decorationType: (hunkLine.state === 'added'
? Decorations.changesLineAddedAnnotation
: hunkLine.state === 'removed'
? Decorations.changesLineDeletedAnnotation
: Decorations.changesLineChangedAnnotation)!,
? Decorations.changesLineDeletedAnnotation
: Decorations.changesLineChangedAnnotation)!,
rangesOrOptions: [{ range: range }],
};
decorationsMap.set(hunkLine.state, decoration);

+ 8
- 8
src/commands/git/push.ts View File

@ -242,8 +242,8 @@ export class PushGitCommand extends QuickCommand {
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)}${

+ 8
- 8
src/commands/quickCommand.ts View File

@ -88,10 +88,10 @@ export type StepGenerator =
export type StepItemType<T> = T extends CustomStep<infer U>
? U
: T extends QuickPickStep<infer U>
? U[]
: T extends QuickInputStep
? string
: never;
? U[]
: T extends QuickInputStep
? string
: never;
export type StepNavigationKeys = Exclude<Keys, 'left' | 'alt+left' | 'ctrl+left'>;
export const StepResultBreak = Symbol('BreakStep');
export type StepResult<T> = typeof StepResultBreak | T;
@ -112,10 +112,10 @@ export type AsyncStepResultGenerator = AsyncGenerator<
export type StepSelection<T> = T extends CustomStep<infer U>
? U | Directive
: T extends QuickPickStep<infer U>
? U[] | Directive
: T extends QuickInputStep
? string | Directive
: never;
? U[] | Directive
: T extends QuickInputStep
? string | Directive
: never;
export type PartialStepState<T = unknown> = Partial<T> & { counter: number; confirm?: boolean; startingStep?: number };
export type StepState<T = Record<string, unknown>> = T & { counter: number; confirm?: boolean; startingStep?: number };

+ 2
- 2
src/errors.ts View File

@ -192,8 +192,8 @@ export class ProviderNotFoundError extends Error {
pathOrUri == null
? String(pathOrUri)
: typeof pathOrUri === 'string'
? pathOrUri
: pathOrUri.toString(true)
? pathOrUri
: pathOrUri.toString(true)
}'`,
);

+ 2
- 2
src/extension.ts View File

@ -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,
}));

+ 16
- 16
src/plus/github/github.ts View File

@ -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;

+ 4
- 4
src/plus/github/githubGitProvider.ts View File

@ -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) {

+ 2
- 2
src/plus/gk/checkin.ts View File

@ -90,8 +90,8 @@ export function getSubscriptionFromCheckIn(data: GKCheckInResponse): Partial
data.user.firstGitLensCheckIn != null
? new Date(data.user.firstGitLensCheckIn)
: data.user.createdDate != null
? new Date(data.user.createdDate)
: undefined,
? new Date(data.user.createdDate)
: undefined,
);
}

+ 4
- 4
src/quickpicks/referencePicker.ts View File

@ -173,10 +173,10 @@ async function getItems(
include && ReferencesQuickPickIncludes.BranchesAndTags
? ['branches', 'tags']
: include && ReferencesQuickPickIncludes.Branches
? ['branches']
: include && ReferencesQuickPickIncludes.Tags
? ['tags']
: [],
? ['branches']
: include && ReferencesQuickPickIncludes.Tags
? ['tags']
: [],
{
buttons: [RevealInSideBarQuickInputButton],
filter: filter,

+ 2
- 2
src/system/configuration.ts View File

@ -338,8 +338,8 @@ export type PathValue> = P extends `${infer Key}.${infer Re
: never
: never
: P extends keyof T
? T[P]
: never;
? T[P]
: never;
export type ConfigPath = Path<Config>;
export type ConfigPathValue<P extends ConfigPath> = PathValue<Config, P>;

+ 10
- 10
src/system/serialize.ts View File

@ -3,16 +3,16 @@ import type { Branded } from './brand';
export type Serialized<T> = T extends Function
? never
: T extends Date
? number
: T extends Branded<infer U, any>
? U
: T extends any[]
? Serialized<T[number]>[]
: T extends object
? {
[K in keyof T]: T[K] extends Date ? number : Serialized<T[K]>;
}
: T;
? number
: T extends Branded<infer U, any>
? U
: T extends any[]
? Serialized<T[number]>[]
: T extends object
? {
[K in keyof T]: T[K] extends Date ? number : Serialized<T[K]>;
}
: T;
export function serialize<T extends object>(obj: T): Serialized<T>;
export function serialize<T extends object>(obj: T | undefined): Serialized<T> | undefined;

+ 34
- 34
src/views/nodes/abstract/viewNode.ts View File

@ -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<T>;
? 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<T>;
};
export function isViewNode(node: unknown): node is ViewNode;

+ 6
- 6
src/views/nodes/autolinkedItemNode.ts View File

@ -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}"` : ''})`,
);

+ 9
- 5
src/views/nodes/branchNode.ts View File

@ -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()}${

+ 4
- 4
src/views/nodes/commitNode.ts View File

@ -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;

+ 6
- 6
src/views/nodes/fileHistoryNode.ts View File

@ -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,
),

+ 2
- 2
src/views/nodes/fileRevisionAsCommitNode.ts View File

@ -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 {

+ 9
- 5
src/views/nodes/remoteNode.ts View File

@ -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());

+ 2
- 2
src/views/nodes/resultsCommitsNode.ts View File

@ -156,8 +156,8 @@ export class ResultsCommitsNode
log == null || log.count === 0
? TreeItemCollapsibleState.None
: this._options.expand || log.count === 1
? TreeItemCollapsibleState.Expanded
: TreeItemCollapsibleState.Collapsed;
? TreeItemCollapsibleState.Expanded
: TreeItemCollapsibleState.Collapsed;
} catch (ex) {
if (ex instanceof PromiseCancelledError) {
setTimeout(async () => {

+ 2
- 2
src/views/nodes/resultsFilesNode.ts View File

@ -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) {

+ 6
- 6
src/views/nodes/worktreeNode.ts View File

@ -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;
}

+ 4
- 4
src/views/viewCommands.ts View File

@ -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,

+ 4
- 4
src/webviews/apps/plus/focus/components/gk-pull-request-row.ts View File

@ -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}"
><code-icon icon="gl-switch"></code-icon
></a>
@ -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...'}</span
? 'This branch has a worktree'
: 'Switch to Branch...'}</span
>
</gk-tooltip>
</nav>

+ 2
- 2
src/webviews/apps/plus/timeline/chart.ts View File

@ -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,

+ 34
- 34
src/webviews/apps/shared/components/list/file-change-list-item.ts View File

@ -169,40 +169,40 @@ export class FileChangeListItem extends LitElement {
</a>
`
: !this.uncommitted
? html`
<a
class="change-list__action"
@click=${this.onCompareWorking}
href="#"
title="Open Changes with Working File"
aria-label="Open Changes with Working File"
>
<code-icon icon="git-compare"></code-icon>
</a>
${this.stash
? nothing
: html`
<a
class="change-list__action"
@click=${this.onOpenFileOnRemote}
href="#"
title="Open on remote"
aria-label="Open on remote"
>
<code-icon icon="globe"></code-icon>
</a>
<a
class="change-list__action"
@click=${this.onMoreActions}
href="#"
title="Show more actions"
aria-label="Show more actions"
>
<code-icon icon="ellipsis"></code-icon>
</a>
`}
`
: nothing}
? html`
<a
class="change-list__action"
@click=${this.onCompareWorking}
href="#"
title="Open Changes with Working File"
aria-label="Open Changes with Working File"
>
<code-icon icon="git-compare"></code-icon>
</a>
${this.stash
? nothing
: html`
<a
class="change-list__action"
@click=${this.onOpenFileOnRemote}
href="#"
title="Open on remote"
aria-label="Open on remote"
>
<code-icon icon="globe"></code-icon>
</a>
<a
class="change-list__action"
@click=${this.onMoreActions}
href="#"
title="Show more actions"
aria-label="Show more actions"
>
<code-icon icon="ellipsis"></code-icon>
</a>
`}
`
: nothing}
</span>
</list-item>
`;

+ 2
- 2
src/webviews/webviewController.ts View File

@ -40,8 +40,8 @@ function nextIpcId() {
type GetParentType<T extends WebviewPanelDescriptor | WebviewViewDescriptor> = T extends WebviewPanelDescriptor
? WebviewPanel
: T extends WebviewViewDescriptor
? WebviewView
: never;
? WebviewView
: never;
export type WebviewShowingArgs<T extends unknown[], SerializedState> = T | [{ state: Partial<SerializedState> }] | [];

Loading…
Cancel
Save