Skip to content

feat(rules): add content/common-misspellings #709 - #720

Merged
nc9 merged 1 commit into
mainfrom
claude/709-common-misspellings
Oct 13, 2026
Merged

nc9 merged 1 commit into
mainfrom
claude/709-common-misspellings

Conversation

@nc9

@nc9 nc9 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • New site-scope rule content/common-misspellings. It looks each word of English pages up in a bundled map of known misspellings and reports the correction, the number of pages and capped examples. It also reports doubled function words ("the the").
  • Pages count as English when <html lang> has primary subtag en. These are skipped: code, pre, samp, kbd, templates, translate="no", spellcheck="false" and non-English lang subtrees. These are never judged: URLs, emails, handles, ALL CAPS, mixed case, mid-sentence capitals, and any word the page's body uses as a name.
  • Title, meta description and headings are read in the page-time scan (streamed audits) or the legacy DOM pass. Misspellings there are warn, and the rule's meta.severity is warning, so the report shows them as warnings. Body prose and doubled words are info.
  • ignore_words option, matched case-insensitively (misspellings only).
  • Docs page docs/rules/content/common-misspellings.mdx, wired into docs/docs.json and the content index.
  • .gitignore had a data/ rule that would have excluded the bundled data file, so packages/rules/src/content/data/ (and only it) is now un-ignored.

Licence: our own list, MIT

The first version of this PR bundled data derived from Wikipedia's "Lists of common misspellings" (CC BY-SA 4.0). ShareAlike data inside the MIT binary needs a licence decision, so the maintainer chose a list of our own instead. This PR's single commit contains none of that data.

  • packages/rules/src/content/data/common-misspellings-data.ts holds 523 misspellings written for squirrelscan. It is MIT, like the rest of the package.

  • It is not copied or derived from any published misspelling list. Every list of useful size we checked traces back to the Wikipedia list or carries copyleft or non-commercial terms:

    • codespell's dictionary: CC BY-SA 3.0.
    • misspell's word list: from Wikipedia.
    • typos' words.csv: imported from misspell and codespell.
    • cspell's misspelling dictionary: CC BY-SA 4.0.
    • Norvig's spell-errors: from Wikipedia and Mitton.
    • Birkbeck corpus: CC BY-NC-SA.
    • LanguageTool: LGPL.

    None of them was used as a source, a candidate list or a filter.

  • Method (recorded in the data README): entries were written by typo class.

    • The classes: ie/ei swaps, doubled or single consonants, confused suffixes, wrong unstressed vowels, dropped or added letters, swapped letters in very common words, and words often misspelt on websites.
    • Some ie/ei and suffix candidates came from a throwaway script, whose exact rule the README states. It applied those swaps to common SCOWL words and kept only the results that are not words. Each entry was chosen individually.
    • Left out on purpose:
      • surnames and brands (sargent, greif);
      • words that are real in other languages (posible, profesional);
      • misspellings one letter from two words (eigth, preceed).
  • Check: scripts/check-common-misspellings.ts replaces the old Wikipedia build script. It is run by hand and needs two word lists, which are used only by the check and never shipped:

    Input Version Licence
    wordlist-english 1.2.1 MIT package; words are SCOWL 2016 lists, Copyright Kevin Atkinson, under SCOWL's permissive notice
    an-array-of-english-words 2.0.0 MIT package; words from the Letterpress list, CC0

    Each line must be two lowercase words, sorted, with no duplicates.

    • Every correction must be a common word: SCOWL size 60 or below, in the US, British, Canadian or Australian spelling.
    • Every misspelling must be no word in either list, so a valid spelling in any variant (colour, organise, judgement) is never reported.
    • No correction may itself be listed.
    • The check refuses word lists that look truncated.
  • THIRD_PARTY_NOTICES.md, npm/THIRD_PARTY_NOTICES.md and scripts/generate-third-party-notices.ts are unchanged from main. Nothing third-party ships.

Size

Measured on the compiled CLI with the same flags as apps/cli (bun build src/cli.ts --compile --splitting --minify):

Build Bytes
Base (main 527d4f8) 72,643,298
This PR 72,659,810
Growth +16,512

The data module is 10,392 bytes. Growth is the data plus the rule's code, rounded up to the binary's 16 KB layout.

