You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
typos: THT / PLACEHOLDE / CLEA flagged inside longer tokens needs allowlisting the subword, not the full word #2096
Found while running devkit 1.19.2's typos pre-commit hook on nerdmachines/ee (ee#25).
Problem
typos tokenises identifiers on alphanumeric / case boundaries and matches its typo-list against the resulting SUBWORDs, not the full token. That makes the hook flag perfectly-spelled words:
Capacitor_THT, Resistor_THT (KiCad through-hole footprint prefixes): split as Capacitor + THT. The bare THT matches typos' THT → THE, THAT entry.
PLACEHOLDERs (plural, in docs/comments): split as PLACEHOLDE + R + s. PLACEHOLDE matches PLACEHOLDE → PLACEHOLDER as a truncated form.
CLEARs in a line-wrapped doc comment: split as CLEA + R + s. CLEA → CLEAN, CLEAR, CLEAT.
The intuitive fix is .typos.toml's extend-identifiers:
[default.extend-identifiers]
THT = "THT"
That works for a bare THT token but DOES NOT match Capacitor_THT — extend-identifiers is per-whole-identifier. The only thing that works for a subword is extend-words:
[default.extend-words]
THT = "THT"
Which is counter-intuitive because docs call extend-words "the typo-replacement dictionary"; its effect here is that a subword marked as its own replacement is treated as valid.
Impact
Every repo whose code and docs mention real domain tokens that happen to spell English-prefix truncations hits this. On adoption we had to allowlist 15 subwords (THT, tio, thr, pn, fo, fe, PLACEHOLDE, CLEA, LOD, Anc, ure, modul, metalness, unparseable, afe) — none actual typos. The hook stays useful; the overhead is figuring out the allow-list mechanism and knowing to reach for extend-words on a subword.
Suggested
Document the subword vs. whole-identifier split in the devkit docs for the typos hook, with the KiCad-style example above.
Consider shipping a widened base .typos.toml that covers common domain tokens (a lot of these are EDA / graphics / shell-script conventions), so a new consumer isn't surprised on the first pass.
Not blocking (one-line additions each), but the hook's first run on a repo with domain vocabulary produces 70+ false positives and the allowlist route is not obvious.
Activity
docs(typos): explain subword allowlisting and seed common domain words (