1
0
mirror of https://github.com/desktop/desktop synced 2024-07-02 15:48:39 +00:00

Merge pull request #14205 from desktop/looks-isnt-everything-tho

Upgrade to Prettier 2.6.0
This commit is contained in:
Markus Olsson 2022-03-21 13:48:55 +00:00 committed by GitHub
commit caf39fee98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
87 changed files with 569 additions and 919 deletions

View File

@ -4,7 +4,8 @@ export const TimestampRegex = /^.{27}Z /gm
export const BrightClassPostfix = '-br'
// export for testing
// match characters that could be enclosing url to cleanly handle url formatting
export const UrlRegex = /([{(<[]*https?:\/\/[a-z0-9][a-z0-9-]*[a-z0-9]\.[^\s<>|'"]{2,})/gi
export const UrlRegex =
/([{(<[]*https?:\/\/[a-z0-9][a-z0-9-]*[a-z0-9]\.[^\s<>|'"]{2,})/gi
/**
* Regex for matching ANSII escape codes
@ -16,7 +17,8 @@ export const UrlRegex = /([{(<[]*https?:\/\/[a-z0-9][a-z0-9-]*[a-z0-9]\.[^\s<>|'
* (?:(?:;[0-9]{0,3})*)?: Match one or more occurrences of the format we want with semicolon
*/
// eslint-disable-next-line no-control-regex
export const _ansiEscapeCodeRegex = /(?:\u001b\[)(?:[?|#])?(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-Z|a-z])/
export const _ansiEscapeCodeRegex =
/(?:\u001b\[)(?:[?|#])?(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-Z|a-z])/
/**
* http://ascii-table.com/ansi-escape-sequences.php

View File

@ -779,9 +779,7 @@ export class API {
}
/** Fetch all repos a user has access to. */
public async fetchRepositories(): Promise<ReadonlyArray<
IAPIRepository
> | null> {
public async fetchRepositories(): Promise<ReadonlyArray<IAPIRepository> | null> {
try {
const repositories = await this.fetchAll<IAPIRepository>('user/repos')
// "But wait, repositories can't have a null owner" you say.

View File

@ -130,13 +130,12 @@ function checkConstraint(
* Note: NOT meant for direct consumption, only exported for testability reasons.
* Consumers should use the various `supports*` methods instead.
*/
export const endpointSatisfies = (
{ dotcom, ae, es }: VersionConstraint,
getVersion = getEndpointVersion
) => (ep: string) =>
checkConstraint(dotcom, isDotCom(ep)) ||
checkConstraint(ae, isGHAE(ep), assumedGHAEVersion) ||
checkConstraint(es, isGHES(ep), getVersion(ep) ?? assumedGHESVersion)
export const endpointSatisfies =
({ dotcom, ae, es }: VersionConstraint, getVersion = getEndpointVersion) =>
(ep: string) =>
checkConstraint(dotcom, isDotCom(ep)) ||
checkConstraint(ae, isGHAE(ep), assumedGHAEVersion) ||
checkConstraint(es, isGHES(ep), getVersion(ep) ?? assumedGHESVersion)
/**
* Whether or not the endpoint supports the internal GitHub Enterprise Server

View File

@ -28,24 +28,22 @@ export function match<T>(
// matching `query` against itself is a perfect match.
const maxScore = score(query, query, 1)
const result = items
.map(
(item): IMatch<T> => {
const matches: Array<ReadonlyArray<number>> = []
const itemTextArray = getKey(item)
itemTextArray.forEach(text => {
matches.push(fuzzAldrin.match(text, query))
})
.map((item): IMatch<T> => {
const matches: Array<ReadonlyArray<number>> = []
const itemTextArray = getKey(item)
itemTextArray.forEach(text => {
matches.push(fuzzAldrin.match(text, query))
})
return {
score: score(itemTextArray.join(''), query, maxScore),
item,
matches: {
title: matches[0],
subtitle: matches.length > 1 ? matches[1] : [],
},
}
return {
score: score(itemTextArray.join(''), query, maxScore),
item,
matches: {
title: matches[0],
subtitle: matches.length > 1 ? matches[1] : [],
},
}
)
})
.filter(
({ matches }) => matches.title.length > 0 || matches.subtitle.length > 0
)

View File

@ -323,7 +323,8 @@ function getMediaType(extension: string) {
* about to `stderr` - this rule here will catch this and also the to/from
* changes based on what the user has configured.
*/
const lineEndingsChangeRegex = /warning: (CRLF|CR|LF) will be replaced by (CRLF|CR|LF) in .*/
const lineEndingsChangeRegex =
/warning: (CRLF|CR|LF) will be replaced by (CRLF|CR|LF) in .*/
/**
* Utility function for inspecting the stderr output for the line endings

View File

@ -201,9 +201,10 @@ export async function getChangedFiles(
}
}
function parseChangedFilesNumStat(
stdout: string
): { linesAdded: number; linesDeleted: number } {
function parseChangedFilesNumStat(stdout: string): {
linesAdded: number
linesDeleted: number
} {
const lines = stdout.split('\0')
let totalLinesAdded = 0
let totalLinesDeleted = 0

View File

@ -140,9 +140,7 @@ export async function getRebaseInternalState(
* - when a `git pull --rebase` was run and encounters conflicts
*
*/
export async function getRebaseSnapshot(
repository: Repository
): Promise<{
export async function getRebaseSnapshot(repository: Repository): Promise<{
progress: IMultiCommitOperationProgress
commits: ReadonlyArray<CommitOneLine>
} | null> {

View File

@ -59,7 +59,8 @@ export function escapeRegExp(expression: string) {
* example return [ "LargeFile.exe (150.00 MB)", "AlsoTooLargeOfAFile.txt (1.00 GB)" ]
*/
export function getFileFromExceedsError(error: string): string[] {
const endRegex = /(;\sthis\sexceeds\sGitHub's\sfile\ssize\slimit\sof\s100.00\sMB)/gm
const endRegex =
/(;\sthis\sexceeds\sGitHub's\sfile\ssize\slimit\sof\s100.00\sMB)/gm
const beginRegex = /(^remote:\serror:\sFile\s)/gm
const beginMatches = Array.from(error.matchAll(beginRegex))
const endMatches = Array.from(error.matchAll(endRegex))

View File

@ -108,8 +108,6 @@ export type RequestResponseChannels = {
options: Electron.OpenDialogOptions
) => Promise<string | null>
'is-window-maximized': () => Promise<boolean>
'get-apple-action-on-double-click': () => Promise<
Electron.AppleActionOnDoubleClickPref
>
'get-apple-action-on-double-click': () => Promise<Electron.AppleActionOnDoubleClickPref>
'should-use-dark-colors': () => Promise<boolean>
}

View File

@ -38,12 +38,14 @@ export class IssueMentionFilter implements INodeFilter {
/** A regular expression to match a group of an repo name or name with owner
* Example: desktop/dugite or desktop
*/
private readonly ownerOrOwnerRepo = /(?<ownerOrOwnerRepo>\w+(?:-\w+)*(?:\/[.\w-]+)?)/
private readonly ownerOrOwnerRepo =
/(?<ownerOrOwnerRepo>\w+(?:-\w+)*(?:\/[.\w-]+)?)/
/** A regular expression to match a group possible of preceding markers are
* gh-, #, /issues/, /pull/, or /discussions/ followed by a digit
*/
private readonly marker = /(?<marker>#|gh-|\/(?:issues|pull|discussions)\/)(?=\d)/i
private readonly marker =
/(?<marker>#|gh-|\/(?:issues|pull|discussions)\/)(?=\d)/i
/**
* A regular expression string of a lookbehind is used so that valid matches

View File

@ -24,7 +24,8 @@ export class MentionFilter implements INodeFilter {
private readonly beginStringNonWord = /(^|[^a-zA-Z0-9_`])/
// @username and @username_emu for enterprise managed users support
private readonly userNameRef = /(?<userNameRef>@[a-z0-9][a-z0-9-]*_[a-zA-Z0-9]+|@[a-z0-9][a-z0-9-]*)/
private readonly userNameRef =
/(?<userNameRef>@[a-z0-9][a-z0-9-]*_[a-zA-Z0-9]+|@[a-z0-9][a-z0-9-]*)/
// without a trailing slash
private readonly withoutTrailingSlash = /(?!\/)/

View File

@ -75,7 +75,8 @@ function updateCurrentMergeEntry(
// The first line for each entry is what I'm referring to as the the header
// This regex filters on the known entries that can appear
const contextHeaderRe = /^(merged|added in remote|removed in remote|changed in both|removed in local|added in both)$/
const contextHeaderRe =
/^(merged|added in remote|removed in remote|changed in both|removed in local|added in both)$/
// the rest of the header is made up of a number of entries formatted like this
//
@ -83,7 +84,8 @@ const contextHeaderRe = /^(merged|added in remote|removed in remote|changed in b
//
// this regex let's us extract the blob details - the filename may also change
// as part of the merge if files are moved or renamed
const blobEntryRe = /^\s{2}(result|our|their|base)\s+(\d{6})\s([0-9a-f]{40})\s(.+)$/
const blobEntryRe =
/^\s{2}(result|our|their|base)\s+(\d{6})\s([0-9a-f]{40})\s(.+)$/
/**
* Parse the Git output of a merge-tree command to identify whether it

View File

@ -16,12 +16,8 @@ export function getMultiCommitOperationChooseBranchStep(
state: IRepositoryState,
initialBranch?: Branch | null
): ChooseBranchStep {
const {
defaultBranch,
allBranches,
recentBranches,
tip,
} = state.branchesState
const { defaultBranch, allBranches, recentBranches, tip } =
state.branchesState
let currentBranch: Branch | null = null
if (tip.kind === TipState.Valid) {

View File

@ -2,7 +2,8 @@
// ASCII Control chars and space, DEL, ~ ^ : ? * [ \
// | " < and > is technically a valid refname but not on Windows
// the magic sequence @{, consecutive dots, leading and trailing dot, ref ending in .lock
const invalidCharacterRegex = /[\x00-\x20\x7F~^:?*\[\\|""<>]+|@{|\.\.+|^\.|\.$|\.lock$|\/$/g
const invalidCharacterRegex =
/[\x00-\x20\x7F~^:?*\[\\|""<>]+|@{|\.\.+|^\.|\.$|\.lock$|\/$/g
/** Sanitize a proposed reference name by replacing illegal characters. */
export function sanitizedRefName(name: string): string {

View File

@ -2,10 +2,12 @@
const squirrelMissingRegex = /^Can not find Squirrel$/
// an error that occurs when Squirrel isn't able to reach the update server
const squirrelDNSRegex = /System\.Net\.WebException: The remote name could not be resolved: 'central\.github\.com'/
const squirrelDNSRegex =
/System\.Net\.WebException: The remote name could not be resolved: 'central\.github\.com'/
// an error that occurs when the connection times out during updating
const squirrelTimeoutRegex = /A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond/
const squirrelTimeoutRegex =
/A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond/
/**
* This method parses known error messages from Squirrel.Windows and returns a

View File

@ -73,7 +73,8 @@ export async function getSSHEnvironment() {
}
export function parseAddSSHHostPrompt(prompt: string) {
const promptRegex = /^The authenticity of host '([^ ]+) \(([^\)]+)\)' can't be established[^.]*\.\n([^ ]+) key fingerprint is ([^.]+)\./
const promptRegex =
/^The authenticity of host '([^ ]+) \(([^\)]+)\)' can't be established[^.]*\.\n([^ ]+) key fingerprint is ([^.]+)\./
const matches = promptRegex.exec(prompt)
if (matches === null || matches.length < 5) {

View File

@ -610,9 +610,8 @@ export class StatsStore implements IStatsStore {
/** Calculate the average launch stats. */
private async getAverageLaunchStats(): Promise<ILaunchStats> {
const launches:
| ReadonlyArray<ILaunchStats>
| undefined = await this.db.launches.toArray()
const launches: ReadonlyArray<ILaunchStats> | undefined =
await this.db.launches.toArray()
if (!launches || !launches.length) {
return {
mainReadyTime: -1,
@ -645,9 +644,9 @@ export class StatsStore implements IStatsStore {
/** Get the daily measures. */
private async getDailyMeasures(): Promise<IDailyMeasures> {
const measures:
| IDailyMeasures
| undefined = await this.db.dailyMeasures.limit(1).first()
const measures: IDailyMeasures | undefined = await this.db.dailyMeasures
.limit(1)
.first()
return {
...DefaultDailyMeasures,
...measures,
@ -996,9 +995,7 @@ export class StatsStore implements IStatsStore {
/**
* Increments the `anyConflictsLeftOnMergeConflictsDialogDismissalCount` metric
*/
public recordAnyConflictsLeftOnMergeConflictsDialogDismissal(): Promise<
void
> {
public recordAnyConflictsLeftOnMergeConflictsDialogDismissal(): Promise<void> {
return this.updateDailyMeasures(m => ({
anyConflictsLeftOnMergeConflictsDialogDismissalCount:
m.anyConflictsLeftOnMergeConflictsDialogDismissalCount + 1,
@ -1222,9 +1219,7 @@ export class StatsStore implements IStatsStore {
* Record the number of times the user experiences the error
* "Some of your changes would be overwritten" when switching branches
*/
public recordErrorWhenSwitchingBranchesWithUncommmittedChanges(): Promise<
void
> {
public recordErrorWhenSwitchingBranchesWithUncommmittedChanges(): Promise<void> {
return this.updateDailyMeasures(m => ({
errorWhenSwitchingBranchesWithUncommmittedChanges:
m.errorWhenSwitchingBranchesWithUncommmittedChanges + 1,

View File

@ -91,7 +91,8 @@ export function parsePorcelainStatus(
}
// 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
const changedEntryRe = /^1 ([MADRCUTX?!.]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([\s\S]*?)$/
const changedEntryRe =
/^1 ([MADRCUTX?!.]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([\s\S]*?)$/
function parseChangedEntry(field: string): IStatusEntry {
const match = changedEntryRe.exec(field)
@ -105,7 +106,8 @@ function parseChangedEntry(field: string): IStatusEntry {
}
// 2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
const renamedOrCopiedEntryRe = /^2 ([MADRCUTX?!.]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([RC]\d+) ([\s\S]*?)$/
const renamedOrCopiedEntryRe =
/^2 ([MADRCUTX?!.]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([RC]\d+) ([\s\S]*?)$/
function parsedRenamedOrCopiedEntry(
field: string,
@ -128,7 +130,8 @@ function parsedRenamedOrCopiedEntry(
}
// u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
const unmergedEntryRe = /^u ([DAU]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([a-f0-9]+) ([\s\S]*?)$/
const unmergedEntryRe =
/^u ([DAU]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([a-f0-9]+) ([\s\S]*?)$/
function parseUnmergedEntry(field: string): IStatusEntry {
const match = unmergedEntryRe.exec(field)

View File

@ -40,10 +40,8 @@ interface IAliveEndpointSession {
export class AliveStore {
private readonly ALIVE_EVENT_RECEIVED_EVENT = 'alive-event-received'
private readonly sessionPerEndpoint: Map<
string,
IAliveEndpointSession
> = new Map()
private readonly sessionPerEndpoint: Map<string, IAliveEndpointSession> =
new Map()
private readonly emitter = new Emitter()
private subscriptions: Array<IAliveSubscription> = []
private enabled: boolean = false
@ -236,7 +234,7 @@ export class AliveStore {
return
}
const data = (event.data as any) as DesktopAliveEvent
const data = event.data as any as DesktopAliveEvent
if (data.type === 'pr-checks-failed') {
this.emitter.emit(this.ALIVE_EVENT_RECEIVED_EVENT, data)
}

View File

@ -421,14 +421,19 @@ export class AppStore extends TypedBaseStore<IAppState> {
private windowZoomFactor: number = 1
private isUpdateAvailableBannerVisible: boolean = false
private askToMoveToApplicationsFolderSetting: boolean = askToMoveToApplicationsFolderDefault
private askForConfirmationOnRepositoryRemoval: boolean = confirmRepoRemovalDefault
private askToMoveToApplicationsFolderSetting: boolean =
askToMoveToApplicationsFolderDefault
private askForConfirmationOnRepositoryRemoval: boolean =
confirmRepoRemovalDefault
private confirmDiscardChanges: boolean = confirmDiscardChangesDefault
private confirmDiscardChangesPermanently: boolean = confirmDiscardChangesPermanentlyDefault
private confirmDiscardChangesPermanently: boolean =
confirmDiscardChangesPermanentlyDefault
private askForConfirmationOnForcePush = askForConfirmationOnForcePushDefault
private imageDiffType: ImageDiffType = imageDiffTypeDefault
private hideWhitespaceInChangesDiff: boolean = hideWhitespaceInChangesDiffDefault
private hideWhitespaceInHistoryDiff: boolean = hideWhitespaceInHistoryDiffDefault
private hideWhitespaceInChangesDiff: boolean =
hideWhitespaceInChangesDiffDefault
private hideWhitespaceInHistoryDiff: boolean =
hideWhitespaceInHistoryDiffDefault
/** Whether or not the spellchecker is enabled for commit summary and description */
private commitSpellcheckEnabled: boolean = commitSpellcheckEnabledDefault
private showSideBySideDiff: boolean = ShowSideBySideDiffDefault
@ -472,9 +477,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
/**
* List of drag & drop intro types shown to the user.
*/
private dragAndDropIntroTypesShown: ReadonlySet<
DragAndDropIntroType
> = new Set()
private dragAndDropIntroTypesShown: ReadonlySet<DragAndDropIntroType> =
new Set()
private currentDragElement: DragElement | null = null
private lastThankYou: ILastThankYou | undefined
@ -811,9 +815,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
}
if (repository instanceof CloningRepository) {
const progress = this.cloningRepositoriesStore.getRepositoryState(
repository
)
const progress =
this.cloningRepositoriesStore.getRepositoryState(repository)
if (!progress) {
return null
}
@ -865,13 +868,13 @@ export class AppStore extends TypedBaseStore<IAppState> {
highlightAccessKeys: this.highlightAccessKeys,
isUpdateAvailableBannerVisible: this.isUpdateAvailableBannerVisible,
currentBanner: this.currentBanner,
askToMoveToApplicationsFolderSetting: this
.askToMoveToApplicationsFolderSetting,
askForConfirmationOnRepositoryRemoval: this
.askForConfirmationOnRepositoryRemoval,
askToMoveToApplicationsFolderSetting:
this.askToMoveToApplicationsFolderSetting,
askForConfirmationOnRepositoryRemoval:
this.askForConfirmationOnRepositoryRemoval,
askForConfirmationOnDiscardChanges: this.confirmDiscardChanges,
askForConfirmationOnDiscardChangesPermanently: this
.confirmDiscardChangesPermanently,
askForConfirmationOnDiscardChangesPermanently:
this.confirmDiscardChangesPermanently,
askForConfirmationOnForcePush: this.askForConfirmationOnForcePush,
uncommittedChangesStrategy: this.uncommittedChangesStrategy,
selectedExternalEditor: this.selectedExternalEditor,
@ -2045,8 +2048,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
private updateRepositorySelectionAfterRepositoriesChanged() {
const selectedRepository = this.selectedRepository
let newSelectedRepository: Repository | CloningRepository | null = this
.selectedRepository
let newSelectedRepository: Repository | CloningRepository | null =
this.selectedRepository
if (selectedRepository) {
const r =
this.repositories.find(
@ -2242,10 +2245,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
*/
private updateMultiCommitOperationConflictsIfFound(repository: Repository) {
const state = this.repositoryStateCache.get(repository)
const {
changesState,
multiCommitOperationState,
} = this.repositoryStateCache.get(repository)
const { changesState, multiCommitOperationState } =
this.repositoryStateCache.get(repository)
const { conflictState } = changesState
if (conflictState === null || multiCommitOperationState === null) {
@ -2485,9 +2486,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
}
const selectedFileIdBeforeLoad = selectedFileIDsBeforeLoad[0]
const selectedFileBeforeLoad = changesStateBeforeLoad.workingDirectory.findFileWithID(
selectedFileIdBeforeLoad
)
const selectedFileBeforeLoad =
changesStateBeforeLoad.workingDirectory.findFileWithID(
selectedFileIdBeforeLoad
)
if (selectedFileBeforeLoad === null) {
return
@ -2521,9 +2523,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
return
}
const currentlySelectedFile = changesState.workingDirectory.findFileWithID(
selectedFileID
)
const currentlySelectedFile =
changesState.workingDirectory.findFileWithID(selectedFileID)
if (currentlySelectedFile === null) {
return
}
@ -2545,9 +2546,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
})
}
const newSelection = currentlySelectedFile.selection.withSelectableLines(
selectableLines
)
const newSelection =
currentlySelectedFile.selection.withSelectableLines(selectableLines)
const selectedFile = currentlySelectedFile.withSelection(newSelection)
const updatedFiles = changesState.workingDirectory.files.map(f =>
f.id === selectedFile.id ? selectedFile : f
@ -2845,9 +2845,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
}
}
const branchProtectionsFound = await this.repositoriesStore.hasBranchProtectionsConfigured(
repository.gitHubRepository
)
const branchProtectionsFound =
await this.repositoriesStore.hasBranchProtectionsConfigured(
repository.gitHubRepository
)
if (branchProtectionsFound) {
this.statsStore.recordCommitToRepositoryWithBranchProtections()
@ -2929,9 +2930,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
includeAll: boolean
): Promise<void> {
this.repositoryStateCache.updateChangesState(repository, state => {
const workingDirectory = state.workingDirectory.withIncludeAllFiles(
includeAll
)
const workingDirectory =
state.workingDirectory.withIncludeAllFiles(includeAll)
return { workingDirectory }
})
@ -3049,9 +3049,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
desktopStashEntryCount: number,
stashEntryCount: number
) {
const lastStashEntryCheck = await this.repositoriesStore.getLastStashCheckDate(
repository
)
const lastStashEntryCheck =
await this.repositoriesStore.getLastStashCheckDate(repository)
const threshold = offsetFromNow(-24, 'hours')
// `lastStashEntryCheck` being equal to `null` means
// we've never checked for the given repo
@ -4722,9 +4721,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
mergeStatus: MergeTreeResult | null,
isSquash: boolean = false
): Promise<void> {
const {
multiCommitOperationState: opState,
} = this.repositoryStateCache.get(repository)
const { multiCommitOperationState: opState } =
this.repositoryStateCache.get(repository)
if (
opState === null ||
@ -4790,9 +4788,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
/** This shouldn't be called directly. See `Dispatcher`. */
public _setConflictsResolved(repository: Repository) {
const { multiCommitOperationState } = this.repositoryStateCache.get(
repository
)
const { multiCommitOperationState } =
this.repositoryStateCache.get(repository)
// the operation has already completed.
if (multiCommitOperationState === null) {
@ -4816,9 +4813,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
baseBranch: Branch,
targetBranch: Branch
): Promise<RebaseResult> {
const progressCallback = this.getMultiCommitOperationProgressCallBack(
repository
)
const progressCallback =
this.getMultiCommitOperationProgressCallBack(repository)
const gitStore = this.gitStoreCache.get(repository)
const result = await gitStore.performFailableOperation(
() => rebase(repository, baseBranch, targetBranch, progressCallback),
@ -4849,9 +4845,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
workingDirectory: WorkingDirectoryStatus,
manualResolutions: ReadonlyMap<string, ManualConflictResolution>
): Promise<RebaseResult> {
const progressCallback = this.getMultiCommitOperationProgressCallBack(
repository
)
const progressCallback =
this.getMultiCommitOperationProgressCallBack(repository)
const gitStore = this.gitStoreCache.get(repository)
const result = await gitStore.performFailableOperation(() =>
@ -5697,8 +5692,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
return
}
const currentPullRequest = this.repositoryStateCache.get(repository)
.branchesState.currentPullRequest
const currentPullRequest =
this.repositoryStateCache.get(repository).branchesState.currentPullRequest
if (currentPullRequest === null) {
return
@ -6324,9 +6319,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
await this._refreshRepository(repository)
const progressCallback = this.getMultiCommitOperationProgressCallBack(
repository
)
const progressCallback =
this.getMultiCommitOperationProgressCallBack(repository)
const gitStore = this.gitStoreCache.get(repository)
const result = await gitStore.performFailableOperation(() =>
cherryPick(repository, commits, progressCallback)
@ -6414,9 +6408,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
repository: Repository,
branchCreated: boolean
): void {
const {
multiCommitOperationState: opState,
} = this.repositoryStateCache.get(repository)
const { multiCommitOperationState: opState } =
this.repositoryStateCache.get(repository)
if (
opState === null ||
@ -6444,9 +6437,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
files: ReadonlyArray<WorkingDirectoryFileChange>,
manualResolutions: ReadonlyMap<string, ManualConflictResolution>
): Promise<CherryPickResult> {
const progressCallback = this.getMultiCommitOperationProgressCallBack(
repository
)
const progressCallback =
this.getMultiCommitOperationProgressCallBack(repository)
const gitStore = this.gitStoreCache.get(repository)
const result = await gitStore.performFailableOperation(() =>
@ -6564,9 +6556,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
return RebaseResult.Error
}
const progressCallback = this.getMultiCommitOperationProgressCallBack(
repository
)
const progressCallback =
this.getMultiCommitOperationProgressCallBack(repository)
const gitStore = this.gitStoreCache.get(repository)
const result = await gitStore.performFailableOperation(() =>
reorder(
@ -6594,9 +6585,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
return RebaseResult.Error
}
const progressCallback = this.getMultiCommitOperationProgressCallBack(
repository
)
const progressCallback =
this.getMultiCommitOperationProgressCallBack(repository)
const commitMessage = await formatCommitMessage(repository, commitContext)
const gitStore = this.gitStoreCache.get(repository)
const result = await gitStore.performFailableOperation(() =>
@ -6786,9 +6776,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
currentBranch: string,
theirBranch: string
): Promise<void> {
const { multiCommitOperationState } = this.repositoryStateCache.get(
repository
)
const { multiCommitOperationState } =
this.repositoryStateCache.get(repository)
if (multiCommitOperationState === null) {
const gitStore = this.gitStoreCache.get(repository)

View File

@ -371,16 +371,14 @@ export class CommitStatusStore {
return mapped
}
const checkRunsWithActionsWorkflows = await this.getCheckRunActionsWorkflowRuns(
key,
branchName,
checks
)
const checkRunsWithActionsWorkflows =
await this.getCheckRunActionsWorkflowRuns(key, branchName, checks)
const checkRunsWithActionsWorkflowJobs = await this.mapActionWorkflowRunsJobsToCheckRuns(
key,
checkRunsWithActionsWorkflows
)
const checkRunsWithActionsWorkflowJobs =
await this.mapActionWorkflowRunsJobsToCheckRuns(
key,
checkRunsWithActionsWorkflows
)
return checkRunsWithActionsWorkflowJobs
}

View File

@ -128,11 +128,8 @@ function getConflictState(
return null
}
const {
targetBranch,
originalBranchTip,
baseBranchTip,
} = status.rebaseInternalState
const { targetBranch, originalBranchTip, baseBranchTip } =
status.rebaseInternalState
return {
kind: 'rebase',

View File

@ -65,10 +65,8 @@ async function handleSSHKeyPassphrase(
return storedPassphrase
}
const {
passphrase,
storePassphrase,
} = await trampolineUIHelper.promptSSHKeyPassphrase(keyPath)
const { passphrase, storePassphrase } =
await trampolineUIHelper.promptSSHKeyPassphrase(keyPath)
// If the user wanted us to remember the passphrase, we'll keep it around to
// store it later if the git operation succeeds.
@ -86,38 +84,39 @@ async function handleSSHKeyPassphrase(
return passphrase ?? ''
}
export const askpassTrampolineHandler: TrampolineCommandHandler = async command => {
if (command.parameters.length !== 1) {
return undefined
}
const firstParameter = command.parameters[0]
if (firstParameter.startsWith('The authenticity of host ')) {
return handleSSHHostAuthenticity(firstParameter)
}
if (firstParameter.startsWith('Enter passphrase for key ')) {
return handleSSHKeyPassphrase(command.trampolineToken, firstParameter)
}
const username = command.environmentVariables.get('DESKTOP_USERNAME')
if (username === undefined || username.length === 0) {
return undefined
}
if (firstParameter.startsWith('Username')) {
return username
} else if (firstParameter.startsWith('Password')) {
const endpoint = command.environmentVariables.get('DESKTOP_ENDPOINT')
if (endpoint === undefined || endpoint.length === 0) {
export const askpassTrampolineHandler: TrampolineCommandHandler =
async command => {
if (command.parameters.length !== 1) {
return undefined
}
const key = getKeyForEndpoint(endpoint)
const token = await TokenStore.getItem(key, username)
return token ?? undefined
}
const firstParameter = command.parameters[0]
return undefined
}
if (firstParameter.startsWith('The authenticity of host ')) {
return handleSSHHostAuthenticity(firstParameter)
}
if (firstParameter.startsWith('Enter passphrase for key ')) {
return handleSSHKeyPassphrase(command.trampolineToken, firstParameter)
}
const username = command.environmentVariables.get('DESKTOP_USERNAME')
if (username === undefined || username.length === 0) {
return undefined
}
if (firstParameter.startsWith('Username')) {
return username
} else if (firstParameter.startsWith('Password')) {
const endpoint = command.environmentVariables.get('DESKTOP_ENDPOINT')
if (endpoint === undefined || endpoint.length === 0) {
return undefined
}
const key = getKeyForEndpoint(endpoint)
const token = await TokenStore.getItem(key, username)
return token ?? undefined
}
return undefined
}

View File

@ -35,9 +35,8 @@ export function ensureItemIds(
seenIds.add(id)
if (item.submenu) {
const subMenuTemplate = item.submenu as ReadonlyArray<
Electron.MenuItemConstructorOptions
>
const subMenuTemplate =
item.submenu as ReadonlyArray<Electron.MenuItemConstructorOptions>
ensureItemIds(subMenuTemplate, item.id, seenIds)
}
}

View File

@ -108,9 +108,7 @@ class AsyncListenerSet<TDetails, TResponse> {
* documentation.
*/
export class OrderedWebRequest {
public readonly onBeforeRedirect: SyncListenerSet<
OnBeforeRedirectListenerDetails
>
public readonly onBeforeRedirect: SyncListenerSet<OnBeforeRedirectListenerDetails>
public readonly onBeforeRequest: AsyncListenerSet<
OnBeforeRequestListenerDetails,
@ -123,18 +121,14 @@ export class OrderedWebRequest {
>
public readonly onCompleted: SyncListenerSet<OnCompletedListenerDetails>
public readonly onErrorOccurred: SyncListenerSet<
OnErrorOccurredListenerDetails
>
public readonly onErrorOccurred: SyncListenerSet<OnErrorOccurredListenerDetails>
public readonly onHeadersReceived: AsyncListenerSet<
OnHeadersReceivedListenerDetails,
HeadersReceivedResponse
>
public readonly onResponseStarted: SyncListenerSet<
OnResponseStartedListenerDetails
>
public readonly onResponseStarted: SyncListenerSet<OnResponseStartedListenerDetails>
public readonly onSendHeaders: SyncListenerSet<OnSendHeadersListenerDetails>

View File

@ -1698,10 +1698,8 @@ export class App extends React.Component<IAppProps, IAppState> {
}
case PopupType.StashAndSwitchBranch: {
const { repository, branchToCheckout } = popup
const {
branchesState,
changesState,
} = this.props.repositoryStateManager.get(repository)
const { branchesState, changesState } =
this.props.repositoryStateManager.get(repository)
const { tip } = branchesState
if (tip.kind !== TipState.Valid) {

View File

@ -343,9 +343,8 @@ export abstract class AutocompletingTextInput<
const autocompletionState = this.state.autocompletionState!
const originalText = element.value
const range = autocompletionState.range
const autoCompleteText = autocompletionState.provider.getCompletionText(
item
)
const autoCompleteText =
autocompletionState.provider.getCompletionText(item)
const textWithAutoCompleteText =
originalText.substr(0, range.start - 1) + autoCompleteText + ' '

View File

@ -1,15 +1,11 @@
import { AutocompletingTextInput } from './autocompleting-text-input'
export class AutocompletingTextArea extends AutocompletingTextInput<
HTMLTextAreaElement
> {
export class AutocompletingTextArea extends AutocompletingTextInput<HTMLTextAreaElement> {
protected getElementTagName(): 'textarea' | 'input' {
return 'textarea'
}
}
export class AutocompletingInput extends AutocompletingTextInput<
HTMLInputElement
> {
export class AutocompletingInput extends AutocompletingTextInput<HTMLInputElement> {
protected getElementTagName(): 'textarea' | 'input' {
return 'input'
}

View File

@ -27,7 +27,8 @@ export interface IEmojiHit {
/** Autocompletion provider for emoji. */
export class EmojiAutocompletionProvider
implements IAutocompletionProvider<IEmojiHit> {
implements IAutocompletionProvider<IEmojiHit>
{
public readonly kind = 'emoji'
private readonly emoji: Map<string, string>

View File

@ -10,7 +10,8 @@ const UpdateIssuesThrottleInterval = 1000 * 60
/** The autocompletion provider for issues in a GitHub repository. */
export class IssuesAutocompletionProvider
implements IAutocompletionProvider<IIssueHit> {
implements IAutocompletionProvider<IIssueHit>
{
public readonly kind = 'issue'
private readonly issuesStore: IssuesStore

View File

@ -41,7 +41,8 @@ function userToHit(
/** The autocompletion provider for user mentions in a GitHub repository. */
export class UserAutocompletionProvider
implements IAutocompletionProvider<IUserHit> {
implements IAutocompletionProvider<IUserHit>
{
public readonly kind = 'user'
private readonly gitHubUserStore: GitHubUserStore

View File

@ -13,12 +13,8 @@ export class SuccessfulCherryPick extends React.Component<
{}
> {
public render() {
const {
countCherryPicked,
onDismissed,
onUndo,
targetBranchName,
} = this.props
const { countCherryPicked, onDismissed, onUndo, targetBranchName } =
this.props
const pluralized = countCherryPicked === 1 ? 'commit' : 'commits'

View File

@ -123,12 +123,8 @@ export class BranchListItem extends React.Component<
}
private onMouseUp = () => {
const {
onDropOntoBranch,
onDropOntoCurrentBranch,
name,
isCurrentBranch,
} = this.props
const { onDropOntoBranch, onDropOntoCurrentBranch, name, isCurrentBranch } =
this.props
this.setState({ isDragInProgress: false })

View File

@ -214,12 +214,8 @@ export class PullRequestList extends React.Component<
}
private onDropOntoPullRequest = (prNumber: number) => {
const {
repository,
selectedPullRequest,
dispatcher,
pullRequests,
} = this.props
const { repository, selectedPullRequest, dispatcher, pullRequests } =
this.props
if (!dragAndDropManager.isDragOfTypeInProgress(DragType.Commit)) {
return

View File

@ -324,12 +324,8 @@ export class NoChanges extends React.Component<
this.props.dispatcher.recordSuggestedStepOpenInExternalEditor()
private renderRemoteAction() {
const {
remote,
aheadBehind,
branchesState,
tagsToPush,
} = this.props.repositoryState
const { remote, aheadBehind, branchesState, tagsToPush } =
this.props.repositoryState
const { tip, defaultBranch, currentPullRequest } = branchesState
if (tip.kind !== TipState.Valid) {

View File

@ -18,9 +18,7 @@ interface ICICheckRunActionsJobStepListItemProps {
readonly onViewJobStepExternally: (step: IAPIWorkflowJobStep) => void
}
export class CICheckRunActionsJobStepListItem extends React.PureComponent<
ICICheckRunActionsJobStepListItemProps
> {
export class CICheckRunActionsJobStepListItem extends React.PureComponent<ICICheckRunActionsJobStepListItemProps> {
private onViewJobStepExternally = () => {
this.props.onViewJobStepExternally(this.props.step)
}

View File

@ -45,9 +45,7 @@ interface ICICheckRunListItemProps {
}
/** The CI check list item. */
export class CICheckRunListItem extends React.PureComponent<
ICICheckRunListItemProps
> {
export class CICheckRunListItem extends React.PureComponent<ICICheckRunListItemProps> {
private toggleCheckRunExpansion = () => {
this.props.onCheckRunExpansionToggleClick(this.props.checkRun)
}
@ -77,12 +75,8 @@ export class CICheckRunListItem extends React.PureComponent<
}
private renderCheckJobStepToggle = (): JSX.Element | null => {
const {
checkRun,
isCheckRunExpanded,
selectable,
notExpandable,
} = this.props
const { checkRun, isCheckRunExpanded, selectable, notExpandable } =
this.props
if (
checkRun.actionJobSteps === undefined ||

View File

@ -55,10 +55,8 @@ export class CICheckRunList extends React.PureComponent<
}
public componentDidUpdate(prevProps: ICICheckRunListProps) {
const {
checkRunExpanded,
hasUserToggledCheckRun,
} = this.setupStateAfterCheckRunPropChange(this.props, this.state)
const { checkRunExpanded, hasUserToggledCheckRun } =
this.setupStateAfterCheckRunPropChange(this.props, this.state)
let foundDiffStatus = false
for (const prevCR of prevProps.checkRuns) {

View File

@ -80,9 +80,7 @@ interface ICloneGithubRepositoryProps {
) => void
}
export class CloneGithubRepository extends React.PureComponent<
ICloneGithubRepositoryProps
> {
export class CloneGithubRepository extends React.PureComponent<ICloneGithubRepositoryProps> {
public render() {
return (
<DialogContent className="clone-github-repository-content">

View File

@ -111,9 +111,7 @@ function findRepositoryForListItem(
return repositories.find(r => r.clone_url === listItem.url) || null
}
export class CloneableRepositoryFilterList extends React.PureComponent<
ICloneableRepositoryFilterListProps
> {
export class CloneableRepositoryFilterList extends React.PureComponent<ICloneableRepositoryFilterListProps> {
/**
* A memoized function for grouping repositories for display
* in the FilterList. The group will not be recomputed as long

View File

@ -281,17 +281,20 @@ export class DiffSyntaxMode {
}
}
CodeMirror.defineMode(DiffSyntaxMode.ModeName, function (
config: CodeMirror.EditorConfiguration,
modeOptions?: IDiffSyntaxModeOptions
) {
if (!modeOptions) {
throw new Error('I needs me some options')
}
CodeMirror.defineMode(
DiffSyntaxMode.ModeName,
function (
config: CodeMirror.EditorConfiguration,
modeOptions?: IDiffSyntaxModeOptions
) {
if (!modeOptions) {
throw new Error('I needs me some options')
}
return new DiffSyntaxMode(
modeOptions.hunks,
modeOptions.oldTokens,
modeOptions.newTokens
)
})
return new DiffSyntaxMode(
modeOptions.hunks,
modeOptions.oldTokens,
modeOptions.newTokens
)
}
)

View File

@ -148,12 +148,8 @@ export class SideBySideDiffRow extends React.Component<
this.state = { showWhitespaceHint: undefined }
}
public render() {
const {
row,
showSideBySideDiff,
beforeClassNames,
afterClassNames,
} = this.props
const { row, showSideBySideDiff, beforeClassNames, afterClassNames } =
this.props
const beforeClasses = classNames('before', ...beforeClassNames)
const afterClasses = classNames('after', ...afterClassNames)

View File

@ -63,8 +63,7 @@ import { HiddenBidiCharsWarning } from './hidden-bidi-chars-warning'
export const narrowNoNewlineSymbol = {
w: 16,
h: 8,
d:
'm 16,1 0,3 c 0,0.55 -0.45,1 -1,1 l -3,0 0,2 -3,-3 3,-3 0,2 2,0 0,-2 2,0 z M 8,4 C 8,6.2 6.2,8 4,8 1.8,8 0,6.2 0,4 0,1.8 1.8,0 4,0 6.2,0 8,1.8 8,4 Z M 1.5,5.66 5.66,1.5 C 5.18,1.19 4.61,1 4,1 2.34,1 1,2.34 1,4 1,4.61 1.19,5.17 1.5,5.66 Z M 7,4 C 7,3.39 6.81,2.83 6.5,2.34 L 2.34,6.5 C 2.82,6.81 3.39,7 4,7 5.66,7 7,5.66 7,4 Z',
d: 'm 16,1 0,3 c 0,0.55 -0.45,1 -1,1 l -3,0 0,2 -3,-3 3,-3 0,2 2,0 0,-2 2,0 z M 8,4 C 8,6.2 6.2,8 4,8 1.8,8 0,6.2 0,4 0,1.8 1.8,0 4,0 6.2,0 8,1.8 8,4 Z M 1.5,5.66 5.66,1.5 C 5.18,1.19 4.61,1 4,1 2.34,1 1,2.34 1,4 1,4.61 1.19,5.17 1.5,5.66 Z M 7,4 C 7,3.39 6.81,2.83 6.5,2.34 L 2.34,6.5 C 2.82,6.81 3.39,7 4,7 5.66,7 7,5.66 7,4 Z',
}
type ChangedFile = WorkingDirectoryFileChange | CommittedFileChange
@ -281,7 +280,8 @@ const defaultEditorOptions: EditorConfiguration = {
scrollbarStyle: __DARWIN__ ? 'simple' : 'native',
styleSelectedText: true,
lineSeparator: '\n',
specialChars: /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/,
specialChars:
/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/,
gutters: [diffGutterName],
}
@ -1009,9 +1009,8 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
)
const gutterParentElement = cm.getGutterElement()
const gutterElement = gutterParentElement.getElementsByClassName(
diffGutterName
)[0]
const gutterElement =
gutterParentElement.getElementsByClassName(diffGutterName)[0]
const newStyle = `width: ${diffSize * 2}px;`
const currentStyle = gutterElement.getAttribute('style')

View File

@ -14,9 +14,7 @@ interface IWhitespaceHintPopoverProps {
readonly style: React.CSSProperties
}
export class WhitespaceHintPopover extends React.Component<
IWhitespaceHintPopoverProps
> {
export class WhitespaceHintPopover extends React.Component<IWhitespaceHintPopoverProps> {
public render() {
return (
<Popover

View File

@ -1091,10 +1091,8 @@ export class Dispatcher {
private dropCurrentBranchFromForcePushList = (repository: Repository) => {
const currentState = this.repositoryStateManager.get(repository)
const {
forcePushBranches: rebasedBranches,
tip,
} = currentState.branchesState
const { forcePushBranches: rebasedBranches, tip } =
currentState.branchesState
if (tip.kind !== TipState.Valid) {
return
@ -1122,10 +1120,8 @@ export class Dispatcher {
baseBranch: Branch,
targetBranch: Branch
): Promise<void> {
const {
branchesState,
multiCommitOperationState,
} = this.repositoryStateManager.get(repository)
const { branchesState, multiCommitOperationState } =
this.repositoryStateManager.get(repository)
if (
multiCommitOperationState == null ||
@ -1733,9 +1729,8 @@ export class Dispatcher {
}
// Find the repository where the PR is created in Desktop.
let repository: Repository | null = this.getRepositoryFromPullRequest(
pullRequest
)
let repository: Repository | null =
this.getRepositoryFromPullRequest(pullRequest)
if (repository !== null) {
await this.selectRepository(repository)
@ -3033,10 +3028,8 @@ export class Dispatcher {
* show conflicts step
*/
private startConflictCherryPickFlow(repository: Repository): void {
const {
changesState,
multiCommitOperationState,
} = this.repositoryStateManager.get(repository)
const { changesState, multiCommitOperationState } =
this.repositoryStateManager.get(repository)
const { conflictState } = changesState
if (
@ -3748,10 +3741,8 @@ export class Dispatcher {
type: BannerType.ConflictsFound,
operationDescription,
onOpenConflictsDialog: async () => {
const {
changesState,
multiCommitOperationState,
} = this.repositoryStateManager.get(repository)
const { changesState, multiCommitOperationState } =
this.repositoryStateManager.get(repository)
const { conflictState } = changesState
if (conflictState == null) {

View File

@ -424,7 +424,8 @@ export async function rebaseConflictsHandler(
return null
}
const rejectedPathRe = /^ ! \[remote rejected\] .*? -> .*? \(refusing to allow an OAuth App to create or update workflow `(.*?)` without `workflow` scope\)/m
const rejectedPathRe =
/^ ! \[remote rejected\] .*? -> .*? \(refusing to allow an OAuth App to create or update workflow `(.*?)` without `workflow` scope\)/m
/**
* Attempts to detect whether an error is the result of a failed push
@ -469,7 +470,8 @@ export async function refusedWorkflowUpdate(
return null
}
const samlReauthErrorMessageRe = /`([^']+)' organization has enabled or enforced SAML SSO.*?you must re-authorize/s
const samlReauthErrorMessageRe =
/`([^']+)' organization has enabled or enforced SAML SSO.*?you must re-authorize/s
/**
* Attempts to detect whether an error is the result of a failed push

View File

@ -77,8 +77,8 @@ export class DropdownSelectButton extends React.Component<
const windowHeight = window.innerHeight
const bottomOfButton = this.invokeButtonRef.getBoundingClientRect().bottom
const invokeButtonHeight = this.invokeButtonRef.getBoundingClientRect()
.height
const invokeButtonHeight =
this.invokeButtonRef.getBoundingClientRect().height
// 15 pixels is just to give some padding room below it
const calcMaxHeight = windowHeight - bottomOfButton - 15
const heightOfOptions = this.optionsContainerRef.clientHeight
@ -180,11 +180,8 @@ export class DropdownSelectButton extends React.Component<
public render() {
const { options, disabled } = this.props
const {
selectedOption,
optionsPositionBottom,
showButtonOptions,
} = this.state
const { selectedOption, optionsPositionBottom, showButtonOptions } =
this.state
if (options.length === 0 || selectedOption === null) {
return
}

View File

@ -53,10 +53,11 @@ export class CreateForkDialog extends React.Component<
gitHubRepository.name
)
this.props.dispatcher.recordForkCreated()
const updatedRepository = await this.props.dispatcher.convertRepositoryToFork(
this.props.repository,
fork
)
const updatedRepository =
await this.props.dispatcher.convertRepositoryToFork(
this.props.repository,
fork
)
this.setState({ loading: false })
this.props.onDismissed()

View File

@ -398,9 +398,8 @@ export class CommitList extends React.Component<
const intro = this.state.remainingDragAndDropIntros[0]
this.setState({
remainingDragAndDropIntros: this.state.remainingDragAndDropIntros.slice(
1
),
remainingDragAndDropIntros:
this.state.remainingDragAndDropIntros.slice(1),
})
this.props.onDragAndDropIntroSeen(intro)

View File

@ -159,8 +159,8 @@ export class CommitSummary extends React.Component<
private onResized = () => {
if (this.descriptionRef) {
const descriptionBottom = this.descriptionRef.getBoundingClientRect()
.bottom
const descriptionBottom =
this.descriptionRef.getBoundingClientRect().bottom
this.props.onDescriptionBottomChanged(descriptionBottom)
}

View File

@ -14,9 +14,7 @@ interface ICommittedFileItemProps {
) => void
}
export class CommittedFileItem extends React.Component<
ICommittedFileItemProps
> {
export class CommittedFileItem extends React.Component<ICommittedFileItemProps> {
private onContextMenu = (event: React.MouseEvent<HTMLDivElement>) => {
if (this.props.onContextMenu !== undefined) {
this.props.onContextMenu(this.props.file, event)

View File

@ -330,12 +330,8 @@ export class CompareSidebar extends React.Component<
}
private renderFilterList() {
const {
defaultBranch,
branches,
recentBranches,
filterText,
} = this.props.compareState
const { defaultBranch, branches, recentBranches, filterText } =
this.props.compareState
return (
<BranchList

View File

@ -23,17 +23,14 @@ export const AvailableDragAndDropIntros: Record<
> = {
[DragAndDropIntroType.CherryPick]: {
title: 'Drag and drop to cherry-pick!',
body:
'Copy commits to another branch by dragging and dropping them onto a branch in the branch menu, or by right-clicking on a commit.',
body: 'Copy commits to another branch by dragging and dropping them onto a branch in the branch menu, or by right-clicking on a commit.',
},
[DragAndDropIntroType.Squash]: {
title: 'Drag and drop to squash!',
body:
'Squash commits by dragging and dropping them onto another commit, or by right-clicking on multiple commits.',
body: 'Squash commits by dragging and dropping them onto another commit, or by right-clicking on multiple commits.',
},
[DragAndDropIntroType.Reorder]: {
title: 'Drag and drop to reorder!',
body:
'Reorder commits to tidy up your history by dragging and dropping them to a different position.',
body: 'Reorder commits to tidy up your history by dragging and dropping them to a different position.',
},
}

View File

@ -73,7 +73,7 @@ function nextPosition(doc: Doc, pos: Position) {
* are inclusive and this method takes that into account.
*/
function posIsInsideMarkedText(doc: Doc, pos: Position) {
const marks = (doc.findMarksAt(pos) as any) as ActualTextMarker[]
const marks = doc.findMarksAt(pos) as any as ActualTextMarker[]
const ix = doc.indexFromPos(pos)
return marks.some(mark => {
@ -190,7 +190,7 @@ function appendTextMarker(
doc.replaceRange(text, from)
const to = doc.posFromIndex(Infinity)
return (doc.markText(from, to, options) as any) as ActualTextMarker
return doc.markText(from, to, options) as any as ActualTextMarker
}
/**
@ -338,13 +338,13 @@ function markRangeAsHandle(
): ActualTextMarker {
const elem = renderHandleMarkReplacementElement(author)
return (doc.markText(from, to, {
return doc.markText(from, to, {
atomic: true,
className: 'handle',
readOnly: false,
replacedWith: elem,
handleMouseEvents: true,
}) as any) as ActualTextMarker
}) as any as ActualTextMarker
}
function triggerAutoCompleteBasedOnCursorPosition(cm: Editor) {
@ -552,13 +552,13 @@ export class AuthorInput extends React.Component<IAuthorInputProps, {}> {
// Create a temporary, atomic, marker so that the text can't be modified.
// This marker will be styled in such a way as to indicate that it's
// processing.
const tmpMark = (doc.markText(from, end, {
const tmpMark = doc.markText(from, end, {
atomic: true,
className: 'handle progress',
readOnly: false,
replacedWith: renderUnknownHandleMarkReplacementElement(username, false),
handleMouseEvents: true,
}) as any) as ActualTextMarker
}) as any as ActualTextMarker
// Note that it's important that this method isn't async up until
// this point since show-hint expects a synchronous method
@ -693,7 +693,7 @@ export class AuthorInput extends React.Component<IAuthorInputProps, {}> {
}
private getAllHandleMarks(cm: Editor): Array<ActualTextMarker> {
return (cm.getDoc().getAllMarks() as any) as ActualTextMarker[]
return cm.getDoc().getAllMarks() as any as ActualTextMarker[]
}
private initializeCodeMirror(host: HTMLDivElement) {

View File

@ -39,8 +39,7 @@ interface IAvatarState {
const DefaultAvatarSymbol = {
w: 16,
h: 16,
d:
'M13 13.145a.844.844 0 0 1-.832.855H3.834A.846.846 0 0 1 3 13.142v-.856c0-2.257 3.333-3.429 3.333-3.429s.191-.35 0-.857c-.7-.531-.786-1.363-.833-3.429C5.644 2.503 7.056 2 8 2s2.356.502 2.5 2.571C10.453 6.637 10.367 7.47 9.667 8c-.191.506 0 .857 0 .857S13 10.03 13 12.286v.859z',
d: 'M13 13.145a.844.844 0 0 1-.832.855H3.834A.846.846 0 0 1 3 13.142v-.856c0-2.257 3.333-3.429 3.333-3.429s.191-.35 0-.857c-.7-.531-.786-1.363-.833-3.429C5.644 2.503 7.056 2 8 2s2.356.502 2.5 2.571C10.453 6.637 10.367 7.47 9.667 8c-.191.506 0 .857 0 .857S13 10.03 13 12.286v.859z',
}
/**

View File

@ -22,9 +22,7 @@ interface IConfigLockFileExistsProps {
readonly onError: (e: Error) => void
}
export class ConfigLockFileExists extends React.Component<
IConfigLockFileExistsProps
> {
export class ConfigLockFileExists extends React.Component<IConfigLockFileExistsProps> {
private onDeleteLockFile = async () => {
try {
await unlink(this.props.lockFilePath)

View File

@ -231,8 +231,9 @@ export class FilterList<T extends IFilterListItem> extends React.Component<
}
if (this.props.onFilterListResultsChanged !== undefined) {
const itemCount = this.state.rows.filter(row => row.kind === 'item')
.length
const itemCount = this.state.rows.filter(
row => row.kind === 'item'
).length
this.props.onFilterListResultsChanged(itemCount)
}

View File

@ -16,9 +16,7 @@ interface IGitEmailNotFoundWarningProps {
* A component which just displays a warning to the user if their git config
* email doesn't match any of the emails in their GitHub (Enterprise) account.
*/
export class GitEmailNotFoundWarning extends React.Component<
IGitEmailNotFoundWarningProps
> {
export class GitEmailNotFoundWarning extends React.Component<IGitEmailNotFoundWarningProps> {
public render() {
const { accounts, email } = this.props

View File

@ -592,9 +592,8 @@ export class List extends React.Component<IListProps, IListState> {
return this.moveSelection(direction, source)
}
const lastSelection = this.props.selectedRows[
this.props.selectedRows.length - 1
]
const lastSelection =
this.props.selectedRows[this.props.selectedRows.length - 1]
const selectionOrigin = this.props.selectedRows[0]

View File

@ -138,9 +138,10 @@ export function truncatePath(path: string, length: number) {
*
* @param normalizedPath The normalized path (i.e. no '.' or '..' characters in path)
*/
export function extract(
normalizedPath: string
): { normalizedFileName: string; normalizedDirectory: string } {
export function extract(normalizedPath: string): {
normalizedFileName: string
normalizedDirectory: string
} {
// for untracked submodules the status entry is returned as a path with a
// trailing path separator which causes the directory to be trimmed in a weird
// way below. let's try to resolve this here

View File

@ -39,9 +39,7 @@ interface ISandboxedMarkdownProps {
* Parses and sanitizes markdown into html and outputs it inside a sandboxed
* iframe.
**/
export class SandboxedMarkdown extends React.PureComponent<
ISandboxedMarkdownProps
> {
export class SandboxedMarkdown extends React.PureComponent<ISandboxedMarkdownProps> {
private frameRef: HTMLIFrameElement | null = null
private frameContainingDivRef: HTMLDivElement | null = null
private contentDivRef: HTMLDivElement | null = null

View File

@ -29,20 +29,12 @@ interface ITooltippedContentProps
* to add a wrapping element around the content. supports all the options that
* the Tooltip component does without having to worry about refs.
**/
export class TooltippedContent extends React.Component<
ITooltippedContentProps
> {
export class TooltippedContent extends React.Component<ITooltippedContentProps> {
private wrapperRef = createObservableRef<HTMLElement>()
public render() {
const {
tooltip,
tagName,
children,
className,
tooltipClassName,
...rest
} = this.props
const { tooltip, tagName, children, className, tooltipClassName, ...rest } =
this.props
return React.createElement(tagName ?? 'span', {
ref: this.wrapperRef,

View File

@ -42,9 +42,7 @@ export interface IMultiCommitOperationProps {
}
/** A base component for the shared logic of multi commit operations. */
export abstract class BaseMultiCommitOperation extends React.Component<
IMultiCommitOperationProps
> {
export abstract class BaseMultiCommitOperation extends React.Component<IMultiCommitOperationProps> {
protected abstract onBeginOperation: () => void
protected abstract onChooseBranch: (targetBranch: Branch) => void
protected abstract onContinueAfterConflicts: () => Promise<void>

View File

@ -10,13 +10,8 @@ export abstract class BaseRebase extends BaseMultiCommitOperation {
protected abstract rebaseKind: MultiCommitOperationKind
protected onContinueAfterConflicts = async (): Promise<void> => {
const {
repository,
dispatcher,
workingDirectory,
state,
conflictState,
} = this.props
const { repository, dispatcher, workingDirectory, state, conflictState } =
this.props
const { operationDetail, originalBranchTip } = state
if (

View File

@ -11,13 +11,8 @@ import { BaseMultiCommitOperation } from './base-multi-commit-operation'
export abstract class CherryPick extends BaseMultiCommitOperation {
protected onContinueAfterConflicts = async (): Promise<void> => {
const {
repository,
dispatcher,
workingDirectory,
state,
conflictState,
} = this.props
const { repository, dispatcher, workingDirectory, state, conflictState } =
this.props
const { operationDetail, targetBranch } = state
if (

View File

@ -9,9 +9,7 @@ import { CherryPick } from './cherry-pick'
import { Rebase } from './rebase'
/** A component for managing the views of a multi commit operation. */
export class MultiCommitOperation extends React.Component<
IMultiCommitOperationProps
> {
export class MultiCommitOperation extends React.Component<IMultiCommitOperationProps> {
public render() {
const { kind } = this.props.state.operationDetail
switch (kind) {

View File

@ -14,12 +14,8 @@ export abstract class Squash extends BaseRebase {
return
}
const {
targetCommit,
lastRetainedCommitRef,
commitContext,
commits,
} = operationDetail
const { targetCommit, lastRetainedCommitRef, commitContext, commits } =
operationDetail
return dispatcher.squash(
repository,

View File

@ -42,9 +42,7 @@ interface ICreateTutorialRepositoryDialogProps {
* A dialog component responsible for initializing, publishing, and adding
* a tutorial repository to the application.
*/
export class CreateTutorialRepositoryDialog extends React.Component<
ICreateTutorialRepositoryDialogProps
> {
export class CreateTutorialRepositoryDialog extends React.Component<ICreateTutorialRepositoryDialogProps> {
public onSubmit = () =>
this.props.onCreateTutorialRepository(this.props.account)

File diff suppressed because it is too large Load Diff

View File

@ -173,8 +173,8 @@ export class Preferences extends React.Component<
optOutOfUsageTracking: this.props.optOutOfUsageTracking,
confirmRepositoryRemoval: this.props.confirmRepositoryRemoval,
confirmDiscardChanges: this.props.confirmDiscardChanges,
confirmDiscardChangesPermanently: this.props
.confirmDiscardChangesPermanently,
confirmDiscardChangesPermanently:
this.props.confirmDiscardChangesPermanently,
confirmForcePush: this.props.confirmForcePush,
uncommittedChangesStrategy: this.props.uncommittedChangesStrategy,
availableShells,

View File

@ -30,8 +30,8 @@ export class Prompts extends React.Component<
this.state = {
confirmRepositoryRemoval: this.props.confirmRepositoryRemoval,
confirmDiscardChanges: this.props.confirmDiscardChanges,
confirmDiscardChangesPermanently: this.props
.confirmDiscardChangesPermanently,
confirmDiscardChangesPermanently:
this.props.confirmDiscardChangesPermanently,
confirmForcePush: this.props.confirmForcePush,
}
}

View File

@ -185,13 +185,8 @@ export class PullRequestQuickView extends React.Component<
}
private renderPR = () => {
const {
title,
pullRequestNumber,
base,
body,
draft,
} = this.props.pullRequest
const { title, pullRequestNumber, base, body, draft } =
this.props.pullRequest
const displayBody =
body !== undefined && body !== null && body.trim() !== ''
? body

View File

@ -115,8 +115,8 @@ export class RepositoryView extends React.Component<
IRepositoryViewProps,
IRepositoryViewState
> {
private previousSection: RepositorySectionTab = this.props.state
.selectedSection
private previousSection: RepositorySectionTab =
this.props.state.selectedSection
// Flag to force the app to use the scroll position in the state the next time
// the Compare list is rendered.
@ -148,8 +148,8 @@ export class RepositoryView extends React.Component<
}
private renderChangesBadge(): JSX.Element | null {
const filesChangedCount = this.props.state.changesState.workingDirectory
.files.length
const filesChangedCount =
this.props.state.changesState.workingDirectory.files.length
if (filesChangedCount <= 0) {
return null

View File

@ -127,12 +127,8 @@ export class StashAndSwitchBranch extends React.Component<
}
private onSubmit = async () => {
const {
repository,
branchToCheckout,
dispatcher,
hasAssociatedStash,
} = this.props
const { repository, branchToCheckout, dispatcher, hasAssociatedStash } =
this.props
const { selectedStashAction } = this.state
if (

View File

@ -54,9 +54,7 @@ interface IStashDiffViewerProps {
*
* _(Like viewing a selected commit in history but for a stash)_
*/
export class StashDiffViewer extends React.PureComponent<
IStashDiffViewerProps
> {
export class StashDiffViewer extends React.PureComponent<IStashDiffViewerProps> {
private onSelectedFileChanged = (file: CommittedFileChange) =>
this.props.dispatcher.selectStashedFile(this.props.repository, file)

View File

@ -30,7 +30,9 @@ interface ISuggestedActionGroup {
* Wraps a list of suggested action components with extra styling
* and animations.
*/
export const SuggestedActionGroup: React.FunctionComponent<ISuggestedActionGroup> = props => {
export const SuggestedActionGroup: React.FunctionComponent<
ISuggestedActionGroup
> = props => {
const cn = 'suggested-action-group ' + (props.type ? props.type : 'normal')
if (props.transitions === 'replace') {
const enableTransitions =

View File

@ -28,9 +28,7 @@ interface ITutorialStepInstructionsProps {
}
/** A step (summary and expandable description) in the tutorial side panel */
export class TutorialStepInstructions extends React.Component<
ITutorialStepInstructionsProps
> {
export class TutorialStepInstructions extends React.Component<ITutorialStepInstructionsProps> {
public render() {
return (
<li key={this.props.sectionId} onClick={this.onSummaryClick}>

View File

@ -24,9 +24,7 @@ interface IUpstreamAlreadyExistsProps {
* The dialog shown when a repository is a fork but its upstream remote doesn't
* point to the parent repository.
*/
export class UpstreamAlreadyExists extends React.Component<
IUpstreamAlreadyExistsProps
> {
export class UpstreamAlreadyExists extends React.Component<IUpstreamAlreadyExistsProps> {
public render() {
const name = this.props.repository.name
const gitHubRepository = forceUnwrap(

View File

@ -136,9 +136,7 @@ export async function setupConflictedRepo(): Promise<Repository> {
*
* The conflicted file will be 'foo'. There will also be uncommitted changes unrelated to the merge in 'perlin'.
*/
export async function setupConflictedRepoWithUnrelatedCommittedChange(): Promise<
Repository
> {
export async function setupConflictedRepoWithUnrelatedCommittedChange(): Promise<Repository> {
const repo = await setupEmptyRepository()
const firstCommit = {
@ -184,9 +182,7 @@ export async function setupConflictedRepoWithUnrelatedCommittedChange(): Promise
*
* The conflicted files will be 'foo', 'bar', and 'baz'.
*/
export async function setupConflictedRepoWithMultipleFiles(): Promise<
Repository
> {
export async function setupConflictedRepoWithMultipleFiles(): Promise<Repository> {
const repo = await setupEmptyRepository()
const firstCommit = {

View File

@ -109,7 +109,7 @@ describe('App', () => {
})
it('renders', async () => {
const app = (TestUtils.renderIntoDocument(
const app = TestUtils.renderIntoDocument(
<App
dispatcher={dispatcher}
appStore={appStore}
@ -119,7 +119,7 @@ describe('App', () => {
aheadBehindStore={aheadBehindStore}
startTime={0}
/>
) as unknown) as React.Component<any, any>
) as unknown as React.Component<any, any>
// Give any promises a tick to resolve.
await wait(0)

View File

@ -140,8 +140,7 @@ describe('GitProgressParser', () => {
expect(result).toEqual({
title: 'Receiving objects',
text:
'Receiving objects: 100% (167587/167587), 279.67 MiB | 2.43 MiB/s, done.',
text: 'Receiving objects: 100% (167587/167587), 279.67 MiB | 2.43 MiB/s, done.',
value: 167587,
done: true,
percent: 100,

View File

@ -126,7 +126,8 @@ describe('updateChangedFiles', () => {
const { selection } = updateChangedFiles(prevState, status, false)
expect(selection.kind).toBe(ChangesSelectionKind.WorkingDirectory)
const workingDirectorySelection = selection as ChangesWorkingDirectorySelection
const workingDirectorySelection =
selection as ChangesWorkingDirectorySelection
const { selectedFileIDs } = workingDirectorySelection
expect(selectedFileIDs).toHaveLength(1)
// NOTE: `updateChangedFiles` sorts the paths and `app/package.json` will
@ -150,7 +151,8 @@ describe('updateChangedFiles', () => {
const { selection } = updateChangedFiles(prevState, status, false)
expect(selection.kind).toBe(ChangesSelectionKind.WorkingDirectory)
const workingDirectorySelection = selection as ChangesWorkingDirectorySelection
const workingDirectorySelection =
selection as ChangesWorkingDirectorySelection
const { selectedFileIDs } = workingDirectorySelection
expect(selectedFileIDs).toHaveLength(1)
expect(selectedFileIDs[0]).toBe(firstFile)
@ -170,7 +172,8 @@ describe('updateChangedFiles', () => {
const { selection } = updateChangedFiles(prevState, status, false)
expect(selection.kind).toBe(ChangesSelectionKind.WorkingDirectory)
const workingDirectorySelection = selection as ChangesWorkingDirectorySelection
const workingDirectorySelection =
selection as ChangesWorkingDirectorySelection
const { selectedFileIDs } = workingDirectorySelection
expect(selectedFileIDs).toHaveLength(0)
})
@ -195,7 +198,8 @@ describe('updateChangedFiles', () => {
expect(selection.kind).toBe(ChangesSelectionKind.WorkingDirectory)
const workingDirectorySelection = selection as ChangesWorkingDirectorySelection
const workingDirectorySelection =
selection as ChangesWorkingDirectorySelection
expect(workingDirectorySelection.diff).toBeNull()
})
@ -220,7 +224,8 @@ describe('updateChangedFiles', () => {
const { selection } = updateChangedFiles(prevState, status, false)
expect(selection.kind).toBe(ChangesSelectionKind.WorkingDirectory)
const workingDirectorySelection = selection as ChangesWorkingDirectorySelection
const workingDirectorySelection =
selection as ChangesWorkingDirectorySelection
expect(workingDirectorySelection.diff).toBe(diff)
})
})

View File

@ -193,13 +193,10 @@ describe('text-diff-expansion', () => {
})
it('expands the whole file', async () => {
const { textDiff, newContentLines } = await prepareDiff(35, [
20,
17,
8,
7,
6,
])
const { textDiff, newContentLines } = await prepareDiff(
35,
[20, 17, 8, 7, 6]
)
const expandedDiff = expandWholeTextDiff(textDiff, newContentLines)
expect(expandedDiff!.hunks).toHaveLength(1)

View File

@ -143,15 +143,17 @@ export const highlighter = merge({}, commonConfig, {
modes: {
enforce: true,
name: (mod: any) => {
const builtInMode = /node_modules[\\\/]codemirror[\\\/]mode[\\\/](\w+)[\\\/]/i.exec(
mod.resource
)
const builtInMode =
/node_modules[\\\/]codemirror[\\\/]mode[\\\/](\w+)[\\\/]/i.exec(
mod.resource
)
if (builtInMode) {
return `mode/${builtInMode[1]}`
}
const external = /node_modules[\\\/]codemirror-mode-(\w+)[\\\/]/i.exec(
mod.resource
)
const external =
/node_modules[\\\/]codemirror-mode-(\w+)[\\\/]/i.exec(
mod.resource
)
if (external) {
return `ext/${external[1]}`
}

View File

@ -91,7 +91,7 @@
"legal-eagle": "0.16.0",
"mini-css-extract-plugin": "^2.5.3",
"parallel-webpack": "^2.3.0",
"prettier": "2.0.5",
"prettier": "^2.6.0",
"request": "^2.72.0",
"rimraf": "^2.5.2",
"sass": "^1.27.0",

View File

@ -15,7 +15,8 @@ function formatErrors(errors: ErrorObject[]): string {
.map(error => {
const { dataPath, message } = error
const additionalProperties = error.params as any
const additionalProperty = additionalProperties.additionalProperty as string
const additionalProperty =
additionalProperties.additionalProperty as string
let additionalPropertyText = ''

View File

@ -7389,10 +7389,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==
prettier@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4"
integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==
pretty-error@^4.0.0:
version "4.0.0"