feat(sort-import-attributes): add 2 useConfigurationIf options: allNamesMatchPattern and matchesAstSelector#719
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
💤 Files with no reviewable changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughIntroduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant Rule as Rule Listener
participant Sorter as sortImportAttributes/<br/>sortExportAttributes
participant Matcher as computeMatched<br/>ContextOptions
participant NameComp as computeNodeName
participant Sort as sortImportOrExport<br/>Attributes
participant Reporter as reportAllErrors
Rule->>Sorter: node, context, matchedAstSelectors
Sorter->>Matcher: attributes, context, matchedAstSelectors
loop For each configuration option
Matcher->>NameComp: extract attribute names
NameComp-->>Matcher: nodeNames
Matcher->>Matcher: check allNamesMatchPattern match
Matcher->>Matcher: check matchesAstSelector match
alt Both conditions met
Matcher-->>Sorter: matched configuration
end
end
Sorter->>Sort: matched config, node, context
Sort->>Sort: partition attributes into groups
Sort->>Sort: construct sorting nodes
Sort->>Reporter: report ordering errors
Reporter-->>Sort: void
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
42fa0a3 to
768c959
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #719 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 216 219 +3
Lines 4358 4341 -17
Branches 1346 1347 +1
=========================================
- Hits 4358 4341 -17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
768c959 to
80ca077
Compare
Description
This PR adds support for the following
sort-import-attributesandsort-export-attributesoptions:useConfigurationIf.allNamesMatchPattern.useConfigurationIf.matchesAstSelector.It also puts some logic in common between the two rules, as they essentially sort the same things.
How to use
Users need to pass an AST selector that matches a
ImportDeclarationorExportNamedDeclarationnode.