Repository navigation
docs(rules): make "Enable only this rule" run the rule #472 - #479
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #472
What was wrong
All 288 rule pages under
docs/rules/showed this "Enable only this rule" example:Disable patterns are checked first, and any match disables (
isRuleEnabledinpackages/rules/src/filter.ts,createRuleConfiginapps/cli/src/infra/context.ts). Sodisable = ["*"]switched off every rule, including the one the example meant to keep.docs/configuration/examples.mdxhad the same pattern in four blocks.The fix
enablelist, followed by one sentence.enablereplaces the default["*"](RulesConfigSchema), so this is the only rule selected;disablemust stay out because any match wins; only a rule's own[rule_options]enabledsetting overrides both lists.perf/browser-requiredand fiveschema/entity-*pages) also showsquirrel audit https://example.com --rule-include <id>.content/quality: the rule isdisabled: truein 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.enablelist named three ids that match no rule:performance/*(the category code isperf, and there is noperformancealias),core/preconnect(that rule isperf/preconnect) andcore/preload(no such rule). It is nowperf/*plusimages/*.tomllib).git diff --statshows exactly 288 rule pages plusexamples.mdx. No CHANGELOG change.Evidence (CLI from source, scratch HOME, cwd outside the repo, local fixture,
--http --refresh -m 1)Distinct
rule_ids recorded inrule_resultsfor each run:squirrel.toml/ flagsenable = ["a11y/color-contrast"],disable = ["*"]enable = ["a11y/color-contrast"]a11y/color-contrast, warn)--rule-include a11y/color-contrast, no configa11y/color-contrast)enable = ["perf/*", "images/*"]perf/orimages/enable = ["a11y/color-contrast"],disable = ["core/*"],[rule_options."core/meta-title"] enabled = trueenable = ["content/quality"]+[rule_options."content/quality"] enabled = truebun x [email protected] check --strictpasses.Left alone
examples.mdxstill has stalerule_optionstables, outside the[rules]blocks this fixes:performance/ttfbwithwarn_threshold, while the rule isperf/ttfbwithgood_threshold/poor_threshold, plusperformance/dom-sizeandperformance/cls-hints. Filed as #478.