Skip to content

Commit

Permalink
Merge pull request desktop#3402 from desktop/bump-lint-tools
Browse files Browse the repository at this point in the history
update a bunch of lint tools
  • Loading branch information
joshaber authored Nov 27, 2017
2 parents 05086e0 + e2971cc commit 525936a
Show file tree
Hide file tree
Showing 53 changed files with 401 additions and 259 deletions.
4 changes: 3 additions & 1 deletion app/git-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function revParse(gitDir, ref) {

if (!refMatch) {
throw new Error(
`Could not de-reference HEAD to SHA, invalid ref in ${refPath}: ${refContents}`
`Could not de-reference HEAD to SHA, invalid ref in ${refPath}: ${
refContents
}`
)
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/cli/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ function runCommand(name: string) {
throw new CommandError(
`Value passed to flag ${dasherizeOption(
flag
)} was of type ${typeof value}, but was expected to be of type ${expectedType}`
)} was of type ${typeof value}, but was expected to be of type ${
expectedType
}`
)
}
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/cli/open-desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export function openDesktop(url: string = '') {
return ChildProcess.spawn('cmd', ['/c', 'start', url], { env })
} else {
throw new Error(
`Desktop command line interface not currently supported on platform ${process.platform}`
`Desktop command line interface not currently supported on platform ${
process.platform
}`
)
}
}
12 changes: 9 additions & 3 deletions app/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ export class API {
return status
} catch (e) {
log.warn(
`fetchCombinedRefStatus: failed for repository ${owner}/${name} on ref ${ref}`,
`fetchCombinedRefStatus: failed for repository ${owner}/${
name
} on ref ${ref}`,
e
)
throw e
Expand Down Expand Up @@ -707,7 +709,9 @@ async function getNote(): Promise<string> {
localUsername = await username()
} catch (e) {
log.error(
`getNote: unable to resolve machine username, using '${localUsername}' as a fallback`,
`getNote: unable to resolve machine username, using '${
localUsername
}' as a fallback`,
e
)
}
Expand Down Expand Up @@ -787,7 +791,9 @@ export function getOAuthAuthorizationURL(
): string {
const urlBase = getHTMLURL(endpoint)
const scope = encodeURIComponent(Scopes.join(' '))
return `${urlBase}/login/oauth/authorize?client_id=${ClientID}&scope=${scope}&state=${state}`
return `${urlBase}/login/oauth/authorize?client_id=${ClientID}&scope=${
scope
}&state=${state}`
}

