Skip to content

New rule: content/common-misspellings - known typos and doubled words on English pages #709

Closed

Description

@nc9

Problem

A typo in a heading, a pricing table or a page title is one of the first things a visitor notices, and squirrel never reports one. recieve, seperate, accomodation and a stray "the the" ship to production all the time, because nobody re-reads a page after the CMS edit.

No rule looks at spelling today. content/reading-level scores readability, content/placeholder-text and content/mojibake catch broken text, and the disabled content/quality rule only asks an LLM for a general score. None of them name a misspelled word.

A full dictionary spellchecker is the wrong tool for a local audit: brand names, product terms and jargon make it noisy, and a dictionary is megabytes inside the binary. A list of known misspellings is the opposite: every hit is almost certainly a typo, and the list is small.

Proposal

New rule content/common-misspellings, site scope, runs locally with no network and no render.

  • Which pages: only pages whose <html lang> primary subtag is en (en, en-US, en-GB, ...). Pages with no lang or another language are skipped. Subtrees carrying their own non-English lang attribute are skipped too.
  • Which text: the rendered prose content/placeholder-text already reads (getRenderedProseText in content/text-content.ts: no script, style, noscript, template, code, pre, samp, kbd or code-editor containers), plus <title> and the meta description. Elements with translate="no" or spellcheck="false" are skipped.
  • Misspellings: a bundled map of common misspellings to their correction, looked up word by word in a hash map. Exact, case-insensitive lookup only, no edit distance.
  • Doubled words: the same word twice in a row inside one text block, limited to a closed list of function words (the, a, an, to, of, and, in, on, for, with, is, ...). "had had" and "that that" are grammatical and stay out.
  • Tokens never checked: URLs, email addresses, @handles and #hashtags, tokens with digits or underscores, ALL CAPS words, camelCase and other mixed-case words, and capitalised words that are not at the start of a sentence (likely names and brands).
  • Warn: a misspelling in <title>, the meta description or a heading (h1 to h6). These are visible in search results or at the top of the page.
  • Info: a misspelling in body prose, and doubled words anywhere.
  • One finding per word across the site: recieve → receive, the number of pages it appears on, and capped examples (page URL plus about 40 characters of context either side). The finding list is capped too, worst first by page count.
  • Not reported: British vs American variants (colour, organise), words in the user's ignore_words option, and anything on non-English pages.

Notes

  • Licence: none of the ready-made lists is a clean MIT drop-in. Wikipedia's "Lists of common misspellings/For machines" (4,310 entries) is CC BY-SA 4.0. codespell's dictionaries are CC BY-SA 3.0 and say they derive from that Wikipedia list. client9/misspell is MIT but its README says its list started from the same Wikipedia page. crate-ci/typos ships its dictionary under MIT OR Apache-2.0, but the data's origin is not documented and needs checking. Options: ship a Wikipedia-derived list as a separately licensed CC BY-SA data file with attribution in NOTICES (needs a maintainer decision, since the package is MIT), or curate our own list from scratch. Decide before writing code.
  • Bundle size: the CLI is a bun standalone binary, so the list is embedded as is. Measured on current upstream files: the Wikipedia list is about 97 KB raw for 4,310 entries; misspell is about 15,500 pairs; codespell's main dictionary is 65,000 entries, 1.5 MB raw (294 KB gzipped); typos' is 96,000 entries, 2.1 MB raw (405 KB gzipped). The code-oriented lists are mostly identifier typos (aaccess) that web copy never contains. A curated list of 3,000 to 6,000 web-relevant entries should stay around 60 to 120 KB. Build the map lazily on first use so audits that skip the rule pay nothing.
  • Cost: one hash lookup per word on English pages. No dictionary, no edit distance, no CPU worth measuring.
  • False-positive risk: low by construction, as long as the list is curated: drop entries that are real words in some context (thier is safe, lead/led is not), and anything that is a common brand or product name.
  • Later: a cloud pass for spelling and grammar in any language can build on this rule; this issue is the local, English-only, list-based check only.

Acceptance Criteria

  • Licence decision recorded in the PR: the list's source and licence are named, and NOTICES carries any required attribution
  • Fixture: an English page (<html lang="en">) with "We will recieve your order" in a paragraph produces one info finding recieve → receive with the page URL and a context snippet
  • Fixture: the same misspelling in <title> or an h2 produces a warning, not info
  • Fixture: "Click the the button" produces a doubled-word finding; "she had had enough" does not
  • Fixture: a page with lang="de", a page with no lang, and a <span lang="fr"> block on an English page produce no findings
  • Fixture: the misspelling inside <code>, <pre>, <kbd>, a URL, an email address, an ALL CAPS word or a mid-sentence capitalised word produces no finding
  • colour, organise and other British spellings produce no findings
  • The same misspelling on 5 pages produces one finding with a page count of 5 and capped examples, not 5 findings
  • A word listed in the rule's ignore_words option is never reported
  • The compiled CLI binary grows by no more than the list's raw size plus a few KB, stated in the PR
  • The rule has a docs page under docs/rules/content/

Activity

  1. added
    enhancement
    size: M
    rules
    on Oct 12, 2026
  2. nc9 commented on Oct 12, 2026

    @nc9
    ContributorAuthor

    Licence decision (maintainer): ship the misspellings list as a separate data file with its upstream attribution and CC BY-SA licence noted in NOTICES. Don't curate our own list.

  3. nc9 commented on Oct 13, 2026

    @nc9
    ContributorAuthor

    Note: commit 527d4f8 (pub#715, mobile/web-app-manifest) references this issue by mistake in its subject; it belongs to #710. This issue is unaffected.

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

    enhancementrulessize: M

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions