Skip to content

typos: THT / PLACEHOLDE / CLEA flagged inside longer tokens needs allowlisting the subword, not the full word #2096

Backlog

Description

@gerchowl

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.
  • hiddenByAnc-style camelCase: Anc matches Anc → And.

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

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

  1. added a commit that references this issue on Nov 28, 2026
    d46fe84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions