Skip to content

docs(config): document the rule options rules actually read #496 - #513

Merged
nc9 merged 1 commit into
mainfrom
docs/rule-options-496
Oct 6, 2026
Merged

nc9 merged 1 commit into
mainfrom
docs/rule-options-496

Conversation

@nc9

@nc9 nc9 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #496

Cause

docs/configuration/rule-options.mdx configured options no rule reads, so copying them changed nothing. Rule options are looked up by exact rule id (getRuleOptions in packages/rules/src/runner.ts), and each rule's zod optionsSchema drops keys it does not know, without a warning. A few other pages had disable entries and a pattern that match nothing.

Fix

configuration/rule-options.mdx, every table checked against the rule's optionsSchema (or its raw option reads):

  • content/article-links: min_external_links → the real short_/medium_/long_min_external, *_min_internal, short_max_words, long_min_words. The page also says the rule only runs on article pages.
  • links/orphan-pages, links/dead-end-pages: exclude_patterns → excludePatterns, plus the options they also read (minInboundLinks, minLinks, countAnchorLinks). It notes that setting dead-end's excludePatterns replaces its five defaults.
  • performance/ttfb, performance/dom-size → perf/ttfb (good_threshold / poor_threshold) and perf/dom-size (plus max_depth, max_children).
  • content/keyword-stuffing: min_word_count → min_occurrences and whitelist. density_threshold is a percent (default 3), not 0.03. The density section now says how words are counted.
  • security/http-to-https: allow_localhost / allow_patterns → sampleLimit. The section now describes what the rule does (it probes http:// URLs for a redirect).
  • adblock/element-hiding, adblock/blocked-links: lists removed. These are cloud rules matched against EasyList server-side, with maxMatchesToReport only.
  • a11y/skip-link: the required section is removed (the rule takes no options), and the page says to disable the rule instead.
  • crawl/all-noindex-pages: threshold → warnOnPatterns / errorOnPatterns.
  • URL patterns have no globs. "/lp/*" and "/.well-known/*" matched nothing. A new section gives the three real forms (substring, /segment/, regex:). Regexes need TOML single quotes: the CLI's TOML parser rejects "regex:^/blog/\d{4}/".
  • Also corrected: links/internal-links defaults (min 1, max 100), and the word-count band (thin content warns, it does not fail). The nonexistent squirrel rules show / rules list --with-options commands are replaced by the rule pages' Options tables. The validation section now says what really happens to a mistake (next section).

Other pages:

  • configuration/rules.mdx: core/og-* matches no rule (only * and category/* are supported), so the page now says so and lists the rules instead. The default disable is [], not the three-rule list. content/quality and ai/ai-content are dropped from every disable list, with a note that both are retired and never load.
  • cli/analyze.mdx, cli/config.mdx: content/quality dropped from their disable lists.
  • cli/init.mdx: the "Default config" block is now the file squirrel init actually writes (run from source). It had a stale disable list and max_pages = 500 (the default is 100).
  • rules/content/quality.mdx, rules/ai/ai-content.mdx: their enable/disable sections (which do nothing) are replaced by a note that the rule never loads. Two claims are fixed: that enabling ai/ai-content produces a skip, and that content/quality "runs on a cloud audit".
  • configuration/examples.mdx: two ** glob patterns fixed ("/api/deprecated/", "/.well-known/").

Evidence

Static check of every docs page: a script parses every TOML block under docs/, then checks each [rule_options."…"] table against loadAllRules() and the rule's schema, and each [rules] pattern against matchesRulePattern.

  • Before (origin/main): 43 problems. That is 29 option keys no rule reads, 7 tables naming a rule id that does not exist, and 7 [rules] patterns that match no loaded rule (core/og-* and the retired content/quality / ai/ai-content).
  • After: 0, with 174 option uses checked.

Audits from source (bun apps/cli/src/cli.ts audit, scratch HOME, --offline --refresh) against a local fixture: a noindexed /blog/post/ with a repeated word, a dead-end /landing/, and an unlinked /hidden/ in the sitemap. Three configs:

default config:
  content/keyword-stuffing | warn: 2 word(s) may be overused /blog/post/
  links/dead-end-pages     | warn: Page has no outgoing internal links (dead-end) /landing/
  links/orphan-pages       | warn: 2 orphan page(s) with <2 incoming links /hidden/,/landing/

the page's old keys (exclude_patterns, threshold, density_threshold = 0.03, performance/ttfb warn_threshold = 0):
  identical to the default run: none of them took effect

the corrected keys (excludePatterns, errorOnPatterns = ["/blog/"], density_threshold = 12, perf/ttfb good_threshold = 0):
  crawl/all-noindex-pages  | critical-noindex fail: 1 critical page(s) blocked from indexing (match error patterns)
  links/orphan-pages       | warn: 1 orphan page(s) with <2 incoming links /landing/      (/hidden/ excluded)
  perf/ttfb                | warn: Slow server response (20ms) /  (and the other 4 pages)
  links/dead-end-pages     | gone (/landing/ excluded)
  content/keyword-stuffing | gone (widget at 10.1% is under 12%)
  • All 35 keys across the 14 rules in the corrected page's tables, merged into one squirrel.toml, audit cleanly (exit 0, no option error).
  • The validation claims are from source runs too. config validate says Config valid for min_length = "thirty" and for [rule_options."performance/ttfb"], and the audit then fails with ✗ Audit failed: / Invalid input: expected number, received string. It catches crawler.max_pages = "lots" (Invalid config: crawler.max_pages: Expected number, received string).

Gates

  • bun x [email protected] check --strict in docs/: all checks passed (416 pages).
  • No em-dashes in the changed pages.
  • Codex: two passes. The first found three errors: a wrong-type caveat for crawl/all-noindex-pages, how keyword density counts words, and the all-noindex output being capped lists, not every page. All three are fixed, and the second pass's two wording nits are fixed too.

Follow-ups filed

@nc9
nc9 marked this pull request as ready for review October 6, 2026 23:33
The rule-options reference configured keys no rule reads (min_external_links,
exclude_patterns, lists, required, threshold, allow_*), rule ids that do not
exist (performance/ttfb, performance/dom-size) and a fractional keyword density
the rule reads as a percent. Every table now names a real rule id and only
options it reads, verified against each optionsSchema and by audits run from
source.

Also: URL patterns have no globs ("/lp/*" matched nothing), config validate
does not check rule options, core/og-* matches no rule, and content/quality and
ai/ai-content never load, so their disable entries are gone. cli/init shows the
config squirrel init writes today.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the docs/rule-options-496 branch from ab3fcf7 to ca9ad87 Compare October 6, 2026 23:36
@nc9
nc9 merged commit 4f64a7a into main Oct 6, 2026
14 checks passed
@nc9 nc9 mentioned this pull request Oct 6, 2026
@nc9
nc9 deleted the docs/rule-options-496 branch October 6, 2026 23:42
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.

docs: rule-options reference documents options no rule reads

1 participant