Skip to content

docs(rules): make "Enable only this rule" run the rule #472 - #479

Merged
nc9 merged 1 commit into
mainfrom
docs/enable-only-this-rule-472
Oct 6, 2026
Merged

nc9 merged 1 commit into
mainfrom
docs/enable-only-this-rule-472

Conversation

@nc9

@nc9 nc9 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Closes #472

What was wrong

All 288 rule pages under docs/rules/ showed this "Enable only this rule" example:

[rules]
enable = ["a11y/color-contrast"]
disable = ["*"]

Disable patterns are checked first, and any match disables (isRuleEnabled in packages/rules/src/filter.ts, createRuleConfig in apps/cli/src/infra/context.ts). So disable = ["*"] switched off every rule, including the one the example meant to keep. docs/configuration/examples.mdx had the same pattern in four blocks.

The fix

  • Rule pages (287): the example keeps only the enable list, followed by one sentence. enable replaces the default ["*"] (RulesConfigSchema), so this is the only rule selected; disable must stay out because any match wins; only a rule's own [rule_options] enabled setting overrides both lists.
  • The six pages that already show CLI flags (perf/browser-required and five schema/entity-* pages) also show squirrel audit https://example.com --rule-include <id>.
  • content/quality: the rule is disabled: true in its metadata, and the loader drops it before any config is read, so no configuration runs it. Its page now says that instead of offering an example.
  • docs/configuration/examples.mdx: disable = ["*"] is removed from four blocks.
    • The performance example's enable list named three ids that match no rule: performance/* (the category code is perf, and there is no performance alias), core/preconnect (that rule is perf/preconnect) and core/preload (no such rule). It is now perf/* plus images/*.
    • All 15 TOML blocks on the page parse (tomllib).
  • The pages were edited by script. Each replaced block's rule id was asserted to equal the page's path, and git diff --stat shows exactly 288 rule pages plus examples.mdx. No CHANGELOG change.

Evidence (CLI from source, scratch HOME, cwd outside the repo, local fixture, --http --refresh -m 1)

Distinct rule_ids recorded in rule_results for each run:

squirrel.toml / flags Rules run
old example: enable = ["a11y/color-contrast"], disable = ["*"] 0
new example: enable = ["a11y/color-contrast"] 1 (a11y/color-contrast, warn)
no config 282
--rule-include a11y/color-contrast, no config 1 (a11y/color-contrast)
new performance example: enable = ["perf/*", "images/*"] 45, all perf/ or images/
enable = ["a11y/color-contrast"], disable = ["core/*"], [rule_options."core/meta-title"] enabled = true 2 (the override wins, as the new sentence says)
enable = ["content/quality"] + [rule_options."content/quality"] enabled = true 0 (never loaded, as its page now says)

bun x [email protected] check --strict passes.

Left alone

examples.mdx still has stale rule_options tables, outside the [rules] blocks this fixes: performance/ttfb with warn_threshold, while the rule is perf/ttfb with good_threshold/poor_threshold, plus performance/dom-size and performance/cls-hints. Filed as #478.

Every rule page paired enable = ["<id>"] with disable = ["*"]. disable
is checked first and any match disables, so the example ran nothing. The
pages now keep only the enable list and say why disable must stay out; the
six pages that already show CLI flags also show --rule-include. Four
configuration examples had the same pattern, and the performance one also
listed ids that match no rule (performance/*, core/preconnect,
core/preload), now perf/*. content/quality is never loaded (disabled in its
metadata), so its page says so instead of offering an example.

Closes #472

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review October 6, 2026 01:08
@nc9
nc9 merged commit b7b17ef into main Oct 6, 2026
14 checks passed
@nc9
nc9 deleted the docs/enable-only-this-rule-472 branch October 6, 2026 01:08
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: every rule page's "Enable only this rule" example disables all rules

1 participant