unused-key

A key with no usage, after keysInUse, derived keys and dynamic prefixes.

A key with no usage, after keysInUse, derived keys and dynamic prefixes.

The check is on by default, with the severity warning.

A key counts as used when:

  • a usage names it,
  • a prefix usage covers it,
  • it matches usage.keysInUse,
  • it is a derived key of a used key (usage.derivedKeys, for example i18next {key}_* plural keys),
  • a linked message or nesting placeholder (@:key, $t(key)) names it.

The check runs only when the project has at least one scanner.

Configure

Change the severity, or turn the check off, in checks:

x18n.config.ts
import { defineConfig } from '@x18n/core'

export default defineConfig({
  checks: {
    'unused-key': 'off',
  },
})

x18n check --only unused-key runs this check alone. x18n check --skip unused-key skips it for one run.

Source