refactor(github): convert some clasess to static fields (#5556)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Caleb Cartwright
2020-09-20 15:17:22 -05:00
committed by GitHub
parent 7712d26897
commit fa608e29d3
4 changed files with 68 additions and 111 deletions

View File

@@ -15,37 +15,25 @@ const schema = Joi.array()
.required()
module.exports = class GithubCommitActivity extends GithubAuthV3Service {
static get category() {
return 'activity'
static category = 'activity'
static route = {
base: 'github/commit-activity',
pattern: ':interval(y|m|4w|w)/:user/:repo',
}
static get route() {
return {
base: 'github/commit-activity',
pattern: ':interval(y|m|4w|w)/:user/:repo',
}
}
static examples = [
{
title: 'GitHub commit activity',
// Override the pattern to omit the deprecated interval "4w".
pattern: ':interval(y|m|w)/:user/:repo',
namedParams: { interval: 'm', user: 'eslint', repo: 'eslint' },
staticPreview: this.render({ interval: 'm', commitCount: 457 }),
keywords: ['commits'],
documentation,
},
]
static get examples() {
return [
{
title: 'GitHub commit activity',
// Override the pattern to omit the deprecated interval "4w".
pattern: ':interval(y|m|w)/:user/:repo',
namedParams: { interval: 'm', user: 'eslint', repo: 'eslint' },
staticPreview: this.render({ interval: 'm', commitCount: 457 }),
keywords: ['commits'],
documentation,
},
]
}
static get defaultBadgeData() {
return {
label: 'commit activity',
color: 'blue',
}
}
static defaultBadgeData = { label: 'commit activity', color: 'blue' }
static render({ interval, commitCount }) {
const intervalLabel = {