From 2ec905fc77b7d98006db34936c3b1f7b049b304e Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 11 Jul 2023 07:44:52 -0400 Subject: [PATCH] trailingCommas:all on prettier (#38888) --- .../check-for-enterprise-issues-by-label.js | 6 +- .../content-changes-table-comment.js | 10 +-- .../create-enterprise-issue.js | 14 ++-- .github/actions-scripts/enable-automerge.js | 2 +- .../fr-add-docs-reviewers-requests.js | 8 +-- .../actions-scripts/lib/debug-time-taken.js | 2 +- .github/actions-scripts/lib/get-env-inputs.js | 2 +- .github/actions-scripts/projects.js | 10 +-- .../purge-fastly-edge-cache-per-language.js | 4 +- .../actions-scripts/ready-for-docs-review.js | 8 +-- .../rendered-content-link-checker.js | 42 ++++++------ .prettierrc.json | 3 +- components/ClientSideHighlightJS.tsx | 4 +- components/ClientSideRefresh.tsx | 2 +- components/LinkPreviewPopover.tsx | 6 +- components/article/PlatformPicker.tsx | 4 +- components/article/ToolPicker.tsx | 4 +- components/context/ArticleContext.tsx | 2 +- components/context/MainContext.tsx | 8 +-- components/context/TocLandingContext.tsx | 2 +- components/hooks/useOnScreen.ts | 2 +- components/lib/copy-code.ts | 2 +- components/lib/scroll-anchoring.d.ts | 2 +- components/page-footer/LegalFooter.tsx | 2 +- components/page-footer/SupportSection.tsx | 6 +- components/page-header/Breadcrumbs.tsx | 2 +- components/page-header/Header.tsx | 8 +-- .../page-header/HeaderNotifications.tsx | 2 +- components/page-header/VersionPicker.tsx | 2 +- components/release-notes/GHAEReleaseNotes.tsx | 2 +- components/release-notes/GHESReleaseNotes.tsx | 2 +- components/release-notes/PatchNotes.tsx | 2 +- components/sidebar/SidebarNav.tsx | 2 +- components/ui/Callout/Callout.tsx | 2 +- components/ui/Picker/Fields.tsx | 2 +- components/ui/ScrollButton/ScrollButton.tsx | 4 +- lib/all-versions.js | 4 +- lib/check-node-version.js | 2 +- lib/create-tree.js | 8 +-- lib/enterprise-server-releases.js | 8 +-- lib/get-applicable-versions.js | 8 +-- lib/get-english-headings.js | 4 +- lib/get-mini-toc-items.js | 2 +- lib/get-product-groups.js | 6 +- lib/non-enterprise-default-version.js | 2 +- lib/page-data.js | 30 ++++---- lib/page.js | 16 ++--- lib/path-utils.js | 2 +- lib/permalink.js | 2 +- lib/read-json-file.js | 2 +- lib/redirects/permalinks.js | 2 +- lib/redirects/precompile.js | 2 +- lib/release-notes-utils.js | 10 +-- lib/update-internal-links.js | 2 +- middleware/api/index.js | 2 +- .../archived-enterprise-versions-assets.js | 2 +- middleware/archived-enterprise-versions.js | 4 +- middleware/cache-control.js | 4 +- middleware/categories-for-support.js | 4 +- middleware/context.js | 2 +- middleware/contextualizers/breadcrumbs.js | 2 +- .../contextualizers/current-product-tree.js | 16 ++--- middleware/contextualizers/features.js | 4 +- middleware/contextualizers/generic-toc.js | 4 +- .../contextualizers/get-release-notes.js | 8 +-- .../contextualizers/ghae-release-notes.js | 4 +- .../contextualizers/ghes-release-notes.js | 6 +- middleware/contextualizers/glossaries.js | 6 +- .../contextualizers/product-examples.js | 4 +- middleware/contextualizers/secret-scanning.js | 2 +- .../contextualizers/whats-new-changelog.js | 2 +- middleware/find-page.js | 4 +- middleware/get-remote-json.js | 2 +- middleware/helmet.js | 2 +- middleware/index.js | 16 ++--- .../redirects/language-code-redirects.js | 2 +- middleware/reload-tree.js | 2 +- middleware/render-page.js | 2 +- middleware/set-fastly-surrogate-key.js | 4 +- pages/[versionId]/admin/release-notes.tsx | 6 +- pages/_app.tsx | 2 +- pages/_error.tsx | 8 +-- script/accessibility-checks.js | 10 +-- script/actions/find-unicorn-action-shas.js | 6 +- script/anonymize-branch.js | 4 +- script/check-github-github-links.js | 12 ++-- .../content-migrations/add-ghec-to-schema.js | 4 +- .../content-migrations/comment-on-open-prs.js | 2 +- .../content-migrations/use-short-versions.js | 8 +-- script/copy-fixture-data.js | 4 +- script/deployment/purge-edge-cache.js | 2 +- script/dev-toc/generate.js | 2 +- script/find-orphaned-assets.js | 20 +++--- script/helpers/get-liquid-conditionals.js | 4 +- script/helpers/git-utils.js | 4 +- script/helpers/retry-on-error-test.js | 2 +- script/i18n/test-html-pages.js | 2 +- script/list-image-sizes.js | 2 +- script/move-category-to-product.js | 8 +-- script/move-content.js | 24 +++---- script/prevent-pushes-to-main.js | 4 +- script/purge-fastly-by-url.js | 8 +-- script/reconcile-category-dirs-with-ids.js | 8 +-- script/reconcile-filenames-with-ids.js | 2 +- script/rendered-content-link-checker.js | 24 +++---- script/standardize-frontmatter-order.js | 2 +- script/start-server-for-jest.js | 2 +- script/toggle-ghae-feature-flags.js | 22 +++--- script/update-internal-links.js | 16 ++--- script/update-readme.js | 2 +- script/update-tocs.js | 2 +- script/validate-asset-images.js | 4 +- script/warmup-remotejson.js | 6 +- .../components/AutomatedPageContext.tsx | 2 +- .../parameter-table/ParameterRow.tsx | 2 +- .../lib/update-markdown.js | 20 +++--- .../tests/frontmatter-versions.js | 6 +- src/automated-pipelines/tests/rendering.js | 2 +- .../tests/update-markdown.js | 12 ++-- .../scripts/convert-markdown-for-docs.js | 8 +-- src/codeql-cli/scripts/sync.js | 4 +- .../image-alt-text-end-punctuation.js | 2 +- .../linting-rules/image-alt-text-length.js | 2 +- .../lib/linting-rules/image-file-kebab.js | 2 +- .../lib/linting-rules/internal-links-lang.js | 2 +- .../lib/linting-rules/internal-links-slash.js | 2 +- src/content-linter/tests/category-pages.js | 12 ++-- .../tests/lint-code-languages.js | 2 +- src/content-linter/tests/lint-files.js | 54 +++++++-------- src/content-linter/tests/lint-versioning.js | 10 +-- .../tests/liquid-line-breaks.js | 6 +- .../tests/site-data-references.js | 10 +-- src/content-render/liquid/error-handling.js | 2 +- src/content-render/liquid/ifversion.js | 2 +- src/content-render/liquid/post.js | 2 +- src/content-render/tests/data.js | 2 +- src/content-render/tests/liquid.js | 10 +-- src/content-render/tests/octicon.js | 4 +- src/content-render/tests/render-content.js | 12 ++-- src/content-render/unified/annotate.js | 18 ++--- src/content-render/unified/code-header.js | 4 +- .../unified/parse-info-string.js | 2 +- .../unified/rewrite-asset-urls.js | 2 +- .../unified/rewrite-for-rowheaders.js | 2 +- .../unified/rewrite-local-links.js | 4 +- .../middleware/early-access-links.js | 4 +- .../scripts/migrate-early-access-product.js | 14 ++-- .../scripts/symlink-from-local-repo.js | 8 +-- .../scripts/update-data-and-image-paths.js | 8 +-- .../scripts/what-docs-early-access-branch.js | 2 +- src/events/components/Survey.tsx | 6 +- src/events/components/events.ts | 2 +- src/events/lib/hydro.js | 4 +- src/events/lib/middleware-errors.js | 2 +- src/events/lib/schema.js | 2 +- src/events/middleware.js | 4 +- src/events/tests/hydro.js | 2 +- src/ghes-releases/scripts/archive-version.js | 20 +++--- .../scripts/get-version-blocks.js | 3 +- src/ghes-releases/scripts/release-banner.js | 4 +- .../scripts/remove-deprecated-frontmatter.js | 4 +- .../scripts/remove-liquid-statements.js | 8 +-- .../scripts/remove-static-files.js | 2 +- .../scripts/remove-version-markup.js | 8 +-- .../scripts/sync-automated-pipeline-data.js | 12 ++-- .../scripts/update-enterprise-dates.js | 4 +- .../tests/remove-liquid-statements.js | 16 ++--- src/github-apps/components/EnabledList.tsx | 2 +- .../components/PermissionsList.tsx | 2 +- src/github-apps/scripts/sync.js | 22 +++--- src/github-apps/tests/rendering.js | 8 +-- src/graphql/components/GraphqlPage.tsx | 16 ++--- src/graphql/components/Interface.tsx | 2 +- src/graphql/components/Query.tsx | 2 +- src/graphql/components/Table.tsx | 2 +- src/graphql/lib/index.js | 12 ++-- src/graphql/pages/breaking-changes.tsx | 2 +- src/graphql/scripts/build-changelog.js | 13 ++-- src/graphql/scripts/sync.js | 12 ++-- src/graphql/scripts/utils/process-previews.js | 2 +- src/graphql/scripts/utils/process-schemas.js | 68 +++++++++---------- src/graphql/scripts/utils/schema-helpers.js | 2 +- src/graphql/tests/build-changelog.js | 4 +- src/graphql/tests/get-schema-files.js | 2 +- src/graphql/tests/validate-schema.js | 2 +- src/landings/components/ArticleCards.tsx | 2 +- .../components/ProductGuidesContext.tsx | 2 +- .../components/ProductLandingContext.tsx | 8 +-- src/landings/components/ProductReleases.tsx | 2 +- src/landings/components/SidebarProduct.tsx | 4 +- src/landings/components/TableOfContents.tsx | 2 +- src/landings/middleware/featured-links.js | 4 +- src/landings/pages/home.tsx | 2 +- src/landings/tests/curated-homepage-links.js | 4 +- src/landings/tests/featured-links.js | 12 ++-- src/learning-track/lib/get-link-data.js | 2 +- .../lib/process-learning-tracks.js | 8 +-- src/observability/lib/failbot.js | 2 +- src/observability/lib/handle-exceptions.js | 2 +- src/observability/lib/statsd.js | 2 +- .../tests/repository-references.js | 4 +- src/pageinfo/middleware.js | 4 +- src/pageinfo/tests/pageinfo.js | 6 +- src/rest/api/anchor-redirect.js | 2 +- src/rest/components/ClientSideRedirects.tsx | 2 +- src/rest/components/RestBanner.tsx | 4 +- src/rest/components/RestCodeSamples.tsx | 6 +- .../components/RestCollapsibleSection.tsx | 2 +- src/rest/components/RestOperation.tsx | 10 +-- src/rest/components/get-rest-code-samples.ts | 4 +- src/rest/components/useClipboard.ts | 2 +- src/rest/docs.js | 16 +++-- src/rest/lib/index.js | 2 +- src/rest/pages/category.tsx | 6 +- src/rest/pages/subcategory.tsx | 2 +- src/rest/scripts/openapi-check.js | 4 +- src/rest/scripts/test-open-api-schema.js | 6 +- src/rest/scripts/update-files.js | 20 +++--- src/rest/scripts/utils/get-body-params.js | 6 +- src/rest/scripts/utils/get-openapi-schemas.js | 8 +-- src/rest/scripts/utils/get-operations.js | 5 +- src/rest/scripts/utils/operation.js | 10 +-- src/rest/scripts/utils/sync.js | 12 ++-- src/rest/scripts/utils/update-markdown.js | 2 +- src/rest/tests/api.js | 2 +- src/rest/tests/create-rest-examples.js | 2 +- src/rest/tests/get-schema-files.js | 2 +- src/rest/tests/openapi-schema.js | 6 +- src/rest/tests/rendering.js | 4 +- src/search/components/useMediaQuery.ts | 2 +- src/search/components/usePage.ts | 2 +- src/search/lib/versions.js | 2 +- src/search/middleware/es-search.js | 10 +-- src/search/middleware/search.js | 2 +- src/search/scripts/analyze-text.js | 6 +- src/search/scripts/build-records.js | 4 +- src/search/scripts/index-elasticsearch.js | 22 +++--- src/search/scripts/sync-search-indices.js | 16 ++--- src/search/scripts/sync.js | 10 +-- src/search/scripts/validate-records.js | 4 +- src/search/tests/api-search.js | 2 +- .../tests/parse-page-sections-into-records.js | 10 +-- src/search/tests/rendering.js | 2 +- src/shielding/tests/shielding.js | 4 +- src/webhooks/components/Webhook.tsx | 8 +-- src/webhooks/lib/index.js | 4 +- src/webhooks/middleware/webhooks.js | 2 +- .../pages/webhook-events-and-payloads.tsx | 2 +- src/webhooks/scripts/sync.js | 8 +-- src/webhooks/scripts/webhook.js | 4 +- src/webhooks/tests/get-schema-files.js | 4 +- src/webhooks/tests/rendering.js | 4 +- start-server.js | 2 +- tests/content/redirect-orphans.js | 6 +- tests/content/secure-files.js | 4 +- tests/content/site-tree.js | 4 +- tests/helpers/caching-headers.js | 2 +- tests/helpers/e2etest.js | 6 +- tests/rendering-fixtures/breadcrumbs.js | 2 +- .../categories-and-map-topic.js | 2 +- tests/rendering-fixtures/footer.js | 6 +- tests/rendering-fixtures/guides.js | 4 +- tests/rendering-fixtures/internal-links.js | 10 +-- tests/rendering-fixtures/liquid.js | 2 +- tests/rendering-fixtures/page-titles.js | 2 +- .../playwright-rendering.spec.ts | 12 ++-- tests/rendering-fixtures/sidebar.js | 6 +- tests/rendering-fixtures/versioning.js | 4 +- tests/rendering-fixtures/video-transcripts.js | 2 +- tests/rendering/block-robots.js | 2 +- tests/rendering/manifest.js | 2 +- tests/rendering/release-notes.js | 2 +- tests/rendering/robots-txt.js | 2 +- tests/rendering/server.js | 40 +++++------ .../routing/deprecated-enterprise-versions.js | 14 ++-- tests/routing/developer-site-redirects.js | 6 +- tests/routing/redirect-exceptions.js | 2 +- tests/routing/redirects.js | 22 +++--- tests/routing/release-notes.js | 4 +- tests/routing/versionless-redirects.js | 2 +- tests/translations/frame.js | 6 +- tests/unit/get-applicable-versions.js | 2 +- tests/unit/get-data.js | 4 +- tests/unit/get-redirect.js | 20 +++--- tests/unit/get-rss-feeds.js | 4 +- tests/unit/page.js | 36 +++++----- tests/unit/pages.js | 6 +- tests/unit/permalink.js | 10 +-- tests/unit/static-assets.js | 2 +- tests/unit/toc-links.js | 2 +- 290 files changed, 908 insertions(+), 898 deletions(-) diff --git a/.github/actions-scripts/check-for-enterprise-issues-by-label.js b/.github/actions-scripts/check-for-enterprise-issues-by-label.js index 6cf651480368..4c9ba8475c30 100755 --- a/.github/actions-scripts/check-for-enterprise-issues-by-label.js +++ b/.github/actions-scripts/check-for-enterprise-issues-by-label.js @@ -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' @@ -32,5 +32,5 @@ run().then( (error) => { console.log(`#ERROR# ${error}`) process.exit(1) - } + }, ) diff --git a/.github/actions-scripts/content-changes-table-comment.js b/.github/actions-scripts/content-changes-table-comment.js index 920c1dca9ff1..1648f934d569 100755 --- a/.github/actions-scripts/content-changes-table-comment.js +++ b/.github/actions-scripts/content-changes-table-comment.js @@ -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( @@ -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 @@ -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) { @@ -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 = '' @@ -153,7 +153,7 @@ async function main(owner, repo, baseSHA, headSHA) { } return `| ${contentCell} | ${previewCell} | ${prodCell} | ${note} |` - }) + }), ) // this section limits the size of the comment diff --git a/.github/actions-scripts/create-enterprise-issue.js b/.github/actions-scripts/create-enterprise-issue.js index 07b94935370b..36e71d6a326e 100755 --- a/.github/actions-scripts/create-enterprise-issue.js +++ b/.github/actions-scripts/create-enterprise-issue.js @@ -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'] @@ -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) } @@ -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) } @@ -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' @@ -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) { @@ -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) { diff --git a/.github/actions-scripts/enable-automerge.js b/.github/actions-scripts/enable-automerge.js index cb4f02f782cd..0005e031d545 100644 --- a/.github/actions-scripts/enable-automerge.js +++ b/.github/actions-scripts/enable-automerge.js @@ -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!') diff --git a/.github/actions-scripts/fr-add-docs-reviewers-requests.js b/.github/actions-scripts/fr-add-docs-reviewers-requests.js index ec31eaf529d1..2e5505093968 100644 --- a/.github/actions-scripts/fr-add-docs-reviewers-requests.js +++ b/.github/actions-scripts/fr-add-docs-reviewers-requests.js @@ -59,7 +59,7 @@ async function getAllOpenPRs() { headers: { authorization: `token ${process.env.TOKEN}`, }, - } + }, ) prsRemaining = data.repository.pullRequests.pageInfo.hasPreviousPage @@ -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.') @@ -137,7 +137,7 @@ async function run() { headers: { authorization: `token ${process.env.TOKEN}`, }, - } + }, ) // Get the project ID diff --git a/.github/actions-scripts/lib/debug-time-taken.js b/.github/actions-scripts/lib/debug-time-taken.js index bfd484ea1fe7..a3cf69daceb1 100644 --- a/.github/actions-scripts/lib/debug-time-taken.js +++ b/.github/actions-scripts/lib/debug-time-taken.js @@ -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 } diff --git a/.github/actions-scripts/lib/get-env-inputs.js b/.github/actions-scripts/lib/get-env-inputs.js index df1558d8fc04..5d6779bb9704 100644 --- a/.github/actions-scripts/lib/get-env-inputs.js +++ b/.github/actions-scripts/lib/get-env-inputs.js @@ -13,7 +13,7 @@ export function getEnvInputs(options) { throw new Error(`You must supply a ${envVarName} environment variable`) } return [envVarName, envVarValue] - }) + }), ) } diff --git a/.github/actions-scripts/projects.js b/.github/actions-scripts/projects.js index 87887363c7a0..6c4fc785a9fa 100644 --- a/.github/actions-scripts/projects.js +++ b/.github/actions-scripts/projects.js @@ -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.`, ) } } @@ -47,7 +47,7 @@ export async function addItemsToProject(items, project) { id } } - ` + `, ) const mutation = ` @@ -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) @@ -127,7 +127,7 @@ export async function isGitHubOrgMember(login) { headers: { authorization: `token ${process.env.TOKEN}`, }, - } + }, ) return Boolean(data.user.organization) @@ -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}" diff --git a/.github/actions-scripts/purge-fastly-edge-cache-per-language.js b/.github/actions-scripts/purge-fastly-edge-cache-per-language.js index 6f540b468fa9..655180b0b6fe 100755 --- a/.github/actions-scripts/purge-fastly-edge-cache-per-language.js +++ b/.github/actions-scripts/purge-fastly-edge-cache-per-language.js @@ -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)) @@ -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 diff --git a/.github/actions-scripts/ready-for-docs-review.js b/.github/actions-scripts/ready-for-docs-review.js index 4bfb7b1dfbe2..721837acd109 100644 --- a/.github/actions-scripts/ready-for-docs-review.js +++ b/.github/actions-scripts/ready-for-docs-review.js @@ -56,7 +56,7 @@ async function run() { headers: { authorization: `token ${process.env.TOKEN}`, }, - } + }, ) // Get the project ID @@ -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 diff --git a/.github/actions-scripts/rendered-content-link-checker.js b/.github/actions-scripts/rendered-content-link-checker.js index 643197236eb4..586ef470b839 100755 --- a/.github/actions-scripts/rendered-content-link-checker.js +++ b/.github/actions-scripts/rendered-content-link-checker.js @@ -73,7 +73,7 @@ const linksToSkip = linksToSkipFactory(excludedLinks) const CONTENT_ROOT = path.resolve('content') const deprecatedVersionPrefixesRegex = new RegExp( - `enterprise(-server@|/)(${deprecated.join('|')})(/|$)` + `enterprise(-server@|/)(${deprecated.join('|')})(/|$)`, ) // When this file is invoked directly from action as opposed to being imported @@ -228,7 +228,7 @@ async function main(core, octokit, uploadArtifact, opts = {}) { if (checkExternalLinks && pages.length >= 100) { core.warning( - `Warning! Checking external URLs can be time costly. You're testing ${pages.length} pages.` + `Warning! Checking external URLs can be time costly. You're testing ${pages.length} pages.`, ) } @@ -238,8 +238,8 @@ async function main(core, octokit, uploadArtifact, opts = {}) { const t0 = new Date().getTime() const flawsGroups = await Promise.all( pages.map((page) => - processPage(core, page, pageMap, redirects, opts, externalLinkCheckerDB, versions) - ) + processPage(core, page, pageMap, redirects, opts, externalLinkCheckerDB, versions), + ), ) const t1 = new Date().getTime() debugTimeEnd(core, 'processPages') @@ -283,7 +283,7 @@ async function main(core, octokit, uploadArtifact, opts = {}) { core.setOutput('has_flaws_at_level', flawsInLevel.length > 0) if (failOnFlaw) { core.setFailed( - `${flaws.length + 1} broken links found. See action artifact uploads for details` + `${flaws.length + 1} broken links found. See action artifact uploads for details`, ) } } @@ -395,7 +395,7 @@ async function linkReports(core, octokit, newReport, opts) { body, }) core.info( - `Linked old report to new report via comment on old report: #${previousReport.number}.` + `Linked old report to new report via comment on old report: #${previousReport.number}.`, ) } catch (error) { core.setFailed(`Error commenting on previousReport, #${previousReport.number}`) @@ -566,7 +566,7 @@ function printGlobalCacheHitRatio(core) { `Cache hit ratio: ${hits.toLocaleString()} of ${(misses + hits).toLocaleString()} (${( (100 * hits) / (misses + hits) - ).toFixed(1)}%)` + ).toFixed(1)}%)`, ) } } @@ -619,7 +619,7 @@ async function processPage(core, page, pageMap, redirects, opts, db, versions) { }) .map((permalink) => { return processPermalink(core, permalink, page, pageMap, redirects, opts, db) - }) + }), ) const allFlaws = allFlawsEach.flat() @@ -687,7 +687,7 @@ async function processPermalink(core, permalink, page, pageMap, redirects, opts, checkExternalLinks, externalServerErrorsAsWarning, { verbose, patient }, - db + db, ) if (flaw) { @@ -704,7 +704,7 @@ async function processPermalink(core, permalink, page, pageMap, redirects, opts, globalHrefCheckCache.set(href, flaw) } } - }) + }), ) for (const flaw of newFlaws) { @@ -748,7 +748,7 @@ async function uploadJsonFlawsArtifact( uploadArtifact, flaws, { verboseUrl = null } = {}, - artifactName = 'all-rendered-link-flaws.json' + artifactName = 'all-rendered-link-flaws.json', ) { const printableFlaws = {} for (const { page, permalink, href, text, src, flaw } of flaws) { @@ -833,7 +833,7 @@ async function checkHrefLink( checkExternalLinks = false, externalServerErrorsAsWarning = false, { verbose = false, patient = false } = {}, - db = null + db = null, ) { if (href === '#') { if (checkAnchors) { @@ -883,7 +883,7 @@ async function checkHrefLink( if (pathname.split('/')[1] in STATIC_PREFIXES) { const staticFilePath = path.join( STATIC_PREFIXES[pathname.split('/')[1]], - pathname.split(path.sep).slice(2).join(path.sep) + pathname.split(path.sep).slice(2).join(path.sep), ) if (!fs.existsSync(staticFilePath)) { return { CRITICAL: `Static file not found ${staticFilePath} (${pathname})` } @@ -1045,7 +1045,7 @@ async function innerFetch(core, url, config = {}) { }) if (verbose) { core.info( - `External URL ${useGET ? 'GET' : 'HEAD'} ${url}: ${r.statusCode} (retries: ${retries})` + `External URL ${useGET ? 'GET' : 'HEAD'} ${url}: ${r.statusCode} (retries: ${retries})`, ) } @@ -1055,7 +1055,7 @@ async function innerFetch(core, url, config = {}) { if (r.statusCode === 429) { let sleepTime = Math.min( 60_000, - Math.max(10_000, getRetryAfterSleep(r.headers['retry-after'])) + Math.max(10_000, getRetryAfterSleep(r.headers['retry-after'])), ) // Sprinkle a little jitter so it doesn't all start again all // at the same time @@ -1067,8 +1067,8 @@ async function innerFetch(core, url, config = {}) { if (verbose) core.info( chalk.yellow( - `Rate limited on ${hostname} (${url}). Sleeping for ${(sleepTime / 1000).toFixed(1)}s` - ) + `Rate limited on ${hostname} (${url}). Sleeping for ${(sleepTime / 1000).toFixed(1)}s`, + ), ) await sleep(sleepTime) return innerFetch(core, url, Object.assign({}, config, { retries: retries + 1 })) @@ -1115,7 +1115,7 @@ function checkImageSrc(src, $) { if (prefix in STATIC_PREFIXES) { const staticFilePath = path.join( STATIC_PREFIXES[prefix], - pathname.split(path.sep).slice(2).join(path.sep) + pathname.split(path.sep).slice(2).join(path.sep), ) if (!fs.existsSync(staticFilePath)) { return { CRITICAL: `Static file not found (${pathname})` } @@ -1129,8 +1129,8 @@ function summarizeFlaws(core, flaws) { if (flaws.length) { core.info( chalk.bold( - `Found ${flaws.length.toLocaleString()} flaw${flaws.length === 1 ? '' : 's'} in total.` - ) + `Found ${flaws.length.toLocaleString()} flaw${flaws.length === 1 ? '' : 's'} in total.`, + ), ) } else { core.info(chalk.green('No flaws found! 💖')) @@ -1140,7 +1140,7 @@ function summarizeFlaws(core, flaws) { function summarizeCounts(core, pages, tookSeconds) { const count = pages.map((page) => page.permalinks.length).reduce((a, b) => a + b, 0) core.info( - `Tested ${count.toLocaleString()} permalinks across ${pages.length.toLocaleString()} pages` + `Tested ${count.toLocaleString()} permalinks across ${pages.length.toLocaleString()} pages`, ) core.info(`Took ${Math.floor(tookSeconds)} seconds. (~${(tookSeconds / 60).toFixed(1)} minutes)`) const permalinksPerSecond = count / tookSeconds diff --git a/.prettierrc.json b/.prettierrc.json index 83779fed66d3..6223ec288b56 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -11,8 +11,7 @@ "options": { "semi": false, "singleQuote": true, - "printWidth": 100, - "trailingComma": "es5" + "printWidth": 100 } } ] diff --git a/components/ClientSideHighlightJS.tsx b/components/ClientSideHighlightJS.tsx index c5b7bab28272..67a1b15d03b1 100644 --- a/components/ClientSideHighlightJS.tsx +++ b/components/ClientSideHighlightJS.tsx @@ -50,13 +50,13 @@ export default function ClientSideHighlightJS() { } }) for (const parent of Array.from( - document.querySelectorAll(CODE_ELEMENTS_PARENT_SELECTOR) + document.querySelectorAll(CODE_ELEMENTS_PARENT_SELECTOR), )) { const language = parent.dataset.highlight || 'json' if (!SUPPORTED_LANGUAGES.includes(language)) { if (process.env.NODE_ENV === 'development') { console.warn( - `For highlighting, only ${SUPPORTED_LANGUAGES} is supported. Not '${language}'.` + `For highlighting, only ${SUPPORTED_LANGUAGES} is supported. Not '${language}'.`, ) } continue diff --git a/components/ClientSideRefresh.tsx b/components/ClientSideRefresh.tsx index 156c68c8273d..a4e5838054c3 100644 --- a/components/ClientSideRefresh.tsx +++ b/components/ClientSideRefresh.tsx @@ -30,7 +30,7 @@ export default function ClientSideRefresh() { // because, naturally, the first time you mount it, it will not // need to refresh because it's as fresh as it gets already. revalidateOnMount: false, - } + }, ) return null diff --git a/components/LinkPreviewPopover.tsx b/components/LinkPreviewPopover.tsx index e4f0ca4808d3..d61ce4d75a7a 100644 --- a/components/LinkPreviewPopover.tsx +++ b/components/LinkPreviewPopover.tsx @@ -58,7 +58,7 @@ function getOrCreatePopoverGlobal() { // or 'Popover-message--top-right`. These get set later when we // know where the popover message should appear on the screen. inner.classList.add( - ...'Popover-message Popover-message--large p-3 Box color-shadow-large'.split(/\s+/g) + ...'Popover-message Popover-message--large p-3 Box color-shadow-large'.split(/\s+/g), ) inner.style.width = `360px` @@ -343,8 +343,8 @@ export function LinkPreviewPopover() { const links = Array.from( document.querySelectorAll( - '#article-contents a[href], #article-intro a[href]' - ) + '#article-contents a[href], #article-intro a[href]', + ), ).filter((link) => { // This filters out links that are not internal or in-page // and the ones that are in-page anchor links next to the headings. diff --git a/components/article/PlatformPicker.tsx b/components/article/PlatformPicker.tsx index 3bed51dfcca1..24fe5acc722c 100644 --- a/components/article/PlatformPicker.tsx +++ b/components/article/PlatformPicker.tsx @@ -28,8 +28,8 @@ function showPlatformSpecificContent(platform: string) { // example: inline content const platformEls = Array.from( document.querySelectorAll( - platforms.map((platform) => `.platform-${platform.value}`).join(', ') - ) + platforms.map((platform) => `.platform-${platform.value}`).join(', '), + ), ) platformEls.forEach((el) => { el.style.display = el.classList.contains(`platform-${platform}`) ? '' : 'none' diff --git a/components/article/ToolPicker.tsx b/components/article/ToolPicker.tsx index 171865fb8e92..cb7bbd83a430 100644 --- a/components/article/ToolPicker.tsx +++ b/components/article/ToolPicker.tsx @@ -22,7 +22,9 @@ function showToolSpecificContent(tool: string, supportedTools: Array) { // find all tool-specific *inline* elements and hide or show as appropriate // example: inline content const toolEls = Array.from( - document.querySelectorAll(supportedTools.map((tool) => `.tool-${tool}`).join(', ')) + document.querySelectorAll( + supportedTools.map((tool) => `.tool-${tool}`).join(', '), + ), ) toolEls.forEach((el) => { el.style.display = el.classList.contains(`tool-${tool}`) ? '' : 'none' diff --git a/components/context/ArticleContext.tsx b/components/context/ArticleContext.tsx index 19d53b56003f..ce387939b634 100644 --- a/components/context/ArticleContext.tsx +++ b/components/context/ArticleContext.tsx @@ -66,7 +66,7 @@ export const getArticleContextFromRequest = (req: any): ArticleContextT => { if (page.effectiveDate) { if (isNaN(Date.parse(page.effectiveDate))) { throw new Error( - 'The "effectiveDate" frontmatter property is not valid. Please make sure it is YEAR-MONTH-DAY' + 'The "effectiveDate" frontmatter property is not valid. Please make sure it is YEAR-MONTH-DAY', ) } } diff --git a/components/context/MainContext.tsx b/components/context/MainContext.tsx index f677f54fda89..77f7da678576 100644 --- a/components/context/MainContext.tsx +++ b/components/context/MainContext.tsx @@ -148,13 +148,13 @@ export const getMainContext = async (req: any, res: any): Promise reusables: { enterprise_deprecation: { version_was_deprecated: req.context.getDottedData( - 'reusables.enterprise_deprecation.version_was_deprecated' + 'reusables.enterprise_deprecation.version_was_deprecated', ), version_will_be_deprecated: req.context.getDottedData( - 'reusables.enterprise_deprecation.version_will_be_deprecated' + 'reusables.enterprise_deprecation.version_will_be_deprecated', ), deprecation_details: req.context.getDottedData( - 'reusables.enterprise_deprecation.deprecation_details' + 'reusables.enterprise_deprecation.deprecation_details', ), }, policies: { @@ -179,7 +179,7 @@ export const getMainContext = async (req: any, res: any): Promise topics: req.context.page.topics || [], introPlainText: req.context.page?.introPlainText, permalinks: req.context.page?.permalinks.map((obj: any) => - pick(obj, ['title', 'pageVersion', 'href', 'relativePath', 'languageCode']) + pick(obj, ['title', 'pageVersion', 'href', 'relativePath', 'languageCode']), ), hidden: req.context.page.hidden || false, noEarlyAccessBanner: req.context.page.noEarlyAccessBanner || false, diff --git a/components/context/TocLandingContext.tsx b/components/context/TocLandingContext.tsx index 349ae5b063ae..1d13923506b7 100644 --- a/components/context/TocLandingContext.tsx +++ b/components/context/TocLandingContext.tsx @@ -41,7 +41,7 @@ export const getTocLandingContextFromRequest = (req: any): TocLandingContextT => productCallout: req.context.page.product || '', intro: req.context.page.intro, tocItems: (req.context.genericTocFlat || req.context.genericTocNested || []).map((obj: any) => - pick(obj, ['fullPath', 'title', 'intro', 'childTocItems']) + pick(obj, ['fullPath', 'title', 'intro', 'childTocItems']), ), variant: req.context.genericTocFlat ? 'expanded' : 'compact', diff --git a/components/hooks/useOnScreen.ts b/components/hooks/useOnScreen.ts index 196204858d82..d5bbdab51036 100644 --- a/components/hooks/useOnScreen.ts +++ b/components/hooks/useOnScreen.ts @@ -2,7 +2,7 @@ import { useState, useEffect, MutableRefObject, RefObject } from 'react' export function useOnScreen( ref: MutableRefObject | RefObject, - options?: IntersectionObserverInit + options?: IntersectionObserverInit, ): boolean { const [isIntersecting, setIntersecting] = useState(false) useEffect(() => { diff --git a/components/lib/copy-code.ts b/components/lib/copy-code.ts index b6a7ddefe78f..592904cca8e9 100644 --- a/components/lib/copy-code.ts +++ b/components/lib/copy-code.ts @@ -19,6 +19,6 @@ export default function copyCode() { setTimeout(() => { button.setAttribute('aria-label', beforeTooltip) }, 2000) - }) + }), ) } diff --git a/components/lib/scroll-anchoring.d.ts b/components/lib/scroll-anchoring.d.ts index c761556ec4bb..bbd6f2f00671 100644 --- a/components/lib/scroll-anchoring.d.ts +++ b/components/lib/scroll-anchoring.d.ts @@ -2,7 +2,7 @@ declare module 'scroll-anchoring' { export function findAnchorNode(document: Document): Node | undefined export function preserveAnchorNodePosition( document: Document, - callback: () => Promise | T + callback: () => Promise | T, ): Promise export function preservePosition(anchorNode: Node, callback: () => Promise | T): Promise } diff --git a/components/page-footer/LegalFooter.tsx b/components/page-footer/LegalFooter.tsx index af682a32e0d6..c251970f3bf8 100644 --- a/components/page-footer/LegalFooter.tsx +++ b/components/page-footer/LegalFooter.tsx @@ -42,7 +42,7 @@ export const LegalFooter = () => { legacyBehavior={false} className={cx( 'text-underline', - router.locale === 'ko' && 'color-fg-attention text-bold' + router.locale === 'ko' && 'color-fg-attention text-bold', )} > {t('privacy')} diff --git a/components/page-footer/SupportSection.tsx b/components/page-footer/SupportSection.tsx index 3276c55e5216..6d873b30b949 100644 --- a/components/page-footer/SupportSection.tsx +++ b/components/page-footer/SupportSection.tsx @@ -35,7 +35,7 @@ export const SupportSection = () => { className={cx( 'float-left pr-4 mb-6 mb-xl-0 col-12', totalCols > 1 && 'col-lg-6', - totalCols > 2 && 'col-xl-3' + totalCols > 2 && 'col-xl-3', )} > @@ -47,7 +47,7 @@ export const SupportSection = () => { 'float-left pr-4 mb-6 mb-xl-0 col-12', totalCols > 1 && 'col-lg-6', totalCols > 2 && 'col-xl-4', - totalCols > 2 && showSurvey && 'offset-xl-1' + totalCols > 2 && showSurvey && 'offset-xl-1', )} > @@ -59,7 +59,7 @@ export const SupportSection = () => { 'float-left pr-4 mb-6 mb-xl-0 col-12', totalCols > 1 && 'col-lg-6', totalCols > 2 && 'col-xl-3', - totalCols > 2 && (showSurvey || showContribution) && 'offset-xl-1' + totalCols > 2 && (showSurvey || showContribution) && 'offset-xl-1', )} > diff --git a/components/page-header/Breadcrumbs.tsx b/components/page-header/Breadcrumbs.tsx index 14ad14e10c41..9182d14f2d0f 100644 --- a/components/page-header/Breadcrumbs.tsx +++ b/components/page-header/Breadcrumbs.tsx @@ -49,7 +49,7 @@ export const Breadcrumbs = ({ inHeader }: Props) => { 'Link--primary mr-2 color-fg-muted', // Show the last breadcrumb if it's in the header, but not if it's in the article // If there's only 1 breadcrumb, show it - !inHeader && i === arr.length - 1 && arr.length !== 1 && 'd-none' + !inHeader && i === arr.length - 1 && arr.length !== 1 && 'd-none', )} > {breadcrumb.title} diff --git a/components/page-header/Header.tsx b/components/page-header/Header.tsx index 1c8b4c9aa4b8..553180f3dfa5 100644 --- a/components/page-header/Header.tsx +++ b/components/page-header/Header.tsx @@ -126,14 +126,14 @@ export const Header = () => {
{error !== '404' && }
{ isSearchOpen ? styles.searchContainerWithOpenSearch : styles.searchContainerWithClosedSearch, - 'mr-3' + 'mr-3', )} > @@ -194,7 +194,7 @@ export const Header = () => { setIsSearchOpen(!isSearchOpen)} diff --git a/components/page-header/HeaderNotifications.tsx b/components/page-header/HeaderNotifications.tsx index 42c0621a1e21..7eba342c1a29 100644 --- a/components/page-header/HeaderNotifications.tsx +++ b/components/page-header/HeaderNotifications.tsx @@ -89,7 +89,7 @@ export const HeaderNotifications = () => { type === NotificationType.TRANSLATION && 'color-bg-accent', type === NotificationType.RELEASE && 'color-bg-accent', type === NotificationType.EARLY_ACCESS && 'color-bg-danger', - !isLast && 'border-bottom color-border-default' + !isLast && 'border-bottom color-border-default', )} dangerouslySetInnerHTML={{ __html: content }} /> diff --git a/components/page-header/VersionPicker.tsx b/components/page-header/VersionPicker.tsx index eafdc1e4bc50..042c820d4777 100644 --- a/components/page-header/VersionPicker.tsx +++ b/components/page-header/VersionPicker.tsx @@ -38,7 +38,7 @@ export const VersionPicker = ({ mediumOrLower }: Props) => { })) const hasEnterpriseVersions = (page.permalinks || []).some((permalink) => - permalink.pageVersion.startsWith('enterprise-server') + permalink.pageVersion.startsWith('enterprise-server'), ) allLinks.push({ diff --git a/components/release-notes/GHAEReleaseNotes.tsx b/components/release-notes/GHAEReleaseNotes.tsx index ed63e90e6121..de7c217ad246 100644 --- a/components/release-notes/GHAEReleaseNotes.tsx +++ b/components/release-notes/GHAEReleaseNotes.tsx @@ -40,7 +40,7 @@ export function GHAEReleaseNotes({ context }: GitHubAEProps) {