|
1 |
| -import {Commit, Repo} from '../../collect/collect.js' |
2 |
| -import {BadgePresenter, Present} from '../../badges.js' |
| 1 | +import { Commit, Repo } from '../../collect/collect.js' |
| 2 | +import { BadgePresenter, Present } from '../../badges.js' |
3 | 3 |
|
4 |
| -export default new class implements BadgePresenter { |
| 4 | +export default new (class implements BadgePresenter { |
5 | 5 | url = new URL(import.meta.url)
|
6 |
| - badges = [ |
7 |
| - 'dead-commit', |
8 |
| - ] as const |
| 6 | + badges = ['dead-commit'] as const |
9 | 7 | present: Present = (data, grant) => {
|
10 |
| - const commits: {repo: Repo, commit: Commit}[] = [] |
| 8 | + const commits: { repo: Repo; commit: Commit }[] = [] |
11 | 9 |
|
12 | 10 | for (const repo of data.repos) {
|
13 | 11 | for (const commit of repo.commits) {
|
14 | 12 | if (commit.sha.includes('dead')) {
|
15 |
| - commits.push({repo, commit}) |
| 13 | + commits.push({ repo, commit }) |
16 | 14 | }
|
17 | 15 | }
|
18 | 16 | }
|
19 | 17 |
|
20 |
| - const text = commits.map(({repo, commit}) => { |
21 |
| - const sha = commit.sha.replace(/dead/, '<strong>dead</strong>') |
22 |
| - return `- <a href="https://github.com/${repo.owner.login}/${repo.name}/commit/${commit.sha}">${sha}</a>` |
23 |
| - }).join('\n') |
| 18 | + const text = commits |
| 19 | + .map(({ repo, commit }) => { |
| 20 | + const sha = commit.sha.replace(/dead/, '<strong>dead</strong>') |
| 21 | + return `- <a href="https://github.com/${repo.owner.login}/${repo.name}/commit/${commit.sha}">${sha}</a>` |
| 22 | + }) |
| 23 | + .join('\n') |
24 | 24 |
|
25 | 25 | if (commits.length >= 1) {
|
26 |
| - grant('dead-commit', `I pushed a commit with "dead" ${commits.length} times.`) |
27 |
| - .evidence(text) |
| 26 | + grant( |
| 27 | + 'dead-commit', |
| 28 | + `I pushed a commit with "dead" ${commits.length} times.`, |
| 29 | + ).evidence(text) |
28 | 30 | }
|
29 | 31 | }
|
30 |
| -} |
| 32 | +})() |
0 commit comments