feat(linter/plugins): support more selector classes in visitor#17219
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR extends selector class support in the oxlint visitor system, adding support for :statement, :declaration, :pattern, and :expression selector classes. Previously, only the :function class was supported. This enhancement enables the padding-line-between-statements rule to work correctly, fixing 260 conformance tests.
Key Changes
- Refactored the selector class tracking from a simple list to a structured
SelectorClassesstruct in the Rust code generator - Generated type ID arrays for all selector classes in the TypeScript side
- Updated the
matchesSelectorClassfunction to handle all selector classes with proper ESLint-compatible logic - Added special handling for
Identifiernodes inMetaPropertycontexts
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tasks/ast_tools/src/generators/estree_visit.rs |
Added SelectorClasses struct to track and generate type IDs for all selector classes; removed hardcoded function type names |
apps/oxlint/src-js/plugins/selector.ts |
Implemented complete matchesSelectorClass function with all selector classes; added imports for new type ID constants |
apps/oxlint/src-js/generated/type_ids.ts |
Generated exports for statement, declaration, pattern, and expression type ID arrays |
apps/oxlint/test/fixtures/selector/* |
Added test cases covering the new selector classes |
apps/oxlint/test/compile_visitor.test.ts |
Added comprehensive test validating all selector classes |
apps/oxlint/conformance/snapshot.md |
Updated to reflect 260 fewer failing tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
65fd4e8 to
f2800e7
Compare
9218edb to
53e4c8b
Compare
Merge activity
|
We already supported `:function` class selector, but no others. Add support for all the classes that ESLint supports: `:statement`, `:declaration`, `:pattern`, `:expression`. This fixes 260 conformance tests.
f2800e7 to
6f753a8
Compare
53e4c8b to
33b4e63
Compare

We already supported
:functionclass selector, but no others.Add support for all the classes that ESLint supports:
:statement,:declaration,:pattern,:expression.This fixes 260 conformance tests.