Adds a Vale rule enforcing the existing "select, not click" style
guidance: "click" assumes the reader has a mouse, and touch, keyboard,
and assistive-technology users don't click.
`Coder.SelectClick` (warning severity) flags
`click`/`clicks`/`clicked`/`clicking` in prose, exempting:
- Literal mouse-button phrasing (`left-click`, `right-click`,
`middle-click`, `mouse click`, and combinations) — these name an actual
mouse action with no device-agnostic equivalent.
- `one-click`/`single-click` as a compound feature descriptor
("one-click install").
Reworded every existing instructional "click" in `docs/` to the matching
`select` form (`select`/`selects`/`selections`/`selected`/`selecting`)
so the rule ships with a clean baseline, per this repo's Vale-rule
doctrine.
Left alone, deliberately: two generated API reference pages
(`docs/reference/api/enterprise.md`, `schemas.md`) use "click" as an
analytics-event noun, tied to a Go source doc comment and an operation
ID (`report-a-premium-paywall-click`). Fixing those means editing
generated code and an API operation ID, which is out of scope for a
docs-style PR — see the rule's own comments for the reasoning. That
leaves 2 non-zero-baseline findings for this rule.
---
🤖 Built with AI assistance.
---------
Co-authored-by: Ian Evans <5760366+ianjevans@users.noreply.github.com>
19 lines
995 B
YAML
19 lines
995 B
YAML
# Coder.SelectClick - use device-agnostic "select"/"open" instead of "click".
|
|
# Refer to word-choice.md#select-not-click for the rule and its exceptions.
|
|
extends: substitution
|
|
message: "Use '%s' instead of '%s'; it assumes the reader has a mouse. Refer to word-choice.md#select-not-click."
|
|
link: https://github.com/coder/coder/blob/main/docs/.style/style-guide/word-choice.md#select-not-click
|
|
level: warning
|
|
ignorecase: true
|
|
nonword: false
|
|
action:
|
|
name: replace
|
|
exceptions:
|
|
- '(?i)(?:(?:left|right|middle|one|single)[-\s])?mouse[-\s]click(?:s|ed|ing)?'
|
|
- '(?i)(?:left|right|middle|one|single)[-\s]click(?:s|ed|ing)?'
|
|
swap:
|
|
'\b(?:(?:left|right|middle|one|single)[-\s])?(?:mouse[-\s])?click\b': "select, open"
|
|
'\b(?:(?:left|right|middle|one|single)[-\s])?(?:mouse[-\s])?clicks\b': "selects, opens"
|
|
'\b(?:(?:left|right|middle|one|single)[-\s])?(?:mouse[-\s])?clicked\b': "selected, opened"
|
|
'\b(?:(?:left|right|middle|one|single)[-\s])?(?:mouse[-\s])?clicking\b': "selecting, opening"
|