Skip to content

Commit

Permalink
trailingCommas:all on prettier (#38888)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe authored Jul 11, 2023
1 parent 3e6c8c2 commit 2ec905f
Show file tree
Hide file tree
Showing 290 changed files with 908 additions and 898 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ async function run() {
const queryRelease = encodeURIComponent('is:open repo:github/docs-content is:issue')

const deprecationIssues = await octokit.request(
`GET /search/issues?q=${queryDeprecation}+label:"${encodeURI(ENTERPRISE_DEPRECATION_LABEL)}"`
`GET /search/issues?q=${queryDeprecation}+label:"${encodeURI(ENTERPRISE_DEPRECATION_LABEL)}"`,
)
const releaseIssues = await octokit.request(
`GET /search/issues?q=${queryRelease}+label:"${encodeURI(ENTERPRISE_RELEASE_LABEL)}"`
`GET /search/issues?q=${queryRelease}+label:"${encodeURI(ENTERPRISE_RELEASE_LABEL)}"`,
)
const isDeprecationIssue = deprecationIssues.data.items.length === 0 ? 'false' : 'true'
const isReleaseIssue = releaseIssues.data.items.length === 0 ? 'false' : 'true'
Expand All @@ -32,5 +32,5 @@ run().then(
(error) => {
console.log(`#ERROR# ${error}`)
process.exit(1)
}
},
)
10 changes: 5 additions & 5 deletions .github/actions-scripts/content-changes-table-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function main(owner, repo, baseSHA, headSHA) {

const pathPrefix = 'content/'
const articleFiles = files.filter(
({ filename }) => filename.startsWith(pathPrefix) && filename.toLowerCase() !== 'readme.md'
({ filename }) => filename.startsWith(pathPrefix) && filename.toLowerCase() !== 'readme.md',
)

const lines = await Promise.all(
Expand All @@ -82,7 +82,7 @@ async function main(owner, repo, baseSHA, headSHA) {
// So, to be able to get necessary meta data about what it *was*,
// if it was removed, fall back to the 'base'.
file.status === 'removed' ? baseSHA : headSHA,
file.filename
file.filename,
)

// parse the frontmatter
Expand All @@ -108,7 +108,7 @@ async function main(owner, repo, baseSHA, headSHA) {

// walk by the plan names since we generate links differently for most plans
const versions = fileVersions.filter((fileVersion) =>
fileVersion.includes(allVersionShortnames[plan])
fileVersion.includes(allVersionShortnames[plan]),
)

if (versions.length === 1) {
Expand Down Expand Up @@ -141,7 +141,7 @@ async function main(owner, repo, baseSHA, headSHA) {
}
} catch (e) {
console.error(
`Version information for ${file.filename} couldn't be determined from its frontmatter.`
`Version information for ${file.filename} couldn't be determined from its frontmatter.`,
)
}
let note = ''
Expand All @@ -153,7 +153,7 @@ async function main(owner, repo, baseSHA, headSHA) {
}

return `| ${contentCell} | ${previewCell} | ${prodCell} | ${note} |`
})
}),
)

// this section limits the size of the comment
Expand Down
14 changes: 7 additions & 7 deletions .github/actions-scripts/create-enterprise-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path'
import { getOctokit } from '@actions/github'
import { latest, oldestSupported } from '../../lib/enterprise-server-releases.js'
const enterpriseDates = JSON.parse(
await fs.readFile(path.join(process.cwd(), 'src/ghes-releases/lib/enterprise-dates.json'))
await fs.readFile(path.join(process.cwd(), 'src/ghes-releases/lib/enterprise-dates.json')),
)

