Skip to content

No stateless classes - #629

Merged
joshaber merged 53 commits into
masterfrom
no-stateless-class
Nov 15, 2016
Merged

joshaber merged 53 commits into
masterfrom
no-stateless-class

Conversation

@niik

@niik niik commented Nov 14, 2016 •

Copy link
Copy Markdown
Member

This PR turns on the no-stateless-class tslint rule, see #590. The, by-far, biggest violator of that rule is the LocalGitOperations class so in order to satisfy the rule I've split up LocalGitOperations into individual modules. These modules are tentatively named after the git command the functions within primarily use.

I imagine we’ll iterate on the naming and where things live in the future but this gets us going and TBH, I kind of like the layout. It makes it a tad bit trickier to find a method like getBranches if you don't know that under the hood that function uses for-each-ref but I think we can live with it.

The only other downside I can think of with this naming scheme is that as we figure out better ways of getting the data we want we might have to move methods around. That pain should be alleviated by the index.ts file though as long as consumers import from that rather than individual files within the git directory.

I've also taken the opportunity to fix all our Type 'IGitResult' is not assignable to type 'void' errors by converting methods that looked like

export function fetch(repository: Repository, user: User | null, remote: string): Promise<void> {
  return git([ 'fetch', '--prune', remote ], repository.path, { env: envForAuthentication(user) })
}

into

export async function fetch(repository: Repository, user: User | null, remote: string): Promise<void> {
  await git([ 'fetch', '--prune', remote ], repository.path, { env: envForAuthentication(user) })
}

@niik niik changed the title [WIP] No stateless classes No stateless classes Nov 15, 2016
@niik

niik commented Nov 15, 2016

Copy link
Copy Markdown
Member Author

This is ready for review and it has the potential to create the mother of all merge conflicts so a review would be muuuuch appreciated

@joshaber joshaber self-assigned this Nov 15, 2016

@joshaber joshaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on 💖

import { LocalGitOperations, Commit, Branch, BranchType } from '../local-git-operations'
import { GitDiff } from '../git/git-diff'
import { Branch, BranchType } from '../../models/branch'
import { Commit } from '../../models/commit'

This comment was marked as spam.

@joshaber
joshaber merged commit 52eef71 into master Nov 15, 2016
@joshaber
joshaber deleted the no-stateless-class branch November 15, 2016 15:58
mijiang168 pushed a commit to mijiang168/desktop that referenced this pull request Apr 22, 2022
mijiang168 pushed a commit to mijiang168/desktop that referenced this pull request Apr 22, 2022
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Jan 22, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Jan 22, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants