No Spaces Around Dashes

This rule enforces proper dash usage by ensuring there are no spaces before or after em dashes (—) or en dashes (–). The rule aligns with standard typographical practices and the Google developer documentation style guide, which recommends using dashes without surrounding spaces for cleaner, more professional-looking text.

Proper dash formatting improves readability and maintains consistency across documentation. When spaces surround dashes, they can create awkward breaks in the text and don't follow standard English typographic conventions.

Examples:

  • ❌ "The meeting was long — and boring"
  • ✅ "The meeting was long—and boring"
  • ❌ "2020 – 2021"
  • ✅ "2020–2021"

The rule will flag any instance where an em dash or en dash is surrounded by spaces on either side and automatically suggests removing those spaces.

Rule Source

This rule comes from: https://github.com/jump-dev/JuMP.jl

Rule Definition

extends: existence
message: "Don't put a space before or after a dash."
link: 'https://developers.google.com/style/dashes'
nonword: true
level: error
action:
  name: edit
  params:
    - remove
    - ' '
tokens:
  - '\s[—–]\s'