Changes from the claude-review on 152726d

  • (medium) Licence: fixed as above, with our own MIT list.
  • (low) Doubled words: as, in, is and it are dropped from the list. The delta review then found that on and at repeat correctly too ("turn it on on startup", "look at at least two"), so those are dropped as well. A test pins all six.
  • (low) Inputs versioned and linked in the data README, with their licences.
  • (nit) Entry count: a test pins 523 lines, sorted, unique, all ^[a-z]+ [a-z]+$. The info status for body-only findings was already tested.

Opus delta review: licence and false positives on real pages

  • Licence hygiene: clean.
    • The reviewer searched the full diff vs main and found no Wikipedia-derived data and no NOTICES change.
    • It checked the word-list packages against the README's licence table.
  • Real pages: 44 fetched pages were scanned, 43 of them English, plus 3 targeted pages about people with typo-like names. The mix covered news, government, documentation, blogs, shops, SaaS, Wikipedia articles, forums and recipe sites.
    • Ordinary pages gave 4 hits, all true: 3 misspellings and a doubled "a a" in Hacker News comments.
    • Pages about a person named like a typo gave false positives. Title warnings on the "John Singer Sargent" and "Kelsey Grammer" articles, and a caption hit on the Grammer article, were all fixed in this round:
      • sargent is dropped.
      • A word the page's body capitalises mid-sentence is now treated as a name everywhere on the page (title, headings, sentence starts and captions). A test covers it.
      • A follow-up review found a leak: breadcrumbs, links and buttons that echo a misspelt title in Title Case ("Home › Accomodation") made the title's typo look like a name. Names now come from prose only, never from links, buttons, labels, menus, nav or breadcrumb containers. Tests cover breadcrumb, inline link, button-row and nav echoes.
      • An opening bracket no longer counts as a sentence start, so "(Sargent 1884)" is read as a name.
    • The one remaining false positive is the Malay loanword in "teh tarik", lowercase in body copy. It is an info finding, so it is not listed in the report.
  • The data README records the entries dropped as surnames or brands, foreign words, or ambiguous.

Changes from the earlier reviews (2026-10-12 and 801bcee)

Agent skill: yes, the squirrelscan agent skill (squirrelscan/skills) should learn the new rule; the maintainer files that as a private issue. Per-category counts are left for the maintainer's batched docs PR.

Known gaps and decisions for review

  • Info findings do not reach the report. Body-prose and doubled-word findings are info, and only fail and warn checks are listed as issues. The docs say so.
  • Recall: 523 entries cover the common slips rather than the long tail. A follow-up could grow the list from words our own crawls see across many sites, checked the same way.
  • Cached snapshots written before this PR have no misspellings field on their collected signal. They read as no findings, the same as the other collected fields.
  • The rule has no siteQuery path. It reads collectedSignals when present, and the legacy site.pages otherwise.

Verification

bun run scripts/check-common-misspellings.ts <scratch>/node_modules/wordlist-english <scratch>/node_modules/an-array-of-english-words/index.json  # 523 entries checked
(cd packages/rules && bun test tests/common-misspellings.test.ts)   # 27 pass, 0 fail
(cd packages/rules && bun test tests/placeholder-text.test.ts tests/perf-total-byte-weight-per-page.test.ts tests/ws4-rule-batches.test.ts)  # 118 pass
(cd packages/audit-engine && bun test tests/streaming-rules-canonical-golden.test.ts)  # 1 pass
(cd packages/audit-engine && bun test tests/streaming-rules-golden.test.ts tests/streaming-pre-rules-golden.test.ts tests/template-cluster-key-golden.test.ts)  # 24 pass
tsgo --noEmit: rules, audit-engine, cli            # clean
bun run notices:check                              # up to date (67 packages)
git ls-files -z | xargs -0 uvx --from detect-secrets==1.5.0 detect-secrets-hook --baseline .secrets.baseline  # clean
bun run scripts/test-suites.ts --check             # every test file covered
(cd docs && bun run check)                         # tangly check --strict: all checks passed

The rule, test, check script and data files are oxfmt- and oxlint-clean.

Checklist

  • I added or updated tests for behavioral changes.
  • I did not include secrets, customer data, or incompatible third-party material.
  • Every commit includes a DCO Signed-off-by line (git commit -s).

