diff --git a/middleware/index.js b/middleware/index.js index 6a2b76b2c4..415fa40932 100644 --- a/middleware/index.js +++ b/middleware/index.js @@ -29,7 +29,6 @@ import redirectsExternal from './redirects/external.js' import languageCodeRedirects from './redirects/language-code-redirects.js' import handleRedirects from './redirects/handle-redirects.js' import findPage from './find-page.js' -import spotContentFlaws from './spot-content-flaws.js' import blockRobots from './block-robots.js' import archivedEnterpriseVersionsAssets from './archived-enterprise-versions-assets.js' import events from './events.js' @@ -270,7 +269,6 @@ export default function (app) { // *** Config and context for rendering *** app.use(asyncMiddleware(instrument(findPage, './find-page'))) // Must come before archived-enterprise-versions, breadcrumbs, featured-links, products, render-page - app.use(asyncMiddleware(instrument(spotContentFlaws, './spot-content-flaws'))) // Must come after findPage app.use(instrument(blockRobots, './block-robots')) // Check for a dropped connection before proceeding diff --git a/middleware/spot-content-flaws.js b/middleware/spot-content-flaws.js deleted file mode 100644 index d05ce4c1f6..0000000000 --- a/middleware/spot-content-flaws.js +++ /dev/null @@ -1,32 +0,0 @@ -// This middleware, exclusively in 'development' tries to spot flaws in -// the content you're actively viewing. -// The hopeful assumption is that if you're actively viewing this -// page on localhost, you're actively working on its content. - -import path from 'path' - -import kleur from 'kleur' - -export default async function spotContentFlaws(req, res, next) { - const { page } = req.context - if (process.env.NODE_ENV === 'development' && page) { - const trailingSlashRedirects = (page.redirect_from || []).filter( - (uri) => uri.endsWith('/') && uri.startsWith('/') - ) - if (trailingSlashRedirects.length > 0) { - console.warn( - `The page ${kleur.bold(path.relative(process.cwd(), page.fullPath))} has ${ - trailingSlashRedirects.length - } redirect_from entries that have a trailing slash\n ${kleur.yellow( - trailingSlashRedirects.join('\n ') - )}` - ) - console.log( - "If you're actively working on this page, consider", - kleur.bold('deleting all trailing slashes in redirect_from.\n') - ) - } - } - - return next() -} diff --git a/package-lock.json b/package-lock.json index 563a8a047f..a2e8d362f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,6 @@ "javascript-stringify": "^2.1.0", "js-cookie": "^3.0.1", "js-yaml": "^4.1.0", - "kleur": "4.1.4", "liquidjs": "^9.22.1", "lodash": "^4.17.21", "lodash-es": "^4.17.21", diff --git a/package.json b/package.json index a686cdcc35..8505c8d3ac 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "javascript-stringify": "^2.1.0", "js-cookie": "^3.0.1", "js-yaml": "^4.1.0", - "kleur": "4.1.4", "liquidjs": "^9.22.1", "lodash": "^4.17.21", "lodash-es": "^4.17.21",