Skip to content

Commit 2f196a1

Browse files
authored
⬆️ Bump flow-bin (#818)
1 parent 3688c87 commit 2f196a1

File tree

19 files changed

+39
-34
lines changed

19 files changed

+39
-34
lines changed

.flowconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@
1414
[strict]
1515

1616
[version]
17-
^0.110.1

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@babel/preset-env": "7.16.11",
6363
"@babel/preset-flow": "7.16.7",
6464
"codecov": "3.8.3",
65-
"flow-bin": "0.110.1",
65+
"flow-bin": "^0.176.2",
6666
"husky": "7.0.4",
6767
"jest": "27.5.1",
6868
"jest-fetch-mock": "3.0.3",

src/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const cli = meow(
4242
}
4343
)
4444

45-
export const options = {
45+
export const options = ({
4646
[FLAGS.COMMIT]: (options: Object) => commands.commit(options),
4747
[FLAGS.CONFIG]: () => commands.config(),
4848
[FLAGS.HOOK]: (options: Object) => commands.commit(options),
@@ -51,6 +51,6 @@ export const options = {
5151
[FLAGS.REMOVE]: () => commands.removeHook(),
5252
[FLAGS.SEARCH]: () => cli.input.map((input) => commands.search(input)),
5353
[FLAGS.UPDATE]: () => commands.update()
54-
}
54+
}: { [$Values<typeof FLAGS>]: Function })
5555

5656
findGitmojiCommand(cli, options)

src/commands/commit/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export type CommitOptions = {
1414
message?: string,
1515
mode: typeof COMMIT_MODES.CLIENT | typeof COMMIT_MODES.HOOK,
1616
scope?: string,
17-
title?: string,
17+
title?: string
1818
}
1919

20-
const promptAndCommit = (options: CommitOptions) =>
20+
const promptAndCommit = (options: CommitOptions): Function =>
2121
getEmojis()
2222
.then((gitmojis) => prompts(gitmojis, options))
2323
.then((questions) => {
@@ -28,7 +28,7 @@ const promptAndCommit = (options: CommitOptions) =>
2828
})
2929
})
3030

