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 const BrightClassPostfix = '-br'
// export for testing // export for testing
// match characters that could be enclosing url to cleanly handle url formatting // 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 * 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 * (?:(?:;[0-9]{0,3})*)?: Match one or more occurrences of the format we want with semicolon
*/ */
// eslint-disable-next-line no-control-regex // 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 * 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. */ /** Fetch all repos a user has access to. */
public async fetchRepositories(): Promise<ReadonlyArray< public async fetchRepositories(): Promise<ReadonlyArray<IAPIRepository> | null> {
IAPIRepository
> | null> {
try { try {
const repositories = await this.fetchAll<IAPIRepository>('user/repos') const repositories = await this.fetchAll<IAPIRepository>('user/repos')
// "But wait, repositories can't have a null owner" you say. // "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. * Note: NOT meant for direct consumption, only exported for testability reasons.
* Consumers should use the various `supports*` methods instead. * Consumers should use the various `supports*` methods instead.
*/ */
export const endpointSatisfies = ( export const endpointSatisfies =
{ dotcom, ae, es }: VersionConstraint, ({ dotcom, ae, es }: VersionConstraint, getVersion = getEndpointVersion) =>
getVersion = getEndpointVersion (ep: string) =>
) => (ep: string) => checkConstraint(dotcom, isDotCom(ep)) ||
checkConstraint(dotcom, isDotCom(ep)) || checkConstraint(ae, isGHAE(ep), assumedGHAEVersion) ||
checkConstraint(ae, isGHAE(ep), assumedGHAEVersion) || checkConstraint(es, isGHES(ep), getVersion(ep) ?? assumedGHESVersion)
checkConstraint(es, isGHES(ep), getVersion(ep) ?? assumedGHESVersion)
/** /**
* Whether or not the endpoint supports the internal GitHub Enterprise Server * 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. // matching `query` against itself is a perfect match.
const maxScore = score(query, query, 1) const maxScore = score(query, query, 1)
const result = items const result = items
.map( .map((item): IMatch<T> => {
(item): IMatch<T> => { const matches: Array<ReadonlyArray<number>> = []
const matches: Array<ReadonlyArray<number>> = [] const itemTextArray = getKey(item)
const itemTextArray = getKey(item) itemTextArray.forEach(text => {
itemTextArray.forEach(text => { matches.push(fuzzAldrin.match(text, query))
matches.push(fuzzAldrin.match(text, query)) })
})
return { return {
score: score(itemTextArray.join(''), query, maxScore), score: score(itemTextArray.join(''), query, maxScore),
item, item,
matches: { matches: {
title: matches[0], title: matches[0],
subtitle: matches.length > 1 ? matches[1] : [], subtitle: matches.length > 1 ? matches[1] : [],
}, },
}
} }
) })
.filter( .filter(
({ matches }) => matches.title.length > 0 || matches.subtitle.length > 0 ({ 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 * about to `stderr` - this rule here will catch this and also the to/from
* changes based on what the user has configured. * 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 * Utility function for inspecting the stderr output for the line endings

View file

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

View file

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

View file

@ -59,7 +59,8 @@ export function escapeRegExp(expression: string) {
* example return [ "LargeFile.exe (150.00 MB)", "AlsoTooLargeOfAFile.txt (1.00 GB)" ] * example return [ "LargeFile.exe (150.00 MB)", "AlsoTooLargeOfAFile.txt (1.00 GB)" ]
*/ */
export function getFileFromExceedsError(error: string): string[] { 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 beginRegex = /(^remote:\serror:\sFile\s)/gm
const beginMatches = Array.from(error.matchAll(beginRegex)) const beginMatches = Array.from(error.matchAll(beginRegex))
const endMatches = Array.from(error.matchAll(endRegex)) const endMatches = Array.from(error.matchAll(endRegex))

View file

@ -108,8 +108,6 @@ export type RequestResponseChannels = {
options: Electron.OpenDialogOptions options: Electron.OpenDialogOptions
) => Promise<string | null> ) => Promise<string | null>
'is-window-maximized': () => Promise<boolean> 'is-window-maximized': () => Promise<boolean>
'get-apple-action-on-double-click': () => Promise< 'get-apple-action-on-double-click': () => Promise<Electron.AppleActionOnDoubleClickPref>
Electron.AppleActionOnDoubleClickPref
>
'should-use-dark-colors': () => Promise<boolean> '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 /** A regular expression to match a group of an repo name or name with owner
* Example: desktop/dugite or desktop * 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 /** A regular expression to match a group possible of preceding markers are
* gh-, #, /issues/, /pull/, or /discussions/ followed by a digit * 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 * 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_`])/ private readonly beginStringNonWord = /(^|[^a-zA-Z0-9_`])/
// @username and @username_emu for enterprise managed users support // @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 // without a trailing slash
private readonly withoutTrailingSlash = /(?!\/)/ 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 // 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 // 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 // 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 // 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 // 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 * Parse the Git output of a merge-tree command to identify whether it

View file

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

View file

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

View file

@ -2,10 +2,12 @@
const squirrelMissingRegex = /^Can not find Squirrel$/ const squirrelMissingRegex = /^Can not find Squirrel$/
// an error that occurs when Squirrel isn't able to reach the update server // 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 // 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 * 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) { 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) const matches = promptRegex.exec(prompt)
if (matches === null || matches.length < 5) { if (matches === null || matches.length < 5) {

View file

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

View file

@ -91,7 +91,8 @@ export function parsePorcelainStatus(
} }
// 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path> // 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 { function parseChangedEntry(field: string): IStatusEntry {
const match = changedEntryRe.exec(field) 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> // 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( function parsedRenamedOrCopiedEntry(
field: string, field: string,
@ -128,7 +130,8 @@ function parsedRenamedOrCopiedEntry(
} }
// u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path> // 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 { function parseUnmergedEntry(field: string): IStatusEntry {
const match = unmergedEntryRe.exec(field) const match = unmergedEntryRe.exec(field)

View file

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

View file

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

View file

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

View file

@ -65,10 +65,8 @@ async function handleSSHKeyPassphrase(
return storedPassphrase return storedPassphrase
} }
const { const { passphrase, storePassphrase } =
passphrase, await trampolineUIHelper.promptSSHKeyPassphrase(keyPath)
storePassphrase,
} = await trampolineUIHelper.promptSSHKeyPassphrase(keyPath)
// If the user wanted us to remember the passphrase, we'll keep it around to // If the user wanted us to remember the passphrase, we'll keep it around to
// store it later if the git operation succeeds. // store it later if the git operation succeeds.
@ -86,38 +84,39 @@ async function handleSSHKeyPassphrase(
return passphrase ?? '' return passphrase ?? ''
} }
export const askpassTrampolineHandler: TrampolineCommandHandler = async command => { export const askpassTrampolineHandler: TrampolineCommandHandler =
if (command.parameters.length !== 1) { async command => {
return undefined if (command.parameters.length !== 1) {
}
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) {
return undefined return undefined
} }
const key = getKeyForEndpoint(endpoint) const firstParameter = command.parameters[0]
const token = await TokenStore.getItem(key, username)
return token ?? undefined
}
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) seenIds.add(id)
if (item.submenu) { if (item.submenu) {
const subMenuTemplate = item.submenu as ReadonlyArray< const subMenuTemplate =
Electron.MenuItemConstructorOptions item.submenu as ReadonlyArray<Electron.MenuItemConstructorOptions>
>
ensureItemIds(subMenuTemplate, item.id, seenIds) ensureItemIds(subMenuTemplate, item.id, seenIds)
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -27,7 +27,8 @@ export interface IEmojiHit {
/** Autocompletion provider for emoji. */ /** Autocompletion provider for emoji. */
export class EmojiAutocompletionProvider export class EmojiAutocompletionProvider
implements IAutocompletionProvider<IEmojiHit> { implements IAutocompletionProvider<IEmojiHit>
{
public readonly kind = 'emoji' public readonly kind = 'emoji'
private readonly emoji: Map<string, string> 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. */ /** The autocompletion provider for issues in a GitHub repository. */
export class IssuesAutocompletionProvider export class IssuesAutocompletionProvider
implements IAutocompletionProvider<IIssueHit> { implements IAutocompletionProvider<IIssueHit>
{
public readonly kind = 'issue' public readonly kind = 'issue'
private readonly issuesStore: IssuesStore private readonly issuesStore: IssuesStore

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -111,9 +111,7 @@ function findRepositoryForListItem(
return repositories.find(r => r.clone_url === listItem.url) || null return repositories.find(r => r.clone_url === listItem.url) || null
} }
export class CloneableRepositoryFilterList extends React.PureComponent< export class CloneableRepositoryFilterList extends React.PureComponent<ICloneableRepositoryFilterListProps> {
ICloneableRepositoryFilterListProps
> {
/** /**
* A memoized function for grouping repositories for display * A memoized function for grouping repositories for display
* in the FilterList. The group will not be recomputed as long * 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 ( CodeMirror.defineMode(
config: CodeMirror.EditorConfiguration, DiffSyntaxMode.ModeName,
modeOptions?: IDiffSyntaxModeOptions function (
) { config: CodeMirror.EditorConfiguration,
if (!modeOptions) { modeOptions?: IDiffSyntaxModeOptions
throw new Error('I needs me some options') ) {
} if (!modeOptions) {
throw new Error('I needs me some options')
}
return new DiffSyntaxMode( return new DiffSyntaxMode(
modeOptions.hunks, modeOptions.hunks,
modeOptions.oldTokens, modeOptions.oldTokens,
modeOptions.newTokens modeOptions.newTokens
) )
}) }
)

View file

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

View file

@ -63,8 +63,7 @@ import { HiddenBidiCharsWarning } from './hidden-bidi-chars-warning'
export const narrowNoNewlineSymbol = { export const narrowNoNewlineSymbol = {
w: 16, w: 16,
h: 8, h: 8,
d: 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',
'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 type ChangedFile = WorkingDirectoryFileChange | CommittedFileChange
@ -281,7 +280,8 @@ const defaultEditorOptions: EditorConfiguration = {
scrollbarStyle: __DARWIN__ ? 'simple' : 'native', scrollbarStyle: __DARWIN__ ? 'simple' : 'native',
styleSelectedText: true, styleSelectedText: true,
lineSeparator: '\n', 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], gutters: [diffGutterName],
} }
@ -1009,9 +1009,8 @@ export class TextDiff extends React.Component<ITextDiffProps, ITextDiffState> {
) )
const gutterParentElement = cm.getGutterElement() const gutterParentElement = cm.getGutterElement()
const gutterElement = gutterParentElement.getElementsByClassName( const gutterElement =
diffGutterName gutterParentElement.getElementsByClassName(diffGutterName)[0]
)[0]
const newStyle = `width: ${diffSize * 2}px;` const newStyle = `width: ${diffSize * 2}px;`
const currentStyle = gutterElement.getAttribute('style') const currentStyle = gutterElement.getAttribute('style')

View file

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

View file

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

View file

@ -424,7 +424,8 @@ export async function rebaseConflictsHandler(
return null 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 * Attempts to detect whether an error is the result of a failed push
@ -469,7 +470,8 @@ export async function refusedWorkflowUpdate(
return null 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 * 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 windowHeight = window.innerHeight
const bottomOfButton = this.invokeButtonRef.getBoundingClientRect().bottom const bottomOfButton = this.invokeButtonRef.getBoundingClientRect().bottom
const invokeButtonHeight = this.invokeButtonRef.getBoundingClientRect() const invokeButtonHeight =
.height this.invokeButtonRef.getBoundingClientRect().height
// 15 pixels is just to give some padding room below it // 15 pixels is just to give some padding room below it
const calcMaxHeight = windowHeight - bottomOfButton - 15 const calcMaxHeight = windowHeight - bottomOfButton - 15
const heightOfOptions = this.optionsContainerRef.clientHeight const heightOfOptions = this.optionsContainerRef.clientHeight
@ -180,11 +180,8 @@ export class DropdownSelectButton extends React.Component<
public render() { public render() {
const { options, disabled } = this.props const { options, disabled } = this.props
const { const { selectedOption, optionsPositionBottom, showButtonOptions } =
selectedOption, this.state
optionsPositionBottom,
showButtonOptions,
} = this.state
if (options.length === 0 || selectedOption === null) { if (options.length === 0 || selectedOption === null) {
return return
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,17 +23,14 @@ export const AvailableDragAndDropIntros: Record<
> = { > = {
[DragAndDropIntroType.CherryPick]: { [DragAndDropIntroType.CherryPick]: {
title: 'Drag and drop to cherry-pick!', title: 'Drag and drop to cherry-pick!',
body: 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.',
'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]: { [DragAndDropIntroType.Squash]: {
title: 'Drag and drop to squash!', title: 'Drag and drop to squash!',
body: body: 'Squash commits by dragging and dropping them onto another commit, or by right-clicking on multiple commits.',
'Squash commits by dragging and dropping them onto another commit, or by right-clicking on multiple commits.',
}, },
[DragAndDropIntroType.Reorder]: { [DragAndDropIntroType.Reorder]: {
title: 'Drag and drop to reorder!', title: 'Drag and drop to reorder!',
body: body: 'Reorder commits to tidy up your history by dragging and dropping them to a different position.',
'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. * are inclusive and this method takes that into account.
*/ */
function posIsInsideMarkedText(doc: Doc, pos: Position) { 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) const ix = doc.indexFromPos(pos)
return marks.some(mark => { return marks.some(mark => {
@ -190,7 +190,7 @@ function appendTextMarker(
doc.replaceRange(text, from) doc.replaceRange(text, from)
const to = doc.posFromIndex(Infinity) 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 { ): ActualTextMarker {
const elem = renderHandleMarkReplacementElement(author) const elem = renderHandleMarkReplacementElement(author)
return (doc.markText(from, to, { return doc.markText(from, to, {
atomic: true, atomic: true,
className: 'handle', className: 'handle',
readOnly: false, readOnly: false,
replacedWith: elem, replacedWith: elem,
handleMouseEvents: true, handleMouseEvents: true,
}) as any) as ActualTextMarker }) as any as ActualTextMarker
} }
function triggerAutoCompleteBasedOnCursorPosition(cm: Editor) { 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. // 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 // This marker will be styled in such a way as to indicate that it's
// processing. // processing.
const tmpMark = (doc.markText(from, end, { const tmpMark = doc.markText(from, end, {
atomic: true, atomic: true,
className: 'handle progress', className: 'handle progress',
readOnly: false, readOnly: false,
replacedWith: renderUnknownHandleMarkReplacementElement(username, false), replacedWith: renderUnknownHandleMarkReplacementElement(username, false),
handleMouseEvents: true, handleMouseEvents: true,
}) as any) as ActualTextMarker }) as any as ActualTextMarker
// Note that it's important that this method isn't async up until // Note that it's important that this method isn't async up until
// this point since show-hint expects a synchronous method // 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> { 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) { private initializeCodeMirror(host: HTMLDivElement) {

View file

@ -39,8 +39,7 @@ interface IAvatarState {
const DefaultAvatarSymbol = { const DefaultAvatarSymbol = {
w: 16, w: 16,
h: 16, h: 16,
d: 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',
'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 readonly onError: (e: Error) => void
} }
export class ConfigLockFileExists extends React.Component< export class ConfigLockFileExists extends React.Component<IConfigLockFileExistsProps> {
IConfigLockFileExistsProps
> {
private onDeleteLockFile = async () => { private onDeleteLockFile = async () => {
try { try {
await unlink(this.props.lockFilePath) 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) { if (this.props.onFilterListResultsChanged !== undefined) {
const itemCount = this.state.rows.filter(row => row.kind === 'item') const itemCount = this.state.rows.filter(
.length row => row.kind === 'item'
).length
this.props.onFilterListResultsChanged(itemCount) 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 * 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. * email doesn't match any of the emails in their GitHub (Enterprise) account.
*/ */
export class GitEmailNotFoundWarning extends React.Component< export class GitEmailNotFoundWarning extends React.Component<IGitEmailNotFoundWarningProps> {
IGitEmailNotFoundWarningProps
> {
public render() { public render() {
const { accounts, email } = this.props const { accounts, email } = this.props

View file

@ -592,9 +592,8 @@ export class List extends React.Component<IListProps, IListState> {
return this.moveSelection(direction, source) return this.moveSelection(direction, source)
} }
const lastSelection = this.props.selectedRows[ const lastSelection =
this.props.selectedRows.length - 1 this.props.selectedRows[this.props.selectedRows.length - 1]
]
const selectionOrigin = this.props.selectedRows[0] 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) * @param normalizedPath The normalized path (i.e. no '.' or '..' characters in path)
*/ */
export function extract( export function extract(normalizedPath: string): {
normalizedPath: string normalizedFileName: string
): { normalizedFileName: string; normalizedDirectory: string } { normalizedDirectory: string
} {
// for untracked submodules the status entry is returned as a path with a // 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 // trailing path separator which causes the directory to be trimmed in a weird
// way below. let's try to resolve this here // 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 * Parses and sanitizes markdown into html and outputs it inside a sandboxed
* iframe. * iframe.
**/ **/
export class SandboxedMarkdown extends React.PureComponent< export class SandboxedMarkdown extends React.PureComponent<ISandboxedMarkdownProps> {
ISandboxedMarkdownProps
> {
private frameRef: HTMLIFrameElement | null = null private frameRef: HTMLIFrameElement | null = null
private frameContainingDivRef: HTMLDivElement | null = null private frameContainingDivRef: HTMLDivElement | null = null
private contentDivRef: 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 * to add a wrapping element around the content. supports all the options that
* the Tooltip component does without having to worry about refs. * the Tooltip component does without having to worry about refs.
**/ **/
export class TooltippedContent extends React.Component< export class TooltippedContent extends React.Component<ITooltippedContentProps> {
ITooltippedContentProps
> {
private wrapperRef = createObservableRef<HTMLElement>() private wrapperRef = createObservableRef<HTMLElement>()
public render() { public render() {
const { const { tooltip, tagName, children, className, tooltipClassName, ...rest } =
tooltip, this.props
tagName,
children,
className,
tooltipClassName,
...rest
} = this.props
return React.createElement(tagName ?? 'span', { return React.createElement(tagName ?? 'span', {
ref: this.wrapperRef, ref: this.wrapperRef,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -42,9 +42,7 @@ interface ICreateTutorialRepositoryDialogProps {
* A dialog component responsible for initializing, publishing, and adding * A dialog component responsible for initializing, publishing, and adding
* a tutorial repository to the application. * a tutorial repository to the application.
*/ */
export class CreateTutorialRepositoryDialog extends React.Component< export class CreateTutorialRepositoryDialog extends React.Component<ICreateTutorialRepositoryDialogProps> {
ICreateTutorialRepositoryDialogProps
> {
public onSubmit = () => public onSubmit = () =>
this.props.onCreateTutorialRepository(this.props.account) 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, optOutOfUsageTracking: this.props.optOutOfUsageTracking,
confirmRepositoryRemoval: this.props.confirmRepositoryRemoval, confirmRepositoryRemoval: this.props.confirmRepositoryRemoval,
confirmDiscardChanges: this.props.confirmDiscardChanges, confirmDiscardChanges: this.props.confirmDiscardChanges,
confirmDiscardChangesPermanently: this.props confirmDiscardChangesPermanently:
.confirmDiscardChangesPermanently, this.props.confirmDiscardChangesPermanently,
confirmForcePush: this.props.confirmForcePush, confirmForcePush: this.props.confirmForcePush,
uncommittedChangesStrategy: this.props.uncommittedChangesStrategy, uncommittedChangesStrategy: this.props.uncommittedChangesStrategy,
availableShells, availableShells,

View file

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

View file

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

View file

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

View file

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

View file

@ -54,9 +54,7 @@ interface IStashDiffViewerProps {
* *
* _(Like viewing a selected commit in history but for a stash)_ * _(Like viewing a selected commit in history but for a stash)_
*/ */
export class StashDiffViewer extends React.PureComponent< export class StashDiffViewer extends React.PureComponent<IStashDiffViewerProps> {
IStashDiffViewerProps
> {
private onSelectedFileChanged = (file: CommittedFileChange) => private onSelectedFileChanged = (file: CommittedFileChange) =>
this.props.dispatcher.selectStashedFile(this.props.repository, file) 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 * Wraps a list of suggested action components with extra styling
* and animations. * 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') const cn = 'suggested-action-group ' + (props.type ? props.type : 'normal')
if (props.transitions === 'replace') { if (props.transitions === 'replace') {
const enableTransitions = const enableTransitions =

View file

@ -28,9 +28,7 @@ interface ITutorialStepInstructionsProps {
} }
/** A step (summary and expandable description) in the tutorial side panel */ /** A step (summary and expandable description) in the tutorial side panel */
export class TutorialStepInstructions extends React.Component< export class TutorialStepInstructions extends React.Component<ITutorialStepInstructionsProps> {
ITutorialStepInstructionsProps
> {
public render() { public render() {
return ( return (
<li key={this.props.sectionId} onClick={this.onSummaryClick}> <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 * The dialog shown when a repository is a fork but its upstream remote doesn't
* point to the parent repository. * point to the parent repository.
*/ */
export class UpstreamAlreadyExists extends React.Component< export class UpstreamAlreadyExists extends React.Component<IUpstreamAlreadyExistsProps> {
IUpstreamAlreadyExistsProps
> {
public render() { public render() {
const name = this.props.repository.name const name = this.props.repository.name
const gitHubRepository = forceUnwrap( 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'. * The conflicted file will be 'foo'. There will also be uncommitted changes unrelated to the merge in 'perlin'.
*/ */
export async function setupConflictedRepoWithUnrelatedCommittedChange(): Promise< export async function setupConflictedRepoWithUnrelatedCommittedChange(): Promise<Repository> {
Repository
> {
const repo = await setupEmptyRepository() const repo = await setupEmptyRepository()
const firstCommit = { const firstCommit = {
@ -184,9 +182,7 @@ export async function setupConflictedRepoWithUnrelatedCommittedChange(): Promise
* *
* The conflicted files will be 'foo', 'bar', and 'baz'. * The conflicted files will be 'foo', 'bar', and 'baz'.
*/ */
export async function setupConflictedRepoWithMultipleFiles(): Promise< export async function setupConflictedRepoWithMultipleFiles(): Promise<Repository> {
Repository
> {
const repo = await setupEmptyRepository() const repo = await setupEmptyRepository()
const firstCommit = { const firstCommit = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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