Skip to content

Commit b357026

Browse files
committedJun 18, 2021
test: 🚨 fixed linting errors
1 parent fc8b67c commit b357026

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed
 

‎__tests__/config.ts

+6-13
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,31 @@ test("load config", async () => {
99

1010
test("missing prop code", () => {
1111
expect(() => {
12-
const config = ({ devmoji: [{ foo: 1 }] } as unknown) as ConfigOptions
12+
const config = { devmoji: [{ foo: 1 }] } as unknown as ConfigOptions
1313
new Config(config)
1414
}).toThrow(/code is missing/)
1515
})
1616

1717
test("missing prop emoji", () => {
1818
expect(() => {
19-
const config = ({
19+
const config = {
2020
devmoji: [{ code: "foo" }],
21-
} as unknown) as ConfigOptions
21+
} as unknown as ConfigOptions
2222
new Config(config)
2323
}).toThrow(/Missing.*emoji.*/)
2424
})
2525

26-
test("missing config file", () => {
27-
expect.assertions(1)
28-
return Config.load("missing-config-file").catch((error) =>
29-
expect(error).toMatch(/missing.*/)
30-
)
31-
})
32-
3326
test("config without devmoji", () => {
34-
const config = ({ types: [] } as unknown) as ConfigOptions
27+
const config = { types: [] } as unknown as ConfigOptions
3528
expect(() => {
3629
new Config(config)
3730
}).not.toThrow()
3831
})
3932

4033
test("invalid gitmoji", () => {
41-
const config = ({
34+
const config = {
4235
devmoji: [{ code: "test", gitmoji: "foobar" }],
43-
} as unknown) as ConfigOptions
36+
} as unknown as ConfigOptions
4437
expect(() => {
4538
new Config(config)
4639
}).toThrow(/Gitmoji .* not found/)

‎src/cli.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ export class Cli {
2323
if (/^([rR]evert)/.test(text)) return []
2424

2525
const errors = []
26-
const match = /^(?<type>:?[a-z-]+)(?:\((?<scope>[a-z-0-9]+)\))?(!?):\s+(?<description>.*)/iu.exec(
27-
text
28-
)
26+
const match =
27+
/^(?<type>:?[a-z-]+)(?:\((?<scope>[a-z-0-9]+)\))?(!?):\s+(?<description>.*)/iu.exec(
28+
text
29+
)
2930
if (match) {
3031
const type = match.groups?.type ?? ""
3132
const description = match.groups?.description

‎src/conventional-commits.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { Devmoji } from "./devmoji"
22
import chalk from "chalk"
33

44
export class ConventionalCommits {
5-
regex = /(?<type>:?[a-z-]+)(?:\((?<scope>[a-z-0-9]+)\))?(!?):\s*(?:(?<other>(?::[a-z-]+:\s*)+)\s*)?/gimu
5+
regex =
6+
/(?<type>:?[a-z-]+)(?:\((?<scope>[a-z-0-9]+)\))?(!?):\s*(?:(?<other>(?::[a-z-]+:\s*)+)\s*)?/gimu
7+
68
constructor(public devmoji: Devmoji) {}
79

810
formatCommit(text: string, color = false) {

‎src/devmoji.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { github, gitmoji } from "./emoji-pack"
44
export class Devmoji {
55
shortcodeRegex = /:([a-zA-Z0-9_\-+]+):/g
66
shortcodeSpaceRegex = /\s?:([a-zA-Z0-9_\-+]+):/g
7-
unicodeRegex = /((?:\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])\ufe0f?)/g
7+
unicodeRegex =
8+
/((?:\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])\ufe0f?)/g
89

910
constructor(public config: Config) {}
1011

‎src/scripts/updater.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function update() {
4141
})
4242

4343
fetch("https://api.github.com/emojis", { method: "GET" })
44-
.then((res) => (res.json() as unknown) as Record<string, string>)
44+
.then((res) => res.json() as unknown as Record<string, string>)
4545
.then((json) => {
4646
const regex = /unicode\/(.*)\.png.*/
4747
let added = 0
@@ -90,7 +90,7 @@ export async function update() {
9090
{ method: "GET" }
9191
)
9292
.then(
93-
(res) => (res.json() as unknown) as { gitmojis: Record<string, unknown> }
93+
(res) => res.json() as unknown as { gitmojis: Record<string, unknown> }
9494
)
9595
.then((json) => {
9696
fs.writeFileSync(

0 commit comments

Comments
 (0)
Please sign in to comment.