31-
const commit = (options: CommitOptions) => {
31+
const commit = (options: CommitOptions): Function => {
3232
if (options.mode === COMMIT_MODES.HOOK) {
3333
registerHookInterruptionHandler()
3434
return cancelIfNeeded().then(() => promptAndCommit(options))

src/commands/commit/withClient/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import isHookCreated from '../../../utils/isHookCreated'
77
import configurationVault from '../../../utils/configurationVault'
88
import { type Answers } from '../prompts'
99

10-
const withClient = async (answers: Answers) => {
10+
const withClient = async (answers: Answers): Promise<void> => {
1111
try {
1212
const scope = answers.scope ? `(${answers.scope}): ` : ''
1313
const title = `${answers.gitmoji} ${scope}${answers.title}`

src/commands/commit/withHook/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const registerHookInterruptionHandler = () => {
2727
})
2828
}
2929

30-
export const cancelIfRebasing = () =>
30+
export const cancelIfRebasing = (): Promise<void> =>
3131
execa('git', ['rev-parse', '--absolute-git-dir']).then(
3232
({ stdout: gitDirectory }) => {
3333
// see https://stackoverflow.com/questions/3921409/how-to-know-if-there-is-a-git-rebase-in-progress
@@ -43,7 +43,7 @@ export const cancelIfRebasing = () =>
4343

4444
export const COMMIT_MESSAGE_SOURCE = 4
4545

46-
export const cancelIfAmending = () =>
46+
export const cancelIfAmending = (): Promise<void> =>
4747
new Promise<void>((resolve) => {
4848
/*
4949
from https://git-scm.com/docs/githooks#_prepare_commit_msg
@@ -62,6 +62,7 @@ export const cancelIfAmending = () =>
6262
})
6363

6464
// I avoid Promise.all to avoid race condition in future cancel callbacks
65-
export const cancelIfNeeded = () => cancelIfAmending().then(cancelIfRebasing)
65+
export const cancelIfNeeded = (): Promise<void> =>
66+
cancelIfAmending().then(cancelIfRebasing)
6667

6768
export default withHook

src/commands/config/prompts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const EMOJI_COMMIT_FORMATS = {
1414
EMOJI: 'emoji'
1515
}
1616

17-
export default () => [
17+
export default (): Array<Object> => [
1818
{
1919
name: CONFIGURATION_PROMPT_NAMES.AUTO_ADD,
2020
message: 'Enable automatic "git add ."',

src/commands/list/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import getEmojis from '../../utils/getEmojis'
33
import printEmojis from '../../utils/printEmojis'
44

5-
const list = () => getEmojis().then((gitmojis) => printEmojis(gitmojis))
5+
const list = (): Promise<void> =>
6+
getEmojis().then((gitmojis) => printEmojis(gitmojis))
67

78
export default list

src/commands/search/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import filterGitmojis from '../../utils/filterGitmojis'
33
import getEmojis from '../../utils/getEmojis'
44
import printEmojis from '../../utils/printEmojis'
55

6-
const search = (query: string) => {
6+
const search = (query: string): Promise<void> => {
77
return getEmojis()
88
.then((gitmojis) => filterGitmojis(query, gitmojis))
99
.then((gitmojisFiltered) => printEmojis(gitmojisFiltered))

src/commands/update/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import getEmojis from '../../utils/getEmojis'
33
import printEmojis from '../../utils/printEmojis'
44

5-
const update = () => getEmojis(true).then((gitmojis) => printEmojis(gitmojis))
5+
const update = (): Promise<void> =>
6+
getEmojis(true).then((gitmojis) => printEmojis(gitmojis))
67

78
export default update

src/constants/flags.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
const FLAGS = {
2+
const FLAGS = Object.freeze({
33
COMMIT: 'commit',
44
CONFIG: 'config',
55
HELP: 'help',
@@ -10,6 +10,6 @@ const FLAGS = {
1010
SEARCH: 'search',
1111
UPDATE: 'update',
1212
VERSION: 'version'
13-
}
13+
})
1414

1515
export default FLAGS

src/utils/buildFetchOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ProxyAgent from 'proxy-agent'
44
const defaultProxy: ?string =
55
process.env.https_proxy || process.env.http_proxy || undefined
66

7-
export const buildAgent = (proxy: ?string = defaultProxy): ?ProxyAgent =>
7+
export const buildAgent = (proxy: ?string = defaultProxy): ?typeof ProxyAgent =>
88
proxy ? new ProxyAgent(proxy) : undefined
99

1010
export const buildFetchOptions = (

src/utils/configurationVault.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ import {
66
EMOJI_COMMIT_FORMATS
77
} from '../commands/config/prompts'
88

9-
export const config = new Conf({ projectName: 'gitmoji' })
9+
export const config: typeof Conf = new Conf({ projectName: 'gitmoji' })
1010

11-
const setAutoAdd = (autoAdd: boolean) => {
11+
const setAutoAdd = (autoAdd: boolean): void => {
1212
config.set(CONFIGURATION_PROMPT_NAMES.AUTO_ADD, autoAdd)
1313
}
1414

15-
const setEmojiFormat = (emojiFormat: string) => {
15+
const setEmojiFormat = (emojiFormat: string): void => {
1616
config.set(CONFIGURATION_PROMPT_NAMES.EMOJI_FORMAT, emojiFormat)
1717
}
1818

19-
const setSignedCommit = (signedCommit: boolean) => {
19+
const setSignedCommit = (signedCommit: boolean): void => {
2020
config.set(CONFIGURATION_PROMPT_NAMES.SIGNED_COMMIT, signedCommit)
2121
}
2222

23-
const setScopePrompt = (scopePrompt: boolean) => {
23+
const setScopePrompt = (scopePrompt: boolean): void => {
2424
config.set(CONFIGURATION_PROMPT_NAMES.SCOPE_PROMPT, scopePrompt)
2525
}
2626

27-
const setGitmojisUrl = (gitmojisUrl: string) => {
27+
const setGitmojisUrl = (gitmojisUrl: string): void => {
2828
config.set(CONFIGURATION_PROMPT_NAMES.GITMOJIS_URL, gitmojisUrl)
2929
}
3030

src/utils/emojisCache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const GITMOJI_CACHE: Object = {
99
FILE: 'gitmojis.json'
1010
}
1111

12-
export const CACHE_PATH = path.join(
12+
export const CACHE_PATH: string = path.join(
1313
os.homedir(),
1414
GITMOJI_CACHE.FOLDER,
1515
GITMOJI_CACHE.FILE

src/utils/filterGitmojis.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export const options = {
1717
]
1818
}
1919

20-
const filterGitmojis = (input: ?string, gitmojis: Array<Gitmoji>) => {
20+
const filterGitmojis = (
21+
input: ?string,
22+
gitmojis: Array<Gitmoji>
23+
): Function | Array<Object> => {
2124
const fuse = new Fuse(gitmojis, options)
2225

2326
return input ? fuse.search(input).map((gitmoji) => gitmoji.item) : gitmojis

src/utils/findGitmojiCommand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import COMMIT_MODES from '../constants/commit'
33
import FLAGS from '../constants/flags'
44

5-
const getOptionsForCommand = (command: ?string, flags: Object) => {
5+
const getOptionsForCommand = (command: ?string, flags: Object): ?Object => {
66
const commandsWithOptions = [FLAGS.COMMIT, FLAGS.HOOK]
77

88
if (commandsWithOptions.includes(command)) {
@@ -17,7 +17,7 @@ const getOptionsForCommand = (command: ?string, flags: Object) => {
1717
return null
1818
}
1919

20-
const findGitmojiCommand = (cli: any, options: Object) => {
20+
const findGitmojiCommand = (cli: any, options: Object): void => {
2121
const flags = cli.flags
2222
const commandFlag = Object.keys(flags)
2323
.map((flag) => flags[flag] && flag)

src/utils/isHookCreated.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from 'fs'
44
import HOOK from '../commands/hook/hook'
55
import getAbsoluteHooksPath from './getAbsoluteHooksPath'
66

7-
const isHookCreated = async () => {
7+
const isHookCreated = async (): Promise<?boolean> => {
88
try {
99
const hookFile = await getAbsoluteHooksPath(HOOK.FILENAME)
1010

src/utils/printEmojis.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type Gitmoji = {
88
description: string
99
}
1010

11-
const printEmojis = (gitmojis: Array<Gitmoji>) => {
11+
const printEmojis = (gitmojis: Array<Gitmoji>): void => {
1212
return gitmojis.forEach((gitmoji) => {
1313
console.log(
1414
`${gitmoji.emoji} - ${chalk.blue(gitmoji.code)} - ${gitmoji.description}`

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,10 +2524,10 @@ find-up@^4.0.0, find-up@^4.1.0:
25242524
locate-path "^5.0.0"
25252525
path-exists "^4.0.0"
25262526

2527-
flow-bin@0.110.1:
2528-
version "0.110.1"
2529-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.110.1.tgz#24ac70bf0871a5d6bc181ba99801ded4d5e3b442"
2530-
integrity sha512-6FhvNKNvPQ523mx7sqNxTQvI/HgAWa/pbIsQuCst53qRqs387EFfYqgm4I3Zae5HLaVFacBwgWKmjKd92vf19w==
2527+
flow-bin@^0.176.2:
2528+
version "0.176.2"
2529+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.176.2.tgz#b257da3ebd131b368c95c72e010dc823bfa159e8"
2530+
integrity sha512-gX3YJvv40oRY7A/ytEsWLDMHTfIkmy6ir1D4e5fklVsj3958iTg90cO8XwDdspnxQSgEUP1HW1e6wlX1OlQ5+Q==
25312531

25322532
foreach@^2.0.5:
25332533
version "2.0.5"

0 commit comments

Comments
 (0)