Skip to content

Commit

Permalink
conform to standard js quote rules (#8395)
Browse files Browse the repository at this point in the history
* restore standardjs quote behaviour

* conform to standard js quote rules
  • Loading branch information
chris48s committed Sep 12, 2022
1 parent f6b09e9 commit ae018cd
Show file tree
Hide file tree
Showing 62 changed files with 129 additions and 121 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ rules:
func-style: ['error', 'declaration', { 'allowArrowFunctions': true }]
new-cap: ['error', { 'capIsNew': true }]
import/order: ['error', { 'newlines-between': 'never' }]
quotes:
['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }]

# Account for destructuring responses from upstream services,
# many of which do not follow camelcase
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/close-bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function run() {
state: 'closed',
})

core.debug(`Done.`)
core.debug('Done.')
}
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if (allFiles.length > 100) {
if (diff.includes('authHelper') && !secretsDocs.modified) {
warn(
[
`:books: Remember to ensure any changes to \`config.private\` `,
':books: Remember to ensure any changes to `config.private` ',
`in \`${file}\` are reflected in the [server secrets documentation]`,
'(https://github.com/badges/shields/blob/master/doc/server-secrets.md)',
].join('')
Expand Down
4 changes: 2 additions & 2 deletions lib/load-simple-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function loadSimpleIcons() {

icon.base64 = {
default: svg2base64(icon.svg.replace('<svg', `<svg fill="#${hex}"`)),
light: svg2base64(icon.svg.replace('<svg', `<svg fill="whitesmoke"`)),
dark: svg2base64(icon.svg.replace('<svg', `<svg fill="#333"`)),
light: svg2base64(icon.svg.replace('<svg', '<svg fill="whitesmoke"')),
dark: svg2base64(icon.svg.replace('<svg', '<svg fill="#333"')),
}

// There are a few instances where multiple icons have the same title
Expand Down
2 changes: 1 addition & 1 deletion scripts/capture-timings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function captureTimings(warmupIterations) {
function logResults({ times, iterations, warmupIterations }) {
if (isNaN(iterations)) {
console.log(
`No timings captured. Have you included console.time statements in the badge creation code path?`
'No timings captured. Have you included console.time statements in the badge creation code path?'
)
} else {
const timedIterations = iterations - warmupIterations
Expand Down
4 changes: 2 additions & 2 deletions services/azure-devops/azure-devops-tests.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()

t.create('unknown build definition')
.get(`/swellaby/opensource/99999999.json`)
.get('/swellaby/opensource/99999999.json')
.expectBadge({ label: 'tests', message: 'build pipeline not found' })

t.create('404 latest build error response')
Expand Down Expand Up @@ -51,7 +51,7 @@ t.create('no test result summary response')
})

t.create('no build response')
.get(`/swellaby/opensource/174.json`)
.get('/swellaby/opensource/174.json')
.expectBadge({ label: 'tests', message: 'build pipeline not found' })

t.create('no tests in test result summary response')
Expand Down
2 changes: 1 addition & 1 deletion services/bitbucket/bitbucket-pull-request.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function pullRequestClassGenerator(raw) {
static category = 'issue-tracking'
static route = {
base: `bitbucket/${routePrefix}`,
pattern: `:user/:repo`,
pattern: ':user/:repo',
queryParamSchema,
}

Expand Down
32 changes: 16 additions & 16 deletions services/cii-best-practices/cii-best-practices.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()

t.create('level known project')
.get(`/level/1.json`)
.get('/level/1.json')
.expectBadge({
label: 'cii',
message: withRegex(/in progress|passing|silver|gold/),
})

t.create('percentage known project')
.get(`/percentage/29.json`)
.get('/percentage/29.json')
.expectBadge({
label: 'cii',
message: withRegex(/([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|300)%/),
})

t.create('summary known project')
.get(`/summary/33.json`)
.get('/summary/33.json')
.expectBadge({
label: 'cii',
message: withRegex(/(in progress [0-9]|[1-9][0-9]%)|passing|silver|gold/),
})

t.create('unknown project')
.get(`/level/abc.json`)
.get('/level/abc.json')
.expectBadge({ label: 'cii', message: 'project not found' })

t.create('level: gold project')
.get(`/level/1.json`)
.get('/level/1.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/1/badge.json')
Expand All @@ -43,7 +43,7 @@ t.create('level: gold project')
})

t.create('level: silver project')
.get(`/level/34.json`)
.get('/level/34.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/34/badge.json')
Expand All @@ -58,7 +58,7 @@ t.create('level: silver project')
})

t.create('level: passing project')
.get(`/level/29.json`)
.get('/level/29.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/29/badge.json')
Expand All @@ -73,7 +73,7 @@ t.create('level: passing project')
})

t.create('level: in progress project')
.get(`/level/33.json`)
.get('/level/33.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/33/badge.json')
Expand All @@ -88,7 +88,7 @@ t.create('level: in progress project')
})

