Checks
Every built-in check of x18n check, with its default severity.
A check reads the project and reports diagnostics. A diagnostic is one reported issue with a code, a severity and optional fixes. x18n check runs every check, and the editor shows the same diagnostics.
The recommended set is every check that is not off below. Override the severity of a check in checks:
x18n.config.ts
import { defineConfig } from '@x18n/core'
export default defineConfig({
checks: {
'unused-key': 'error',
'identical-to-source': 'warning',
'key-style': ['warning', { case: 'camel' }],
},
})A severity is error, warning, info, hint or off. strict: true (or x18n check --strict) turns every warning into an error. ignoreKeys removes keys from every check.
| Check | Default | Description |
|---|---|---|
| missing-key | error | A usage whose key is not defined in the source locale. |
| invalid-syntax | error | Message syntax errors (ICU, linked messages, nesting). |
| placeholder-mismatch | error | Target value placeholders differ from the source value. |
| key-conflict | error | A key that is both a leaf and a parent, or is duplicated across files of one locale. |
| missing-translation | warning | A source-locale key that target locales lack. One diagnostic per key, at the source entry. |
| stale-translation | warning | A translation that last changed before its source message, by the history providers (git). |
| empty-translation | warning | A message with an empty string value. |
| redundant-translation | warning | A message in a locale with a fallback that equals the message it falls back to, so it can be removed. |
| unused-key | warning | A key with no usage, after keysInUse, derived keys and dynamic prefixes. |
| locale-code-conflict | warning | Locale codes that differ only in spelling, such as zh_CN and zh-CN. |
| dynamic-key | off | A fully dynamic key that no check can follow. |
| identical-to-source | off | A target value that equals the source value. |
| key-style | off | A key that does not match a naming rule (options: case, pattern). |
| hard-string | info | A hard-coded string that should probably be a message. On with extract.autoDetect. |
| glossary | off | A glossary term translated differently from the glossary. |
| invalid-resource | error | A locale file or source file that x18n failed to read, parse or scan. |
The reporters of x18n check --reporter are pretty, json, markdown, github, sarif. See CLI and x18n check.