Re-enable no-incorrect-query-selector and require-array-sort-compare#289
Merged
Conversation
Reverses the blanket disable from #288 for these two rules. no-incorrect-query-selector → error. Its one site (placeholder.test.ts) is a deliberate `querySelectorAll("#id")` used to assert the match *count*, which getElementById can't express — scoped inline disable with rationale. require-array-sort-compare → error. Non-constant arrays now pass an explicit comparator instead of relying on the default sort: - build-site-data.ts, check-background-purity.ts, site-data.test.ts: readdir results → `.toSorted((a, b) => a.localeCompare(b))` - manifest-permission-diff.ts: computed permission diffs → same The compile-time-constant catalog lists in catalog.test.ts (RULE_IDS, Object.keys(RULE_DEFAULTS), …), sorted only to compare order-independently, keep a scoped inline disable. Codegen output (site-data.generated.ts) unchanged — localeCompare matches the previous order for these filenames. Refs #279 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Reverses the blanket disable from #288 for these two rules now that we have a clean way to handle each site.
no-incorrect-query-selector→ errorOne site:
placeholder.test.tsusesquerySelectorAll("#target")deliberately to assert the match count (toHaveLength(1)), whichgetElementByIdcan't express. Scoped inline disable with rationale.require-array-sort-compare→ errorThe distinction is constant vs non-constant arrays:
Non-constant arrays now pass an explicit comparator
(a, b) => a.localeCompare(b)(the appropriate fix, not a suppression):build-site-data.ts,check-background-purity.ts,site-data.test.ts—readdirSyncresultsmanifest-permission-diff.ts— computed permission-set diffsCompile-time-constant catalog lists keep a scoped inline disable —
catalog.test.tssortsRULE_IDS,Object.keys(RULE_DEFAULTS), etc. only to compare set membership order-independently; the default order is fine and a comparator would add nothing.Codegen output (
site-data.generated.ts) is unchanged —localeComparematches the previous default order for these filenames, so no generated-file drift.Verification
bun run checkexit 0 (both rules error; 0 violations;no-unused-disableclean)bun run typecheckcleanbun run test— 2059/2059 passbun run buildsucceeds, generated file unchangedRefs #279