export async function requestOAuthToken(
Expand Down
4 changes: 2 additions & 2 deletions app/src/lib/clamp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
/**
* Helper function to coerce a number into a valid range.
*
*
* Ensures that the returned value is at least min and at most
* (inclusive) max.
*/
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/diff-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ export class DiffParser {
if (!str) {
if (!defaultValue) {
throw new Error(
`Group ${group} missing from regexp match and no defaultValue was provided`
`Group ${
group
} missing from regexp match and no defaultValue was provided`
)
}

Expand Down
16 changes: 9 additions & 7 deletions app/src/lib/dispatcher/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ export class Dispatcher {

if (currentError) {
fatalError(
`Unhandled error ${currentError}. This shouldn't happen! All errors should be handled, even if it's just by the default handler.`
`Unhandled error ${
currentError
}. This shouldn't happen! All errors should be handled, even if it's just by the default handler.`
)
}
}
Expand Down Expand Up @@ -802,9 +804,9 @@ export class Dispatcher {
this.handleCloneInDesktopOptions(repository, action)
} else {
log.warn(
`Open Repository from URL failed, did not find repository: ${url} - payload: ${JSON.stringify(
action
)}`
`Open Repository from URL failed, did not find repository: ${
url
} - payload: ${JSON.stringify(action)}`
)
}
break
Expand Down Expand Up @@ -834,9 +836,9 @@ export class Dispatcher {
default:
const unknownAction: IUnknownAction = action
log.warn(
`Unknown URL action: ${unknownAction.name} - payload: ${JSON.stringify(
unknownAction
)}`
`Unknown URL action: ${
unknownAction.name
} - payload: ${JSON.stringify(unknownAction)}`
)
}
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/editors/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export async function launchExternalEditor(
if (!exists) {
const label = __DARWIN__ ? 'Preferences' : 'Options'
throw new ExternalEditorError(
`Could not find executable for '${editor.editor}' at path '${editor.path}'. Please open ${label} and select an available editor.`,
`Could not find executable for '${editor.editor}' at path '${
editor.path
}'. Please open ${label} and select an available editor.`,
{ openPreferences: true }
)
}
Expand Down
8 changes: 6 additions & 2 deletions app/src/lib/editors/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export async function getAvailableEditors(): Promise<
}

log.warn(
`Platform not currently supported for resolving editors: ${process.platform}`
`Platform not currently supported for resolving editors: ${
process.platform
}`
)

return []
Expand Down Expand Up @@ -61,7 +63,9 @@ export async function findEditorOrDefault(
const match = editors.find(p => p.editor === name) || null
if (!match) {
const menuItemName = __DARWIN__ ? 'Preferences' : 'Options'
const message = `The editor '${name}' could not be found. Please open ${menuItemName} and choose an available editor.`
const message = `The editor '${name}' could not be found. Please open ${
menuItemName
} and choose an available editor.`

throw new ExternalEditorError(message, { openPreferences: true })
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/editors/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export function parse(label: string): ExternalEditor | null {
}

throw new Error(
`Platform not currently supported for resolving editors: ${process.platform}`
`Platform not currently supported for resolving editors: ${
process.platform
}`
)
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/lib/enterprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* considered a hard limit, i.e. older versions of GitHub Enterprise
* might (and probably do) work just fine but this should be a fairly
* recent version that we can safely say that we'll work well with.
*
*
* I picked the current minimum (2.8) because it was the version
* running on our internal GitHub Enterprise instance at the time
* we implemented Enterprise sign in (desktop/desktop#664)
Expand Down
4 changes: 2 additions & 2 deletions app/src/lib/equality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export function structuralEquals<T extends object>(
/**
* Performs a shallow equality comparison on the two objects, iterating over
* their keys (non-recursively) and compares their values.
*
*
* This method is functionally identical to that of React's shallowCompare
* function and is intended to be used where we need to test for the same
* kind of equality comparisons that a PureComponent performs.
*
*
* Note that for Arrays and primitive types this method will follow the same
* semantics as Object.is, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
Expand Down
6 changes: 3 additions & 3 deletions app/src/lib/git/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ function getDescriptionForError(error: DugiteError): string {
case DugiteError.SSHAuthenticationFailed:
case DugiteError.SSHPermissionDenied:
case DugiteError.HTTPSAuthenticationFailed:
return `Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open ${__DARWIN__
? 'preferences'
: 'options'} and verify that you're signed in with an account that has permission to access this repository.`
return `Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open ${
__DARWIN__ ? 'preferences' : 'options'
} and verify that you're signed in with an account that has permission to access this repository.`
case DugiteError.RemoteDisconnection:
return 'The remote disconnected. Check your Internet connection and try again.'
case DugiteError.HostDown:
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/git/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ export function spawnAndComplete(
} else {
reject(
new Error(
`Git returned an unexpected exit code '${code}' which should be handled by the caller.'`
`Git returned an unexpected exit code '${
code
}' which should be handled by the caller.'`
)
)
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class APIError extends Error {
message = `${message} (${additionalMessages})`
}
} else {
message = `API error ${response.url}: ${response.statusText} (${response.status})`
message = `API error ${response.url}: ${response.statusText} (${
response.status
})`
}

super(message)
Expand Down
4 changes: 3 additions & 1 deletion app/src/lib/open-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export async function openFile(
if (!result) {
const error = {
name: 'no-external-program',
message: `Unable to open file ${fullPath} in an external program. Please check you have a program associated with this file extension`,
message: `Unable to open file ${
fullPath
} in an external program. Please check you have a program associated with this file extension`,
}
await dispatcher.postError(error)
}
Expand Down
58 changes: 29 additions & 29 deletions app/src/lib/progress/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export interface IProgressStep {
/**
* The title of the git progress event. By title we refer to the
* exact value of the title field in the Git progress struct:
*
*
* https://github.com/git/git/blob/6a2c2f8d34fa1e8f3bb85d159d354810ed63692e/progress.c#L31-L39
*
*
* In essence this means anything up to (but not including) the last colon (:)
* in a single progress line. Take this example progress line
*
*
* remote: Compressing objects: 14% (159/1133)
*
*
* In this case the title would be 'remote: Compressing objects'.
*/
readonly title: string
Expand Down Expand Up @@ -46,7 +46,7 @@ export interface IGitProgress {
* two reasons. Fist, we calculate percent by dividing value with total
* to produce a high precision decimal value between 0 and 1 while
* details.percent is a rounded integer between 0 and 100.
*
*
* Second, the percent in this instance is scaled in relation to any
* other steps included in the progress parser.
*/
Expand All @@ -66,65 +66,65 @@ export interface IGitProgressInfo {
/**
* The title of the git progress event. By title we refer to the
* exact value of the title field in Git's progress struct:
*
*
* https://github.com/git/git/blob/6a2c2f8d34fa1e8f3bb85d159d354810ed63692e/progress.c#L31-L39
*
*
* In essence this means anything up to (but not including) the last colon (:)
* in a single progress line. Take this example progress line
*
*
* remote: Compressing objects: 14% (159/1133)
*
*
* In this case the title would be 'remote: Compressing objects'.
*/
readonly title: string

/**
* The progress value as parsed from the Git progress line.
*
*
* We define value to mean the same as it does in the Git progress struct, i.e
* it's the number of processed units.
*
*
* In the progress line 'remote: Compressing objects: 14% (159/1133)' the
* value is 159.
*
*
* In the progress line 'remote: Counting objects: 123' the value is 123.
*
*
*/
readonly value: number

/**
* The progress total as parsed from the git progress line.
*
*
* We define total to mean the same as it does in the Git progress struct, i.e
* it's the total number of units in a given process.
*
*
* In the progress line 'remote: Compressing objects: 14% (159/1133)' the
* total is 1133.
*
*
* In the progress line 'remote: Counting objects: 123' the total is undefined.
*
*
*/
readonly total?: number

/**
* The progress percent as parsed from the git progress line represented as
* an integer between 0 and 100.
*
*
* We define percent to mean the same as it does in the Git progress struct, i.e
* it's the value divided by total.
*
*
* In the progress line 'remote: Compressing objects: 14% (159/1133)' the
* percent is 14.
*
*
* In the progress line 'remote: Counting objects: 123' the percent is undefined.
*
*
*/
readonly percent?: number

/**
* Whether or not the parsed git progress line indicates that the operation
* is done.
*
*
* This is denoted by a trailing ", done" string in the progress line.
* Example: Checking out files: 100% (728/728), done
*/
Expand All @@ -143,7 +143,7 @@ export interface IGitProgressInfo {
* of the an operation. An operation could be something like `git fetch`
* which contains multiple steps, each individually reported by Git as
* progress events between 0 and 100%.
*
*
* A parser cannot be reused, it's mean to parse a single stderr stream
* for Git.
*/
Expand All @@ -162,7 +162,7 @@ export class GitProgressParser {

/**
* Initialize a new instance of a Git progress parser.
*
*
* @param steps - A series of steps that could be present in the git
* output with relative weight between these steps. Note
* that order is significant here as once the parser sees
Expand Down Expand Up @@ -227,18 +227,18 @@ const valueOnlyRe = /^\d+$/

/**
* Attempts to parse a single line of progress output from Git.
*
*
* For details about how Git formats progress see
*
*
* https://github.com/git/git/blob/6a2c2f8d34fa1e8f3bb85d159d354810ed63692e/progress.c
*
*
* Some examples:
* remote: Counting objects: 123
* remote: Counting objects: 167587, done.
* Receiving objects: 99% (166741/167587), 272.10 MiB | 2.39 MiB/s
* Receiving objects: 99% (166741/167587), 272.10 MiB | 2.39 MiB/s
* Checking out files: 100% (728/728)
* Checking out files: 100% (728/728), done
*
*
* @returns An object containing well-structured information about the progress
* or null if the line could not be parsed as a Git progress line.
*/
Expand Down
2 changes: 1 addition & 1 deletion app/src/lib/progress/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { GitProgressParser } from './git'
/**
* Highly approximate (some would say outright inaccurate) division
* of the individual progress reporting steps in a pull operation.
*
*
* Note: A pull is essentially the same as a fetch except we might
* have to check out some files at the end. We assume that these
* delta updates are fairly quick though.
Expand Down
Loading

0 comments on commit 525936a

Please sign in to comment.