const acceptedMilestones = ['release', 'deprecation']
Expand Down Expand Up @@ -54,7 +54,7 @@ async function run() {

if (!versionNumber) {
console.log(
`Could not find the next version number after ${latest} in enterprise-dates.json. Try running src/ghes-releases/scripts/update-enterprise-dates.js, then rerun this script.`
`Could not find the next version number after ${latest} in enterprise-dates.json. Try running src/ghes-releases/scripts/update-enterprise-dates.js, then rerun this script.`,
)
process.exit(0)
}
Expand All @@ -63,7 +63,7 @@ async function run() {

if (!datesForVersion) {
console.log(
`Could not find ${versionNumber} in enterprise-dates.json. Try running src/ghes-releases/scripts/update-enterprise-dates.js, then rerun this script.`
`Could not find ${versionNumber} in enterprise-dates.json. Try running src/ghes-releases/scripts/update-enterprise-dates.js, then rerun this script.`,
)
process.exit(0)
}
Expand All @@ -74,14 +74,14 @@ async function run() {
// If the milestone is more than the specific days away, exit now.
if (daysUntilMilestone > numberOfdaysBeforeMilestoneToOpenIssue) {
console.log(
`The ${versionNumber} ${milestone} is not until ${nextMilestoneDate}! An issue will be opened when it is ${numberOfdaysBeforeMilestoneToOpenIssue} days away.`
`The ${versionNumber} ${milestone} is not until ${nextMilestoneDate}! An issue will be opened when it is ${numberOfdaysBeforeMilestoneToOpenIssue} days away.`,
)
process.exit(0)
}

const milestoneSteps = await fs.readFile(
path.join(process.cwd(), `src/ghes-releases/lib/${milestone}-steps.md`),
'utf8'
'utf8',
)
const issueLabels =
milestone === 'release'
Expand Down Expand Up @@ -109,7 +109,7 @@ async function run() {
if (issue.status === 201) {
// Write the values to disk for use in the workflow.
console.log(
`Issue #${issue.data.number} for the ${versionNumber} ${milestone} was opened: ${issue.data.html_url}`
`Issue #${issue.data.number} for the ${versionNumber} ${milestone} was opened: ${issue.data.html_url}`,
)
}
} catch (error) {
Expand Down Expand Up @@ -137,7 +137,7 @@ async function run() {
if (addCard.status === 201) {
// Write the values to disk for use in the workflow.
console.log(
`The issue #${issue.data.number} was added to https://github.com/orgs/github/projects/1773#column-12198119.`
`The issue #${issue.data.number} was added to https://github.com/orgs/github/projects/1773#column-12198119.`,
)
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion .github/actions-scripts/enable-automerge.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function main() {
if (graph.errors && graph.errors.length > 0) {
console.error(
'ERROR! Failed to enable auto-merge:\n - ' +
graph.errors.map((error) => error.message).join('\n - ')
graph.errors.map((error) => error.message).join('\n - '),
)
} else {
console.log('Auto-merge enabled!')
Expand Down
8 changes: 4 additions & 4 deletions .github/actions-scripts/fr-add-docs-reviewers-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function getAllOpenPRs() {
headers: {
authorization: `token ${process.env.TOKEN}`,
},
}
},
)

prsRemaining = data.repository.pullRequests.pageInfo.hasPreviousPage
Expand All @@ -84,11 +84,11 @@ async function run() {
!pr.isDraft &&
!pr.labels.nodes.find((label) => label.name === 'Deploy train 🚂') &&
pr.reviewRequests.nodes.find(
(requestedReviewers) => requestedReviewers.requestedReviewer?.name === process.env.REVIEWER
(requestedReviewers) => requestedReviewers.requestedReviewer?.name === process.env.REVIEWER,
) &&
!pr.reviews.nodes
.flatMap((review) => review.onBehalfOf.nodes)
.find((behalf) => behalf.name === process.env.REVIEWER)
.find((behalf) => behalf.name === process.env.REVIEWER),
)
if (prs.length === 0) {
console.log('No PRs found. Exiting.')
Expand Down Expand Up @@ -137,7 +137,7 @@ async function run() {
headers: {
authorization: `token ${process.env.TOKEN}`,
},
}
},
)

// Get the project ID
Expand Down
2 changes: 1 addition & 1 deletion .github/actions-scripts/lib/debug-time-taken.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function debugTimeStart(core, instanceName) {
export function debugTimeEnd(core, instanceName) {
if (!timeInstances.has(instanceName)) {
core.warn(
`Invalid instanceName: ${instanceName} in debugTimeEnd. Did you call debugTimeStart first with the same instanceName?`
`Invalid instanceName: ${instanceName} in debugTimeEnd. Did you call debugTimeStart first with the same instanceName?`,
)
return
}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions-scripts/lib/get-env-inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getEnvInputs(options) {
throw new Error(`You must supply a ${envVarName} environment variable`)
}
return [envVarName, envVarValue]
})
}),
)
}

Expand Down
10 changes: 5 additions & 5 deletions .github/actions-scripts/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function findSingleSelectID(singleSelectName, fieldName, data) {
return singleSelect.id
} else {
throw new Error(
`A single select called "${singleSelectName}" for the field "${fieldName}" was not found. Check if the single select was renamed.`
`A single select called "${singleSelectName}" for the field "${fieldName}" was not found. Check if the single select was renamed.`,
)
}
}
Expand All @@ -47,7 +47,7 @@ export async function addItemsToProject(items, project) {
id
}
}
`
`,
)

