ruff
a6a5e8d1 - [ty] Fix precedence of `all` selector in TOML configurations (#23723)

Commit
51 days ago
[ty] Fix precedence of `all` selector in TOML configurations (#23723) ## Summary Closes https://github.com/astral-sh/ty/issues/2952. TOML tables are unordered — the spec says key/value pairs within tables are not guaranteed to be in any specific order. However, the `toml` crate happens to sort keys lexicographically when deserializing. This means that rules like `abstract-method-in-final-class` sort *before* `all`, so the `all` selector silently overrides the more-specific rule when processed sequentially. This PR fixes the issue by sorting selectors from the same configuration file so that `all` is always applied first, then specific per-rule selectors are applied afterwards. This ensures that specific rules always take precedence over `all` within a given config file, regardless of lexicographic ordering. The fix is scoped to file-based configuration only — CLI argument order is still preserved as-is, since users have explicit control over ordering there. ## Test plan Added a test (`configuration_all_rules_with_rule_sorting_before_all`) that uses `abstract-method-in-final-class` (which sorts before `all`) to verify the specific rule takes precedence.
Author
Parents
Loading