t.create('percentage: gold project')
.get(`/percentage/1.json`)
.get('/percentage/1.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/1/badge.json')
Expand All @@ -103,7 +103,7 @@ t.create('percentage: gold project')
})

t.create('percentage: silver project')
.get(`/percentage/34.json`)
.get('/percentage/34.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/34/badge.json')
Expand All @@ -118,7 +118,7 @@ t.create('percentage: silver project')
})

t.create('percentage: passing project')
.get(`/percentage/29.json`)
.get('/percentage/29.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/29/badge.json')
Expand All @@ -133,7 +133,7 @@ t.create('percentage: passing project')
})

t.create('percentage: in progress project')
.get(`/percentage/33.json`)
.get('/percentage/33.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/33/badge.json')
Expand All @@ -148,7 +148,7 @@ t.create('percentage: in progress project')
})

t.create('summary: gold project')
.get(`/summary/1.json`)
.get('/summary/1.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/1/badge.json')
Expand All @@ -163,7 +163,7 @@ t.create('summary: gold project')
})

t.create('summary: silver project')
.get(`/summary/34.json`)
.get('/summary/34.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/34/badge.json')
Expand All @@ -178,7 +178,7 @@ t.create('summary: silver project')
})

t.create('summary: passing project')
.get(`/summary/29.json`)
.get('/summary/29.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/29/badge.json')
Expand All @@ -193,7 +193,7 @@ t.create('summary: passing project')
})

