shipglot

whitespace

Leading/trailing whitespace or line breaks differ.

Default severity: info

What it checks

Leading and trailing spaces are usually load-bearing (strings concatenated in code), and line breaks shape layout. The translation should keep the same leading and trailing whitespace and the same number of line breaks as the source.

Example

The source ends with a space because code appends a value to it. Config used for both runs:

{
  "sourceLocale": "en",
  "files": [
    {
      "format": "next-intl-json",
      "path": "messages/{locale}.json"
    }
  ]
}

Fails

messages/en.json

{
  "label": "Signed in as "
}

messages/fr.json

{
  "label": "Connecté en tant que"
}

Gate output

  • label
    whitespace differs: trailing whitespace " " → ""
    messages/fr.json:2

Passes

messages/en.json

{
  "label": "Signed in as "
}

messages/fr.json

{
  "label": "Connecté en tant que "
}

Gate output

No whitespace finding.

Change its severity

{
  "checks": {
    "whitespace": "error"
  }
}

Use "off" to disable it. To hide one finding, add "suppress": ["whitespace:label"]; a suppress rule that stops matching is reported so it can be removed.

All checks