Skip to content

design-token/letter-spacing

Summary

Enforces letter-spacing values to match the letter-spacing tokens defined in your configuration.

Configuration

Enable the rule in designlint.config.*. See configuration for defining tokens.

json
{
  "tokens": {
    "$version": "1.0.0",
    "letterSpacings": {
      "tight": {
        "$type": "dimension",
        "$value": { "dimensionType": "length", "value": -0.05, "unit": "rem" }
      },
      "loose": { "$type": "dimension", "$ref": "#/letterSpacings/tight" }
    }
  },
  "rules": { "design-token/letter-spacing": "error" }
}

Letter-spacing tokens use the dimension type with dimensionType set to length.

Options

No additional options.

This rule is not auto-fixable.

Examples

Invalid

css
.text { letter-spacing: 2px; }

Valid

css
.text { letter-spacing: -0.05rem; }
.text { letter-spacing: 0; }

When Not To Use

If letter spacing is not standardized, disable this rule.

See also

Released under the MIT License.