t.create('summary: in progress project')
.get(`/summary/33.json`)
.get('/summary/33.json')
.intercept(nock =>
nock('https://bestpractices.coreinfrastructure.org/projects')
.get('/33/badge.json')
Expand Down
4 changes: 2 additions & 2 deletions services/codecov/codecov.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ t.create('handles unauthorized private repository')
.intercept(nock =>
nock('https://codecov.io')
.get('/github/codecov/private-example-python/graph/badge.svg')
.reply(200, `<g><text x="105.5" y="14">unknown</text></g>`, {
.reply(200, '<g><text x="105.5" y="14">unknown</text></g>', {
'Content-Type': 'image/svg+xml',
})
)
Expand Down Expand Up @@ -110,7 +110,7 @@ t.create('gets coverage for private repository')
.get(
'/gh/codecov/private-example-python/graph/badge.svg?token=a1b2c3d4e5'
)
.reply(200, `<g><text x="105.5" y="14">100%</text></g>`, {
.reply(200, '<g><text x="105.5" y="14">100%</text></g>', {
'Content-Type': 'image/svg+xml',
})
)
Expand Down
6 changes: 3 additions & 3 deletions services/discord/discord.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ describe('Discord', function () {
},
}

const scope = nock(`https://discord.com`, {
const scope = nock('https://discord.com', {
// This ensures that the expected credential is actually being sent with the HTTP request.
// Without this the request wouldn't match and the test would fail.
reqheaders: { Authorization: `Bot password` },
reqheaders: { Authorization: 'Bot password' },
})
.get(`/api/v6/guilds/12345/widget.json`)
.get('/api/v6/guilds/12345/widget.json')
.reply(200, {
presence_count: 125,
})
Expand Down
2 changes: 1 addition & 1 deletion services/discourse/discourse.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DiscourseStatus extends DiscourseBase {
static route = this.buildRoute('status')
static examples = [
{
title: `Discourse status`,
title: 'Discourse status',
namedParams: {},
queryParams: {
server: 'https://meta.discourse.org',
Expand Down
6 changes: 3 additions & 3 deletions services/docker/docker-cloud-automated.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ t.create('docker cloud automated build status (invalid, nonexisting user)')
.get('/pavicsssss/magpie.json')
.expectBadge({
label: 'docker build',
message: `manual`,
message: 'manual',
})

t.create(
`docker cloud build status (valid user, but the 'objects' array from the response is empty)`
"docker cloud build status (valid user, but the 'objects' array from the response is empty)"
)
.get('/pavics/weaver.json')
.expectBadge({
label: 'docker build',
message: `manual`,
message: 'manual',
})

t.create('docker cloud automated build (not found)')
Expand Down
2 changes: 1 addition & 1 deletion services/docker/docker-cloud-build.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class DockerCloudBuild extends BaseJsonService {

if (data.objects.length === 0) {
throw new NotFound({
prettyMessage: `automated builds not set up`,
prettyMessage: 'automated builds not set up',
})
}
return this.constructor.render({ state: data.objects[0].state })
Expand Down
6 changes: 3 additions & 3 deletions services/docker/docker-cloud-build.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ t.create('docker cloud build status (invalid, nonexisting user)')
.get('/pavicsssss/magpie.json')
.expectBadge({
label: 'docker build',
message: `automated builds not set up`,
message: 'automated builds not set up',
})

t.create(
`docker cloud build status (valid user, but the 'objects' array from the response is empty)`
"docker cloud build status (valid user, but the 'objects' array from the response is empty)"
)
.get('/pavics/weaver.json')
.expectBadge({
label: 'docker build',
message: `automated builds not set up`,
message: 'automated builds not set up',
})

t.create('docker cloud build status (not found)')
Expand Down
2 changes: 1 addition & 1 deletion services/docker/docker-cloud-common-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const cloudBuildSchema = Joi.object({
async function fetchBuild(serviceInstance, { user, repo }) {
return serviceInstance._requestJson({
schema: cloudBuildSchema,
url: `https://cloud.docker.com/api/build/v1/source`,
url: 'https://cloud.docker.com/api/build/v1/source',
options: { searchParams: { image: `${user}/${repo}` } },
errorMessages: { 404: 'repo not found' },
})
Expand Down
2 changes: 1 addition & 1 deletion services/drone/drone-build.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('DroneBuild', function () {
const token = 'abc123'

const scope = nock('https://cloud.drone.io', {
reqheaders: { Authorization: `Bearer abc123` },
reqheaders: { Authorization: 'Bearer abc123' },
})
.get(/.*/)
.reply(200, { status: 'passing' })
Expand Down
2 changes: 1 addition & 1 deletion services/freecodecamp/freecodecamp-points.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class FreeCodeCampPoints extends BaseJsonService {
async fetch({ username }) {
return this._requestJson({
schema,
url: `https://api.freecodecamp.org/api/users/get-public-profile`,
url: 'https://api.freecodecamp.org/api/users/get-public-profile',
options: {
searchParams: {
username,
Expand Down
2 changes: 1 addition & 1 deletion services/github/github-auth-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GithubAuthV4Service extends BaseGraphqlService {
}

async _requestGraphql(attrs) {
const url = `/graphql`
const url = '/graphql'

/*
The Github v4 API requires us to query the rateLimit object to return
Expand Down
2 changes: 1 addition & 1 deletion services/github/github-hacktoberfest.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default class GithubHacktoberfestCombinedStatus extends GithubAuthV4Servi
`repo:${user}/${repo}`,
'is:pr',
`created:${year}-10-01..${year}-10-31`,
`-label:invalid`,
'-label:invalid',
]
.filter(Boolean)
.join(' ')
Expand Down
2 changes: 1 addition & 1 deletion services/github/github-labels.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class GithubLabels extends GithubAuthV3Service {
return this._requestJson({
url: `/repos/${user}/${repo}/labels/${name}`,
schema,
errorMessages: errorMessagesFor(`repo or label not found`),
errorMessages: errorMessagesFor('repo or label not found'),
})
}

Expand Down
2 changes: 1 addition & 1 deletion services/github/github-milestone-detail.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class GithubMilestoneDetail extends GithubAuthV3Service {
return this._requestJson({
url: `/repos/${user}/${repo}/milestones/${number}`,
schema,
errorMessages: errorMessagesFor(`repo or milestone not found`),
errorMessages: errorMessagesFor('repo or milestone not found'),
})
}

Expand Down
2 changes: 1 addition & 1 deletion services/github/github-milestone.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class GithubMilestone extends GithubAuthV3Service {
return this._requestJson({
url: `/repos/${user}/${repo}/milestones?state=${variant}`,
schema,
errorMessages: errorMessagesFor(`repo not found`),
errorMessages: errorMessagesFor('repo not found'),
})
}

Expand Down
2 changes: 1 addition & 1 deletion services/github/github-total-star.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const query = gql`

const affiliationsAllowedValues = [
'OWNER',
`COLLABORATOR`,
'COLLABORATOR',
'ORGANIZATION_MEMBER',
]
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default redirector({
documentation,
},
],
transformPath: () => `/maven-metadata/v`,
transformPath: () => '/maven-metadata/v',
transformQueryParams: ({ pluginId }) => {
const groupPath = pluginId.replace(/\./g, '/')
const artifactId = `${pluginId}.gradle.plugin`
Expand Down
Loading

0 comments on commit ae018cd

Please sign in to comment.