Repository navigation
docs(config): point example rule options at real rule ids and options #478 - #498
Merged
Merged
Conversation
…478 The configuration examples set options under ids and keys no rule reads, so copying them changed nothing: performance/* is perf/*, ttfb takes good_threshold/poor_threshold, article-links has per-length external minimums, orphan-pages and dead-end-pages read excludePatterns, keyword-stuffing's density_threshold is a percentage, and content/quality is disabled in code. The quickstart's --rule-include ax,performance failed with an unknown category; it is ax,perf. 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 #478
Cause
docs/configuration/examples.mdxset rule options under ids and keys that no rule reads. Options are looked up by exact rule id (getRuleOptionsinpackages/rules/src/runner.ts) and parsed by the rule's zodoptionsSchema, which drops unknown keys without a word, so every one of these was a silent no-op.docs/quickstart.mdxshowed--rule-include ax,performance, which the CLI rejects before crawling.Fix
docs/configuration/examples.mdx:performance/*→perf/*;performance/cls-hints→perf/cls-hints[rule_options."performance/ttfb"]→perf/ttfb, withwarn_threshold/error_threshold→good_threshold/poor_threshold(the rule warns atgood_thresholdand fails atpoor_threshold, so each example keeps its numbers)[rule_options."performance/dom-size"]→perf/dom-size(its keys were already right)content/article-links:min_external_links = N→short_min_external,medium_min_external,long_min_externalall= Nlinks/orphan-pages,links/dead-end-pages:exclude_patterns→excludePatternscontent/keyword-stuffing:density_threshold = 0.05→5. It is a percentage (default 3), so0.05meant 0.05% and made the docs example stricter, the opposite of its comment. (Found by the codex pass.)content/qualityfrom adisablelist. It isdisabled: truein code and never loads.docs/quickstart.mdx:--rule-include ax,performance→ax,perf.Proof
Every TOML block on the page was parsed and checked against the rule registry and each rule's
optionsSchemawith a scratch script (smol-toml,loadAllRules,matchesRulePattern):CLI from source, against a local fixture:
The "Performance audit" example, run as
squirrel.toml(output format switched to json) against a page of about 1,200 elements, which sits between the example'swarn_threshold = 1000and the default 1,500:bun x [email protected] check --strictpasses.Left open
Running the same check over every docs page turned up the same problems in
docs/configuration/rule-options.mdx(options reference) and an unsupportedcore/og-*pattern indocs/configuration/rules.mdx. Filed as #496 rather than widening this XS fix.Changelog suggestion
perf/ttfb,good_threshold,excludePatterns, ...), so copying them actually changes the audit.