const mutation = `
Expand Down Expand Up @@ -102,7 +102,7 @@ export async function isDocsTeamMember(login) {
headers: {
authorization: `token ${process.env.TOKEN}`,
},
}
},
)

const teamMembers = data.organization.team.members.nodes.map((entry) => entry.login)
Expand All @@ -127,7 +127,7 @@ export async function isGitHubOrgMember(login) {
headers: {
authorization: `token ${process.env.TOKEN}`,
},
}
},
)

return Boolean(data.user.organization)
Expand Down Expand Up @@ -188,7 +188,7 @@ export function generateUpdateProjectV2ItemFieldMutation({
return `
set_${fieldID.slice(1)}_item_${item.replaceAll(
/[^a-z0-9]/g,
''
'',
)}: updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: "${item}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const languages = process.env.LANGUAGES

for (const language of languages) {
console.log(
`Sleeping ${DELAY_BETWEEN_LANGUAGES / 1000} seconds before purging for '${language}'...`
`Sleeping ${DELAY_BETWEEN_LANGUAGES / 1000} seconds before purging for '${language}'...`,
)
await sleep(DELAY_BETWEEN_LANGUAGES)
await purgeEdgeCache(makeLanguageSurrogateKey(language))
Expand All @@ -49,7 +49,7 @@ function languagesFromString(str) {
.filter(Boolean)
if (!languages.every((lang) => languageKeys.includes(lang))) {
throw new Error(
`Unrecognized language code (${languages.find((lang) => !languageKeys.includes(lang))})`
`Unrecognized language code (${languages.find((lang) => !languageKeys.includes(lang))})`,
)
}
return languages
Expand Down
8 changes: 4 additions & 4 deletions .github/actions-scripts/ready-for-docs-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function run() {
headers: {
authorization: `token ${process.env.TOKEN}`,
},
}
},
)

// Get the project ID
Expand Down Expand Up @@ -156,17 +156,17 @@ async function run() {
headers: {
authorization: `token ${process.env.TOKEN}`,
},
}
},
)
const docsPRData =
contributorData.user.contributionsCollection.pullRequestContributionsByRepository.filter(
(item) => item.repository.nameWithOwner === 'github/docs'
(item) => item.repository.nameWithOwner === 'github/docs',
)[0]
const prCount = docsPRData ? docsPRData.contributions.totalCount : 0

const docsIssueData =
contributorData.user.contributionsCollection.issueContributionsByRepository.filter(
(item) => item.repository.nameWithOwner === 'github/docs'
(item) => item.repository.nameWithOwner === 'github/docs',
)[0]
const issueCount = docsIssueData ? docsIssueData.contributions.totalCount : 0

Expand Down
Loading

0 comments on commit 2ec905f

Please sign in to comment.