diff --git a/lib/get-applicable-versions.js b/lib/get-applicable-versions.js index bd78102a58..49a0e90034 100644 --- a/lib/get-applicable-versions.js +++ b/lib/get-applicable-versions.js @@ -63,9 +63,9 @@ function getApplicableVersions(frontmatterVersions, filepath) { const foundFrontmatterVersions = evaluateVersions(frontmatterVersions) // Combine them! - const applicableVersions = [ - ...new Set(foundFrontmatterVersions.versions.concat(foundFeatureVersions.versions)), - ] + const applicableVersions = Array.from( + new Set(foundFrontmatterVersions.versions.concat(foundFeatureVersions.versions)) + ) if ( !applicableVersions.length && diff --git a/lib/liquid-tags/octicon.js b/lib/liquid-tags/octicon.js index 662edb05a7..f2ace7d119 100644 --- a/lib/liquid-tags/octicon.js +++ b/lib/liquid-tags/octicon.js @@ -46,7 +46,7 @@ export default { } }, - async render(scope) { + async render() { // Throw an error if the requested octicon does not exist. if (!Object.prototype.hasOwnProperty.call(octicons, this.icon)) { throw new Error(`Octicon ${this.icon} does not exist`) diff --git a/lib/old-versions-utils.js b/lib/old-versions-utils.js index 2002e5233f..9a3ae64807 100644 --- a/lib/old-versions-utils.js +++ b/lib/old-versions-utils.js @@ -35,7 +35,7 @@ export function getNewVersionFromOldVersion(oldVersion) { // Given an old path like /enterprise/2.21/user/github/category/article, // return an old version like 2.21. -export function getOldVersionFromOldPath(oldPath, languageCode) { +export function getOldVersionFromOldPath(oldPath) { // We should never be calling this function on a path that starts with a new version, // so we can assume the path either uses the old /enterprise format or it's dotcom. if (!patterns.enterprise.test(oldPath)) return 'dotcom' diff --git a/middleware/anchor-redirect.js b/middleware/anchor-redirect.js index 0bc4b2c2d6..610541333d 100644 --- a/middleware/anchor-redirect.js +++ b/middleware/anchor-redirect.js @@ -10,7 +10,7 @@ const clientSideRestAPIRedirects = readCompressedJsonFileFallbackLazily( const router = express.Router() // Returns a client side redirect if one exists for the given path. -router.get('/', function redirects(req, res, next) { +router.get('/', function redirects(req, res) { if (!req.query.path) { return res.status(400).send("Missing 'path' query string") } diff --git a/middleware/api/search.js b/middleware/api/search.js index a5afb747c9..a79b3a9de3 100644 --- a/middleware/api/search.js +++ b/middleware/api/search.js @@ -39,7 +39,7 @@ const legacyEnterpriseServerVersions = Object.fromEntries( .filter(([fullName]) => { return fullName.startsWith('enterprise-server@') }) - .map(([_, shortName]) => { + .map(([, shortName]) => { return [shortName, `ghes-${shortName}`] }) ) @@ -86,7 +86,7 @@ function notConfiguredMiddleware(req, res, next) { router.get( '/legacy', notConfiguredMiddleware, - catchMiddlewareError(async function legacySearch(req, res, next) { + catchMiddlewareError(async function legacySearch(req, res) { const { query, version, language, filters, limit: limit_ } = req.query if (filters) { throw new Error('not implemented yet') @@ -233,7 +233,7 @@ router.get( '/v1', validationMiddleware, notConfiguredMiddleware, - catchMiddlewareError(async function search(req, res, next) { + catchMiddlewareError(async function search(req, res) { const { indexName, query, page, size, debug, sort } = req.search try { const { meta, hits } = await getSearchResults({ indexName, query, page, size, debug, sort }) @@ -277,7 +277,7 @@ router.get( ) // Alias for the latest version -router.get('/', (req, res, next) => { +router.get('/', (req, res) => { // At the time of writing, the latest version is v1. (July 2022) // Use `req.originalUrl` because this router is "self contained" // which means that `req.url` will be `/` in this context. diff --git a/middleware/build-info.js b/middleware/build-info.js index 7fcf168edb..f7a65a58dd 100644 --- a/middleware/build-info.js +++ b/middleware/build-info.js @@ -3,7 +3,7 @@ import { cacheControlFactory } from './cache-control.js' const BUILD_SHA = process.env.BUILD_SHA const noCacheControl = cacheControlFactory(0) -export default function buildInfo(req, res, next) { +export default function buildInfo(req, res) { res.type('text/plain') noCacheControl(res) if (!BUILD_SHA) { diff --git a/middleware/categories-for-support.js b/middleware/categories-for-support.js index 8707fa8f7e..317bb6c451 100644 --- a/middleware/categories-for-support.js +++ b/middleware/categories-for-support.js @@ -12,7 +12,7 @@ let globalAllCategoriesCache = null // This middleware exposes a list of all categories and child articles at /categories.json. // GitHub Support uses this for internal ZenDesk search functionality. -export default async function categoriesForSupport(req, res, next) { +export default async function categoriesForSupport(req, res) { const englishSiteTree = req.context.siteTree.en const allCategories = globalAllCategoriesCache || [] diff --git a/middleware/healthz.js b/middleware/healthz.js index 561ef8cba7..a667ad9441 100644 --- a/middleware/healthz.js +++ b/middleware/healthz.js @@ -11,7 +11,7 @@ const noCacheControl = cacheControlFactory(0) * instance remains in the pool to handle requests * For example: if we have a failing database connection we may return a 500 status here. */ -router.get('/', function healthz(req, res, next) { +router.get('/', function healthz(req, res) { noCacheControl(res) res.sendStatus(200) diff --git a/middleware/remote-ip.js b/middleware/remote-ip.js index 85683fda3f..fe3d51110c 100644 --- a/middleware/remote-ip.js +++ b/middleware/remote-ip.js @@ -2,7 +2,7 @@ import { cacheControlFactory } from './cache-control.js' const noCacheControl = cacheControlFactory(0) -export default function remoteIp(req, res, next) { +export default function remoteIp(req, res) { noCacheControl(res) res.json({ ip: req.ip, diff --git a/middleware/render-page.js b/middleware/render-page.js index 9edce60fba..c55360a5d0 100644 --- a/middleware/render-page.js +++ b/middleware/render-page.js @@ -34,7 +34,7 @@ async function buildMiniTocItems(req) { return getMiniTocItems(context.renderedPage, page.miniTocMaxHeadingLevel, '') } -export default async function renderPage(req, res, next) { +export default async function renderPage(req, res) { const { context } = req // This is a contextualizing the request so that when this `req` is diff --git a/middleware/search.js b/middleware/search.js index 4137c40495..c3711911ab 100644 --- a/middleware/search.js +++ b/middleware/search.js @@ -13,7 +13,7 @@ const noCacheControl = cacheControlFactory(0) router.get( '/', - catchMiddlewareError(async function getSearch(req, res, next) { + catchMiddlewareError(async function getSearch(req, res) { const { query, version, language, filters, limit: limit_ } = req.query const limit = Math.min(parseInt(limit_, 10) || 10, 100) if (!versions.has(version)) { diff --git a/script/helpers/git-utils.js b/script/helpers/git-utils.js index b98c614557..52c3e527d3 100644 --- a/script/helpers/git-utils.js +++ b/script/helpers/git-utils.js @@ -50,7 +50,7 @@ export async function getTreeSha(owner, repo, commitSha) { } // https://docs.github.com/rest/reference/git#get-a-tree -export async function getTree(owner, repo, ref, allowedPaths = []) { +export async function getTree(owner, repo, ref) { const commitSha = await getCommitSha(owner, repo, ref) const treeSha = await getTreeSha(owner, repo, commitSha) try { diff --git a/script/rendered-content-link-checker.js b/script/rendered-content-link-checker.js index 5bf9127978..38b0922eea 100755 --- a/script/rendered-content-link-checker.js +++ b/script/rendered-content-link-checker.js @@ -671,7 +671,7 @@ function getRetryAfterSleep(headerValue) { return ms } -function checkImageSrc(src, $) { +function checkImageSrc(src) { const pathname = new URL(src, 'http://example.com').pathname if (!pathname.startsWith('/')) { return { WARNING: "External images can't not be checked" } diff --git a/tests/routing/redirects.js b/tests/routing/redirects.js index cd4e4baa9a..f49fe7e045 100644 --- a/tests/routing/redirects.js +++ b/tests/routing/redirects.js @@ -108,7 +108,7 @@ describe('redirects', () => { test('are absent from all destination URLs', async () => { const values = Object.entries(redirects) - .filter(([from_, to]) => !to.includes('://')) + .filter(([, to]) => !to.includes('://')) .map(([from_]) => from_) expect(values.length).toBeGreaterThan(100) expect(values.every((value) => !value.endsWith('/'))).toBe(true) @@ -142,7 +142,7 @@ describe('redirects', () => { describe('external redirects', () => { test('no external redirect starts with a language prefix', () => { const values = Object.entries(redirects) - .filter(([from_, to]) => to.includes('://')) + .filter(([, to]) => to.includes('://')) .map(([from_]) => from_) .filter((from_) => from_.startsWith('/en/')) expect(values.length).toBe(0)