Ignore a finding

Ignore a finding that is there on purpose, or change the severity of a code, in contentbit.config.ts, and keep the CI job strict.

Some findings are there on purpose: a site with no x-default alternate, a path that another app serves on the same domain, a page that is short by design. Say so in check in the config, and keep the CI gate:

import type { ContentbitConfigInput } from 'contentbit'

export default {
  check: {
    severity: { CB_SITE_HREFLANG_X_DEFAULT_MISSING: 'off' },
    ignore: [
      { code: 'CB_LINK_PAGE_MISSING', targets: '/shop/**', reason: 'Shopify serves the shop.' },
      { code: 'CB_PAGE_BROWSER_RENDERED', pages: '/thanks/', reason: 'Short on purpose.' },
    ],
  },
} satisfies ContentbitConfigInput
  • severity gives a code another severity, or off to ignore it everywhere.
  • An ignore entry ignores its codes on some pages, in some files, or about some targets, such as a link's URL. Give each entry a reason. Check fields lists every field.

What happens to an ignored finding

  • It is counted. The report ends with the number of findings ignored, and --json gives it as summary.ignored.
  • It is gone everywhere. context, adopt and Studio leave out the same findings, and --strict fails only on the warnings left.
  • A template finding shrinks. It keeps the pages the settings leave, and still counts once.
  • A stale entry shows. An ignore entry that matches no finding is a CB_CONFIG_IGNORE_UNUSED warning.