Acceptance criteria

  • Licence decision recorded: the list is our own and MIT. The method, the check and the input licences are in the data README (see above).
  • Fixture: English page with "We will recieve your order" produces one info check recieve → receive with the page URL and a context snippet. This is rule-level only; see the report gap above.
  • 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: lang="de", no lang, and a <span lang="fr"> block on an English page produce no findings.
  • Fixture: misspellings inside <code>, <pre>, <kbd>, a URL, an email address, an ALL CAPS word and a mid-sentence capitalised word produce no findings.
  • colour and organise produce no findings.
  • The same misspelling on 5 pages produces one finding with a page count of 5 and capped examples.
  • A word in ignore_words is never reported.
  • Compiled binary growth is no larger than the raw data size plus a few KB (measured above).
  • Docs page under docs/rules/content/, wired into docs.json and the content index.

Closes #709

@claude

claude Bot commented Oct 12, 2026

Copy link
Copy Markdown

Review of the content/common-misspellings rule. I read the rule, the signal wiring and the docs/licence changes. I did not run the tests or read the data file entry by entry.

  • (medium) packages/rules/src/reliability/*, docs/rules/reliability/*, packages/rules/tests/broken-resources.test.ts, categories.ts: this PR also adds a whole new reliability/broken-resources rule and a new Reliability category. That is a separate feature from the misspelling rule, and the PR description doesn't mention it (only the category-count test bump hints at it). Please split it into its own PR, or describe it and its scoring impact (it is placed in the performance group at priority 72) in this one. It changes category counts and docs pages for every user.
  • (medium) common-misspellings.ts:90 (NON_WORD_SPANS): \S+@\S+ and \S+ after https?:// swallow trailing prose. For example, see https://x.com/a.Teh or an unspaced [email protected] are blanked out. That only costs missed findings, so it is not dangerous. It is worth a test showing that sentence punctuation after a URL doesn't hide the next word.
  • (medium) common-misspellings.ts:313: with the 50-findings cap, a site with many one-page misspellings is truncated silently. Please say in the summary or a check message when findings were dropped, so the cap isn't mistaken for the full list.
  • (low) common-misspellings.ts:291: ignore_words applies only to misspellings, not to doubled words. That is probably intended, but the docs should say so.
  • (low) common-misspellings.ts:233: <title> is scanned without the lang exclusion checks that headings get. This only matters when <title lang="fr"> is set, which is rare.
  • (low) common-misspellings.ts:194: DOUBLED_FUNCTION_WORDS includes as, in, is, it and a. Spots like "as as" in "as well as as ..." and the initialism in "Is it IT it" are false-positive risks. Both are info-level only, so the harm is small. Consider whether a and as are worth keeping.
  • (low) common-misspellings.ts:217: JSON.parse(... as unknown as string) trusts the text import. The with { type: "text" } import works under Bun. Please confirm that the non-Bun path (e.g. the vitest/node test runner or any npm-consumed build of packages/rules) resolves it the same way.
  • (low) Licence: the CC BY-SA 4.0 data bundled into an MIT binary is handled sensibly (separate file, README, notices). Please have the maintainers confirm that the compiled binary embedding the text is acceptable under ShareAlike. A data file embedded in a compiled binary is arguably an adaptation or collective work, which is a legal call rather than a code one.
  • (nit) metaDescription is defined after its first use. It's hoisted, but moving it above scanPageForMisspellings would read better.
  • (nit) .gitignore: the !packages/rules/src/content/data/ negation works, but it relies on ordering after data/. A comment saying so would help.

Test coverage: common-misspellings.test.ts exists, and the category and loader tests were updated. I'd add cases for the URL/email stripping edge, the ignore list, the lang and translate=no exclusions, and the cap behaviour.

@nc9

nc9 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer review (2026-10-12)

Verdict: needs fixes (medium to high). I reviewed head 34005fb against main 2dca3b9. Main CI is green at that sha, so the red checks come from this PR. This branch also carries #714's first commit (f9cf0737).

Acceptance criteria (#709)

All 11 boxes are ticked, and 10 are fully met. AC2 is only partly met: the check status is warn, but meta.severity: "info" makes the report show the finding as info (a recommendation). See fix 4.

The licence decision is recorded in the maintainer comment on #709. The NOTICES entries (THIRD_PARTY_NOTICES.md, npm/THIRD_PARTY_NOTICES.md) and packages/rules/src/content/data/README.md are present. The binary grows by 90,112 bytes against 94,119 bytes of raw data.

Fixes

  1. Rebase onto main after feat(rules): add reliability/broken-resources and the Reliability category #703 #714 (and feat(rules): add links/broken-anchors for in-page anchor links #718) merge. feat(rules): add reliability/broken-resources and the Reliability category #703 #714 lands as a squash, so drop its first commit instead of replaying it:

    git fetch origin
    git rebase --onto origin/main f9cf0737 claude/709-common-misspellings
  2. Golden gate. It fails "Audit engine golden tests" and the "Audit engine tests" step of "CLI tests". The apps/cli tests step itself passes.

    • File: packages/audit-engine/tests/streaming-rules-canonical-golden.test.ts.
    • expect(v1.findings.length) (line 154; 101736 on today's main). CI received 101738 because this branch also carries feat(rules): add reliability/broken-resources and the Reliability category #703 #714's rule. After the rebase, content/common-misspellings adds exactly 1 to whatever main has. Add a comment line in the existing style, for example // <n> -> <n+1>: content/common-misspellings is site-scoped and adds one whole-crawl check (#709). <its status on the fixture>.
    • expect(v1.perRuleTally.length) (line 176; 301 on today's main) fails next. Raise it by 1 and extend the tripwire comment.
    • Take both numbers from the main you rebase onto.
    • Verify with cd packages/audit-engine && bun test tests/streaming-rules-canonical-golden.test.ts. healthScore.overall must not move, or the comment must explain why.
  3. CI "Secret scan". detect-secrets' KeywordDetector flags packages/rules/src/content/data/common-misspellings.json:1 (keys such as "secretery"). JSON cannot carry a pragma comment, so exclude the file in the baseline:

    uvx --from detect-secrets==1.5.0 detect-secrets scan --baseline .secrets.baseline \
      --exclude-files '^packages/rules/src/content/data/common-misspellings\.json$'
    git ls-files -z | xargs -0 uvx --from detect-secrets==1.5.0 detect-secrets-hook --baseline .secrets.baseline
    • Commit .secrets.baseline. The second command is the exact CI check.
    • If the exclusion does not stick, baseline the finding itself instead (the same scan without --exclude-files).
  4. Severity. Set meta.severity: "warning". packages/report/src/grouping.ts gives a rule with only warn checks the rule's meta severity, so a misspelling in a title, description or heading is shown as info today. Info checks stay info. Update the docs table ("Severity info").

  5. Measured regex DoS. NON_WORD_SPANS = /\b(?:https?:\/\/|www\.)\S+|\S+@\S+/gi is quadratic on one unbroken run of non-space characters:

    Run length Time
    10k chars 120 ms
    20k 418 ms
    40k 2.7 s
    80k 11.3 s
    • The rule time budget does not stop it. Under the same vm timeout that runWithinBudget uses (1000 ms), the 80k case still ran 7.4 s, because the timeout cannot interrupt a running regex. One hostile 1 MB <p> stalls an audit for minutes.
    • Bound the spans (\S{1,256}@\S{1,256}, https?:\/\/\S{1,2048}), or split on whitespace and test each token with includes("@") and startsWith.
    • Add a timing test: 160 KB of a in a paragraph must scan in well under a second (about 200 ms).
  6. Docs.

    • Quote the template "{word}" → "{correction}" on {count} pages, not ... on 5 pages.
    • The page says each misspelling "is listed" in the report, but info findings never reach the report (the PR's own known gap). Say that only warnings appear there.
  7. Open review-bot findings.

  8. Attribution of the data. CC BY-SA asks for the author, so name "Wikipedia contributors" in the NOTICES row.

PR hygiene

  • CHANGELOG: add one line under ## [Unreleased] / ### Added, ending with squirrelscan/squirrelscan#709.
  • PR description: add a line saying whether the squirrelscan agent skill (squirrelscan/skills) needs a change.
  • Attribution:
    • Remove the Co-Authored-By: and Claude-Session: trailers from every commit, and keep Signed-off-by:.
    • Remove the "Generated with Claude Code" footers and the session URL from the PR body.
    • No attribution lines of any kind in commit or PR text.
  • Docs: quote message templates with placeholders, never filled examples. No em-dashes.
  • Rule counts: leave the per-category counts in the README and docs tables. The maintainer will update them in one docs PR after these rule PRs merge.

Merge order

Fifth: after #714, #718, #717 and #715.

@claude

claude Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review of content/common-misspellings. I read common-misspellings.ts and the collected-signals.ts wiring. I did not run the tests or read the test file, the build script or the docs.

  • (medium) common-misspellings.ts:19 This is the only with { type: "text" } JSON import in packages/. Please confirm it works in every runtime that loads @squirrel/rules: the compiled binary, the npm package build, and the test runner. If any of them is not Bun, the rule will crash at import time. That would also break collected-signals.ts, which imports scanPageForMisspellings unconditionally. A test that loads the module through each build path would cover this.
  • (medium) common-misspellings.ts:166 The MAX_OCCURRENCES_PER_PAGE cap is checked only in the loop condition of scanText. Once the page is at the cap, the title, description and heading scans still run, and the body scan starts with out already full. Meanwhile a single iteration can push two entries (a misspelling plus a doubled word), so a page can end with 51. Neither is a correctness problem. But on a page with many title or heading hits, body findings are silently dropped, and the cap is not strict. Consider scanning the body first, or reserving a share of the cap for prominent text.
  • (low) common-misspellings.ts:127 startsSentence accepts : and ( as sentence starts. A capitalised proper noun after a colon ("Built with: Django") is then judged as an ordinary word. That could produce false positives if the data list contains a word that is also a name. ignore_words is the only escape hatch for this.
  • (low) ignore_words applies only to misspellings, not doubled words. That is probably intended, but the docs and the option description should say so.
  • (low) The new JSON file is about 99 KB of data, parsed lazily on first use. Compare it with the Wikipedia source's own caveat that some entries are valid words in some contexts (for example, British and American variants, or archaic forms). Check that the build script filters those out. If it does not, a sample of the output would catch false-positive entries.
  • (nit) getTable is documented as saving cost for audits that never reach a candidate word, but the scanPageForMisspellings path calls it on every English page. The comment overstates the laziness, since it only saves the parse on non-English sites.
  • (nit) Licensing is handled well: CC BY-SA 4.0 data kept separate from the MIT code, a README beside the file, and the notice added to both THIRD_PARTY_NOTICES.md files. Please also make sure the .gitignore un-ignore is narrow, so it does not re-include unrelated data/ directories.

I found nothing critical or high-risk. The URL and email handling avoids regex backtracking, and the streamed and legacy paths share one scan function.

🤖 Generated with Claude Code

@nc9
nc9 force-pushed the claude/709-common-misspellings branch from 801bcee to 152726d Compare October 13, 2026 03:00
@nc9

nc9 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Replies to the review of 801bcee. Both mediums are fixed in 152726d; the PR body section "Changes from the claude-review on 801bcee" has the details.

  • (medium) The with { type: "text" } import:
    • The data is now a generated TS module, data/common-misspellings-data.ts. It is one plain string with no import attribute or JSON loader, and a test fails if either comes back.
    • Compiled CLI: audits a fixture page and reports the misspelling, with binary growth of 82,560 bytes.
    • npm package: it downloads the same binary.
    • Tests: bun test imports the module directly.
    • Workers bundle: wrangler's esbuild 0.28.1 builds the module, and the bundled output finds the misspelling and the doubled word.
  • (medium) Per-page cap:
    • It is now one strict budget per page, with each distinct word counted once.
    • The title, description and headings share a quota of 25, and the body has its own 25.
    • Recording stops at exactly 25. Once a quota is spent, the scan stops: tokenizing is a generator, and later headings are not read.
    • The body scan leaves headings out, so a page with 60 misspelt headings keeps all its body findings. There are tests for this.
  • (low) : and ( as sentence starts: kept. Keys are lowercase single words that are not everyday English, so a capitalised key after a colon is far more likely to be a typo than a name. ignore_words covers brands.
  • (low) ignore_words and doubled words: the docs already said it does not apply to them, and now the option description does too.
  • (low) British and American variants: the build drops misspellings that are everyday words, and a test pins colour and organise as clean.
  • (nit) getTable comment: fixed; it says the parse runs on the first English page.
  • (nit) .gitignore: it un-ignores only packages/rules/src/content/data/.

@claude

claude Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review of the new content/common-misspellings rule. I read the diff only. I did not run the tests or the build.

The rule is well bounded. It has per-page quotas, a finding cap and a per-token URL/email check that avoids a regex backtracking problem. The tests cover exclusions as well as detections. The streamed and legacy paths share scanPageForMisspellings, so they can't disagree.

  • (medium) THIRD_PARTY_NOTICES.md / common-misspellings-data.ts: the bundled data is CC BY-SA 4.0 and ships inside an MIT-licensed binary. The notices and the data README disclose it. The ShareAlike clause may still apply to the adapted data, and the binary embeds a modified (filtered and reshaped) copy. I'd get a maintainer or legal decision on whether that is acceptable. Another option is to sidestep it by building the list from a permissively licensed source.
  • (low) common-misspellings.ts DOUBLED_FUNCTION_WORDS: as as, in in, is is and it it can be grammatical in rare constructions. Examples are "as as" in a quoted phrase and "what it is is…". The findings are info only, so the impact is low. Consider dropping as, is and in to cut false positives.
  • (low) scripts/build-common-misspellings.ts: the two word-list inputs are not versioned or linked. The generated data can't be reproduced from the repo alone. Record their source in the data README.
  • (nit) summarise: rule.meta.severity is warning, but only prominent misspellings emit warn. The comment explains this, so it is fine. A test pinning the info status for body-only findings would help if one doesn't exist.
  • (nit) getTable parses the map lazily with no test of its size. A small sanity test on entry count would catch a bad regeneration of the data.

I found no critical or high-severity problems.

🤖 Generated with Claude Code

@claude

claude Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review of content/common-misspellings. I read the rule source in full. I did not read the 523-entry data file or the tests line by line. I could not run the tests: @squirrelscan/parser/dom doesn't resolve in this checkout because dependencies aren't installed.

  • (low) packages/rules/src/content/common-misspellings.ts (aggregate, ignore_words): ignored words are filtered at aggregation, after the per-page quota (25 distinct words) has already been spent. A site that uses a deliberate brand spelling heavily could crowd real typos out of the quota on a given page. Passing the ignore set into scanPageForMisspellings would fix it, but the streamed collector may not have the options at page time, so it may be an accepted trade-off. Worth a docs note if so.
  • (low) finding.prominent ||= occ.prominent: one title hit on a single page makes the whole word a warn, even if it appears in body text on 100 other pages. That looks intentional and is reasonable, but the docs should say it.
  • (nit) getTable parses on first use and caches in module state. This is fine. A one-line comment saying lines without a space are ignored silently would help, since the check script is the only guard.
  • (nit) startsSentence treats : as a sentence start, so "Note: Teh" is judged as a sentence-start word. That only makes the rule more lenient, so I'd leave it.

Positives:

  • The per-token URL and email check avoids the quadratic backtracking regex.
  • The scan stops as soon as a quota is spent.
  • The streamed and legacy paths share one scan function.
  • The data is our own MIT list, with provenance documented in data/README.md.
  • The .gitignore exception is narrowly scoped.
  • The docs and changelog are updated and the golden test was adjusted.

I found no high or critical issues.

Site-scope rule that reports known misspellings and doubled function words
in the visible English text of pages whose <html lang> is en. A lookup in a
bundled map of 523 common misspellings written for squirrelscan (MIT),
grouped by kind of slip: ie/ei swaps, doubled or single consonants, confused
suffixes, wrong unstressed vowels, dropped or added letters, and swapped
letters in very common words. Nothing is copied or derived from a published
misspelling list (Wikipedia's, and codespell, misspell, typos and cspell,
which trace back to it, are CC BY-SA or derived from it).

- scripts/check-common-misspellings.ts checks the list against SCOWL
  (wordlist-english 1.2.1) and an-array-of-english-words 2.0.0, which are
  used only by the check and not shipped. Every correction is a common word
  (SCOWL size 60 or below, US, British, Canadian or Australian spelling), and
  every misspelling is no word in either list, so a valid spelling in any
  variant is never reported. Surnames and brands that look like typos,
  words that are real in other languages, and misspellings one letter from
  two different words are left out. The data README records the method, the
  input versions and their licences.
- The data is a TypeScript module exporting one plain string, so it loads the
  same in every runtime that imports the rules, with no JSON import or
  import attribute.
- A misspelling in the title, meta description or a heading warns (meta
  severity warning); body-copy misspellings and doubled words are info.
  Doubled words skip as, at, in, is, it and on, which can repeat correctly.
- A word the page's prose capitalises mid-sentence is a name ("the actor
  Kelsey Grammer"), so it is not judged in a title, a heading or at a sentence
  start either. Links, buttons, menus and breadcrumbs that echo a title in
  Title Case are not prose and never mark a name. An opening bracket no longer
  counts as a sentence start.
- Per page, each distinct word counts once. The title, description and
  headings (25) and the body (25) have separate quotas, the body scan leaves
  headings out, and a spent quota stops the scan.
- URL and email tokens are blanked per whitespace-separated token, not by a
  regex over the whole text: `\S+@\S+` backtracked quadratically on one long
  unbroken run (80k characters took 11 s, and the rule time budget cannot
  interrupt a regex). 160 KB with no space now scans well under a second.
- A <title> in another language (or translate="no") is skipped, and headings
  are read like body copy (code, kbd and foreign spans inside them skipped).
- Past the 50-finding cap, an info check counts the findings not listed.
- Streamed audits read the page-time scan from collectedSignals; the legacy
  pass re-scans the stored DOM. Both call scanPageForMisspellings.
- ignore_words option, matched case-insensitively (misspellings only).
- Docs page under docs/rules/content/, wired into docs.json and the content index.
- .gitignore: the data/ rule would have excluded the bundled data file.

No network requests.

Golden gate: findings 101742 -> 101743 and tally rows 307 -> 308 (a pass on
the synthetic copy); healthScore.overall stays 51.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the claude/709-common-misspellings branch from a60fcbd to f7f009c Compare October 13, 2026 04:33
@claude

claude Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review of content/common-misspellings. I read the diff for the rule, the collector wiring, the text helper, the check script and the golden-test changes. I did not run the tests or read the 523-entry data file line by line.

No critical or high issues found. The design holds up. The scan runs once per page at collection time, so a streamed crawl keeps small bounded records instead of parsed DOMs. The legacy and streamed paths share scanPageForMisspellings, so they cannot disagree. URL and email handling avoids the quadratic regex backtracking. Licensing is handled cleanly with an in-house list and a README.

  • (low) common-misspellings.ts, aggregate/scanText: ignore_words is applied only at aggregation, after the per-page quota (25 distinct words in the body, 25 in the prominent text) is spent. A page whose quota is filled by ignored brand spellings can crowd out real misspellings, so they are never reported. Passing the ignored set into scanText or record would fix this, at the cost of the scan no longer being option-independent. If you keep the current design, say so in a comment.
  • (low) tokenize: WORD is [A-Za-z]+, so apostrophes split contractions into fragments ("don't" becomes "don" and "t"). Fragments are judged separately. This is harmless today as long as no list entry is a plausible fragment, so I'd add a check for it in check-common-misspellings.ts or the tests. Non-ASCII letters also split words, so "café" is scanned as "caf".
  • (low) scanPageForMisspellings: bodyText, proseText and namesIn each walk or tokenise the whole body, and the body text is not size-capped. The rule budget guards this per page, so it is fine in practice. A text-length cap, as the doubled-word and URL notes imply you considered, would make the worst case predictable.
  • (nit) MisspellingOccurrence.prominent is hard-coded to false for doubled words, even in titles and headings. That is fine as a product decision, but it is only stated in the PR description, so a one-line comment at the call site would help.
  • (nit) scripts/check-common-misspellings.ts needs external npm word lists, so CI cannot run it. Consider a lightweight in-repo test for sorting, duplicates and format only. That test would catch the most common data-edit mistakes without the external lists.
  • (nit) The new golden-test comment says "(New rule: content/common-misspellings - known typos and doubled words on English pages #709)". Check that this is the right issue or PR number.

@nc9
nc9 merged commit f55626e into main Oct 13, 2026
15 checks passed
@nc9
nc9 deleted the claude/709-common-misspellings branch October 13, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant