Skip to content

Conversation

@hugop95
Copy link
Contributor

@hugop95 hugop95 commented Nov 24, 2025

  • Pre-work for refactor: improve sorting override framework

Description

This PR is just some various renaming and chore commits to prepare for #617.

What is the purpose of this pull request?

  • Other

@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added improved string formatting utilities for enhanced comparison logic.
  • Bug Fixes

    • Refined default configuration handling for sort-imports rule with updated default values.
    • Improved side-effects validation logic in sort-imports.
  • Documentation

    • Clarified sort-imports rule behavior regarding tsconfig resolution and line-length sorting defaults.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Refactors per-group options computation across many sorting rules by introducing an options-by-group-index computer, centralizes string formatting, tightens import-sorting option types/defaults, and adds side-effect group helpers and tests.

Changes

Cohort / File(s) Change Summary
Docs
docs/content/rules/sort-imports.mdx
Changed defaults: maxLineLengthInfinity, tsconfig{ rootDir: '' }, and clarified tsconfig rootDir behavior.
Per-group options refactor (many rules)
rules/*.ts (e.g. rules/sort-array-includes.ts, rules/sort-classes.ts, rules/sort-decorators.ts, rules/sort-export-attributes.ts, rules/sort-exports.ts, rules/sort-heritage-clauses.ts, rules/sort-import-attributes.ts, rules/sort-jsx-props.ts, rules/sort-maps.ts, rules/sort-modules.ts, rules/sort-named-exports.ts, rules/sort-named-imports.ts, rules/sort-objects.ts, rules/sort-union-types.ts, rules/sort-variable-declarations.ts)
Replaced buildGetCustomGroupOverriddenOptionsFunction/getOptionsByGroupIndex with buildDefaultOptionsByGroupIndexComputer and renamed sortNodesByGroups parameter getOptionsByGroupIndexoptionsByGroupIndexComputer; switched validation call to validateGroupsConfiguration.
sort-imports rule
rules/sort-imports.ts, rules/sort-imports/*
Added getNodeName, tightened defaultOptions (tsconfig.rootDir required, maxLineLength: Infinity), changed tsconfig access, removed old custom-override import, introduced optionsByGroupIndexComputer, and simplified multis-line logic.
Side-effect helpers & tests
rules/sort-imports/is-side-effect-only-group.ts, rules/sort-imports/is-string-group-side-effect-only-group.ts, test/rules/sort-imports/is-side-effect-only-group.test.ts, test/rules/sort-imports/is-string-group-side-effect-only-group.test.ts
Extracted isStringGroupSideEffectOnlyGroup, allowed undefined input for isSideEffectOnlyGroup (returns false), and added tests for both helpers.
Sort-imports types & validation
rules/sort-imports/types.ts, rules/sort-imports/validate-side-effects-configuration.ts, test/rules/sort-imports/validate-side-effects-configuration.test.ts
Made tsconfig and maxLineLength required shapes, refactored side-effect validation to use computeGroupsNames + isStringGroupSideEffectOnlyGroup, and parameterized tests.
Enums types extraction
rules/sort-enums.ts, rules/sort-enums/types.ts
Moved SortEnumsSortingNode and Options into rules/sort-enums/types.ts and updated imports; switched to new per-group options computer.
Object-types and helpers
rules/sort-object-types.ts, rules/sort-object-types/build-node-value-getter.ts
Updated isNodeIgnoredForGroup shape, added UnreachableCaseError usage, and changed compare import path.
Sort nodes grouping API
utils/sort-nodes-by-groups.ts, utils/sort-nodes.ts
Removed BaseSortNodesByGroupsOptions; added OptionsByGroupIndexComputer type; changed API to accept optionsByGroupIndexComputer and object-shaped isNodeIgnoredForGroup.
Default per-group options builder
utils/build-default-options-by-group-index-computer.ts
Renamed function to buildDefaultOptionsByGroupIndexComputer, retyped to use CommonOptions, adjusted fallback-order logic and return shape.
String formatting & compare centralization
utils/compare/build-string-formatter.ts, utils/compare/compare.ts, related compare modules
Added buildStringFormatter and centralized string formatting; simplified compare parameters to use CommonOptions and removed inline formatter factory.
Misc refactors & tests
assorted rules/*, utils/*, test/*
Updated import paths, swapped validate-generated-groups-configuration → validate-groups-configuration across code/tests, adapted tests to new types (CommonOptions, OptionsByGroupIndexComputer), and added tests for string formatter and compare behavior.

Sequence Diagram(s)

sequenceDiagram
    participant Rule as ESLint Rule
    participant Builder as buildDefaultOptionsByGroupIndexComputer
    participant Grouper as sortNodesByGroups
    participant Filter as isNodeIgnoredForGroup
    participant Sort as sortNodes

    Rule->>Builder: initialize with global options
    Builder-->>Grouper: returns (groupIndex) -> { options, nodeValueGetter, fallbackSortNodeValueGetter }

    loop for each groupIndex
      Grouper->>Builder: call(groupIndex)
      Builder-->>Grouper: group-specific options & getters
      Grouper->>Filter: call({ node, groupOptions, groupIndex })
      Filter-->>Grouper: boolean (ignore?)
      Grouper->>Sort: sort subset with group options & getters
      Sort-->>Grouper: sorted subset
    end

    Grouper-->>Rule: merged sorted result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

  • Priority review focus:
    • rules/sort-imports.ts — defaultOptions, getNodeName, tsconfig handling, and computeGroupExceptUnknown changes.
    • utils/sort-nodes-by-groups.ts — API/type changes and per-group flow.
    • utils/compare/compare.ts & utils/compare/build-string-formatter.ts — central formatting behavior and options simplification.
    • utils/build-default-options-by-group-index-computer.ts — correctness of per-group option computation and fallback-order merging.
    • Cross-rule consistency — ensure all rule call sites and tests adopt optionsByGroupIndexComputer and the new isNodeIgnoredForGroup shape.

Possibly related PRs

Suggested reviewers

  • azat-io

Pre-merge checks

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks required detail from the template. It is missing a proper 'Description' section explaining what the PR solves, provides minimal context, and does not adequately address the 'what' of the changes despite having a large, impactful changeset. Add a comprehensive description section explaining the specific renaming changes, why they improve the sorting override framework, and any breaking changes. Include what problem this addresses and how it prepares for PR #617.
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'refactor: various renaming/chore' is vague and does not clearly convey the main changes. Terms like 'various' and 'chore' are generic and non-descriptive, making it unclear what specific work was performed. Replace vague terms with specific details about the main refactoring work, such as 'refactor: rename sorting options computer and validation functions' or reference the primary objective more concretely.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (dda2e6e) to head (fe9b971).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next      #620   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          111       113    +2     
  Lines         9098      9101    +3     
  Branches      1747      1743    -4     
=========================================
+ Hits          9098      9101    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hugop95 hugop95 changed the title refactor: improve sorting override framework refactor: various renaming/chore Nov 24, 2025
@hugop95 hugop95 marked this pull request as ready for review November 24, 2025 21:11
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
utils/build-default-options-by-group-index-computer.ts (1)

77-105: Custom group fallbackSort.order fallback logic is currently broken

In getCustomGroupsCompareOptions, the customGroup branch does:

fallbackSort = {
  type: customGroup.fallbackSort?.type ?? fallbackSort.type,
}
let fallbackOrder = customGroup.fallbackSort?.order ?? fallbackSort.order
if (fallbackOrder) {
  fallbackSort.order = fallbackOrder
}

Because fallbackSort is reassigned before computing fallbackOrder, fallbackSort.order in the ?? expression refers to the new object, not the original global fallback sort. As a result, when the custom group does not specify fallbackSort.order, you lose the original options.fallbackSort.order instead of inheriting it.

You can fix this by computing the new type and order before reassigning fallbackSort:

   if (customGroup) {
-    fallbackSort = {
-      type: customGroup.fallbackSort?.type ?? fallbackSort.type,
-    }
-    let fallbackOrder = customGroup.fallbackSort?.order ?? fallbackSort.order
-    if (fallbackOrder) {
-      fallbackSort.order = fallbackOrder
-    }
+    let nextFallbackType =
+      customGroup.fallbackSort?.type ?? fallbackSort.type
+    let fallbackOrder =
+      customGroup.fallbackSort?.order ?? fallbackSort.order
+
+    fallbackSort = { type: nextFallbackType }
+    if (fallbackOrder) {
+      fallbackSort.order = fallbackOrder
+    }
     order = customGroup.order ?? order
     type = customGroup.type ?? type
   }

This preserves the previous fallback order when the custom group does not override it, while still honoring any explicit fallbackSort.order on the custom group.

🧹 Nitpick comments (6)
rules/sort-object-types.ts (1)

48-48: Per-group options computer and ignore logic look correct; consider a small guard tweak.

  • Using optionsByGroupIndexComputer to merge the base options with getCustomGroupsCompareOptions output (including nodeValueGetter and fallbackSortNodeValueGetter) brings this rule in line with the shared group-sorting framework.
  • isNodeIgnoredForGroup now cleanly separates behavior by groupOptions.sortBy and the UnreachableCaseError default provides an exhaustive guard for future sortBy variants.

If you ever allow empty-string values, you might want to tighten the 'value' branch to check node.value === null instead of general falsiness, but with the current value population that’s only a theoretical edge.

Also applies to: 310-346

rules/sort-maps.ts (1)

22-23: Usage of buildDefaultOptionsByGroupIndexComputer with sortNodesByGroups looks correct

The new wiring to optionsByGroupIndexComputer: buildDefaultOptionsByGroupIndexComputer(options) matches the updated API and keeps all per‑group overrides centralized. Given options is already the fully completed rule config, this should preserve existing behavior.

If you want to micro‑optimize, you could compute the optionsByGroupIndexComputer once per options rather than recreating it inside each createSortNodesExcludingEslintDisabled invocation, but that’s purely optional.

Also applies to: 173-179

rules/sort-imports/is-side-effect-only-group.ts (1)

3-4: Safe handling of undefined group plus helper reuse looks good

The change to accept GroupsOptions<string>[0] | undefined and early‑return false prevents crashes when options.groups[groupIndex] is out of bounds and nicely reuses the shared isStringGroupSideEffectOnlyGroup helper.

As a tiny refinement, you might prefer an explicit check like if (group === undefined) instead of if (!group) to avoid ever treating an empty string group name as “no group”, should that configuration ever appear.

Also applies to: 17-21

rules/sort-imports.ts (1)

312-320: Side‑effect group ignoring and per‑group options wiring are consistent with the new API

  • isNodeIgnoredForGroup now delegates to isSideEffectOnlyGroup(options.groups[groupIndex]) when sortSideEffects is false, and always returns false when sortSideEffects is true. That cleanly centralizes the “skip pure side‑effect groups” behavior and meshes with the updated isSideEffectOnlyGroup signature that accepts undefined.
  • optionsByGroupIndexComputer: buildDefaultOptionsByGroupIndexComputer(options) matches the new sortNodesByGroups contract and ensures custom group overrides are applied per group without duplicating logic here.
  • The new getNodeName helper correctly handles:
    • ImportDeclaration via node.source.value.
    • TSImportEqualsDeclaration via either external module reference or printed qualified reference.
    • require() variable declarations based on the literal argument, relying on the VariableDeclaration visitor’s guard to make the cast safe.

If desired, you could reduce the as TSESTree.CallExpression/as TSESTree.Literal casts by narrowing on node.type plus a small runtime assertion, but that’s optional polish.

Also applies to: 511-536, 538-548

test/utils/sort-nodes-by-groups.test.ts (1)

3-22: OptionsByGroupIndexComputer wiring and CommonOptions usage look consistent

The switch to CommonOptions plus the shared optionsByGroupIndexComputer default (() => ({ options })) matches the new API surface from utils/sort-nodes-by-groups and keeps the tests straightforward. Type-wise this is sound: all call sites that just need default options can rely on this single function, and tests that need overrides redefine it locally as needed.

Minor nit: since options is already explicitly typed as CommonOptions, the as const on the initializer is redundant and could be dropped for slightly clearer intent, but it’s not functionally problematic.

utils/sort-nodes-by-groups.ts (1)

130-158: Consider avoiding toSorted for broader runtime compatibility

The change to:

for (let groupIndexString of Object.keys(nodesByNonIgnoredGroupIndex).toSorted(
  (a, b) => Number(a) - Number(b),
)) {
  let groupIndex = Number(groupIndexString)
  let { fallbackSortNodeValueGetter, nodeValueGetter, options } =
    optionsByGroupIndexComputer(groupIndex)
  // ...
}

is behaviorally fine (explicitly sorts group indices numerically), but Array.prototype.toSorted is still relatively new and not available in older Node versions without polyfills/transpilation to .sort.

If this plugin is expected to run in environments that may not yet support toSorted, consider a more widely compatible pattern:

for (let groupIndexString of Object.keys(nodesByNonIgnoredGroupIndex).sort(
  (a, b) => Number(a) - Number(b),
)) {
  // same body
}

This preserves the intended ordering without depending on newer built-ins.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dda2e6e and dfc6650.

📒 Files selected for processing (39)
  • docs/content/rules/sort-imports.mdx (2 hunks)
  • rules/sort-array-includes.ts (2 hunks)
  • rules/sort-classes.ts (2 hunks)
  • rules/sort-decorators.ts (2 hunks)
  • rules/sort-enums.ts (3 hunks)
  • rules/sort-enums/types.ts (2 hunks)
  • rules/sort-export-attributes.ts (2 hunks)
  • rules/sort-exports.ts (2 hunks)
  • rules/sort-heritage-clauses.ts (2 hunks)
  • rules/sort-import-attributes.ts (2 hunks)
  • rules/sort-imports.ts (7 hunks)
  • rules/sort-imports/is-side-effect-only-group.ts (2 hunks)
  • rules/sort-imports/is-string-group-side-effect-only-group.ts (1 hunks)
  • rules/sort-imports/types.ts (2 hunks)
  • rules/sort-imports/validate-side-effects-configuration.ts (2 hunks)
  • rules/sort-jsx-props.ts (2 hunks)
  • rules/sort-maps.ts (2 hunks)
  • rules/sort-modules.ts (2 hunks)
  • rules/sort-named-exports.ts (2 hunks)
  • rules/sort-named-imports.ts (2 hunks)
  • rules/sort-object-types.ts (3 hunks)
  • rules/sort-object-types/build-node-value-getter.ts (1 hunks)
  • rules/sort-object-types/get-custom-groups-compare-options.ts (1 hunks)
  • rules/sort-objects.ts (2 hunks)
  • rules/sort-switch-case.ts (1 hunks)
  • rules/sort-union-types.ts (2 hunks)
  • rules/sort-variable-declarations.ts (3 hunks)
  • test/rules/sort-imports/is-side-effect-only-group.test.ts (1 hunks)
  • test/rules/sort-imports/is-string-group-side-effect-only-group.test.ts (1 hunks)
  • test/rules/sort-imports/validate-side-effects-configuration.test.ts (1 hunks)
  • test/utils/compare/build-string-formatter.test.ts (1 hunks)
  • test/utils/compare/compare.test.ts (1 hunks)
  • test/utils/get-custom-groups-compare-options.test.ts (1 hunks)
  • test/utils/sort-nodes-by-groups.test.ts (9 hunks)
  • utils/build-default-options-by-group-index-computer.ts (2 hunks)
  • utils/compare/build-string-formatter.ts (1 hunks)
  • utils/compare/compare.ts (6 hunks)
  • utils/sort-nodes-by-groups.ts (5 hunks)
  • utils/sort-nodes.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (30)
test/rules/sort-imports/is-side-effect-only-group.test.ts (1)
rules/sort-imports/is-side-effect-only-group.ts (1)
  • isSideEffectOnlyGroup (16-29)
test/utils/compare/build-string-formatter.test.ts (1)
utils/compare/build-string-formatter.ts (1)
  • buildStringFormatter (26-59)
test/rules/sort-imports/validate-side-effects-configuration.test.ts (1)
rules/sort-imports/validate-side-effects-configuration.ts (1)
  • validateSideEffectsConfiguration (21-46)
utils/compare/build-string-formatter.ts (2)
types/common-options.ts (1)
  • SpecialCharactersOption (227-244)
utils/unreachable-case-error.ts (1)
  • UnreachableCaseError (31-43)
rules/sort-modules.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-array-includes.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-objects.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-union-types.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-imports/is-side-effect-only-group.ts (1)
types/common-options.ts (1)
  • GroupsOptions (436-441)
rules/sort-named-exports.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-decorators.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-import-attributes.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
utils/build-default-options-by-group-index-computer.ts (1)
types/common-options.ts (1)
  • CommonOptions (23-73)
utils/compare/compare.ts (2)
types/common-options.ts (1)
  • CommonOptions (23-73)
utils/compare/build-string-formatter.ts (1)
  • buildStringFormatter (26-59)
rules/sort-exports.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-export-attributes.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
test/rules/sort-imports/is-string-group-side-effect-only-group.test.ts (1)
rules/sort-imports/is-string-group-side-effect-only-group.ts (1)
  • isStringGroupSideEffectOnlyGroup (1-3)
rules/sort-object-types.ts (1)
utils/unreachable-case-error.ts (1)
  • UnreachableCaseError (31-43)
rules/sort-classes.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-imports/validate-side-effects-configuration.ts (3)
utils/compute-groups-names.ts (1)
  • computeGroupsNames (13-15)
rules/sort-imports/is-side-effect-only-group.ts (1)
  • isSideEffectOnlyGroup (16-29)
rules/sort-imports/is-string-group-side-effect-only-group.ts (1)
  • isStringGroupSideEffectOnlyGroup (1-3)
utils/sort-nodes.ts (1)
types/common-options.ts (1)
  • CommonOptions (23-73)
rules/sort-maps.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-enums/types.ts (1)
utils/sort-nodes-by-dependencies.ts (1)
  • SortingNodeWithDependencies (16-21)
test/utils/sort-nodes-by-groups.test.ts (3)
types/common-options.ts (1)
  • CommonOptions (23-73)
utils/sort-nodes-by-groups.ts (1)
  • OptionsByGroupIndexComputer (8-15)
types/sorting-node.ts (1)
  • SortingNode (18-102)
rules/sort-named-imports.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-heritage-clauses.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-imports.ts (4)
rules/sort-imports/types.ts (1)
  • Options (22-69)
rules/sort-imports/read-closest-ts-config-by-path.ts (1)
  • readClosestTsConfigByPath (58-99)
rules/sort-imports/is-side-effect-only-group.ts (1)
  • isSideEffectOnlyGroup (16-29)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
utils/sort-nodes-by-groups.ts (3)
types/common-options.ts (1)
  • CommonOptions (23-73)
types/sorting-node.ts (1)
  • SortingNode (18-102)
utils/compare/compare.ts (1)
  • NodeValueGetterFunction (17-17)
rules/sort-variable-declarations.ts (3)
utils/validate-generated-groups-configuration.ts (1)
  • validateGeneratedGroupsConfiguration (75-93)
rules/sort-variable-declarations/types.ts (1)
  • allSelectors (80-80)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
rules/sort-jsx-props.ts (1)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (130-141)
🔇 Additional comments (49)
rules/sort-switch-case.ts (1)

15-15: Import path refactor for compare is consistent with the new utility layout.

Switching to ../utils/compare/compare removes reliance on a barrel and keeps behavior identical at call sites.

test/utils/get-custom-groups-compare-options.test.ts (1)

5-5: Test import updated to the new options utility module.

Pointing getCustomGroupsCompareOptions at ../../utils/build-default-options-by-group-index-computer keeps the tests aligned with the refactored options-computation utility without changing test behavior.

rules/sort-imports/types.ts (1)

28-38: Stricter tsconfig and maxLineLength typings match the intended defaults.

Making tsconfig.rootDir and maxLineLength required at the nested level (while keeping Options[number] wrapped in Partial) ensures that:

  • configs that provide tsconfig must specify a rootDir, and
  • internal consumers using Required<Options[number]> can rely on both tsconfig.rootDir and maxLineLength being defined.

This aligns with the idea of having concrete defaults; just confirm that the sort-imports JSON schema and docs reflect rootDir and maxLineLength as effectively required when set.

Also applies to: 61-65

rules/sort-object-types/get-custom-groups-compare-options.ts (1)

1-1: Updated imports to new compare/options utilities without changing behavior.

Referencing NodeValueGetterFunction from compare/compare and delegating to the new build-default-options-by-group-index-computer helper keeps this wrapper consistent with the rest of the codebase while preserving its contract.

Also applies to: 4-4

rules/sort-enums/types.ts (1)

2-2: Centralizing SortEnumsSortingNode in the types module improves consistency.

Exporting SortEnumsSortingNode here, based on SortingNodeWithDependencies<TSEnumMember> plus numericValue/value, mirrors how other rules expose their node types and removes the need for a local interface in sort-enums.ts.

Also applies to: 4-4, 52-56

test/utils/compare/compare.test.ts (1)

3-3: Compare tests now use explicit, non-barrel imports.

Switching to ../../../types/sorting-node, ../../../utils/compare/compare, and ../../../utils/alphabet removes reliance on index exports while keeping the covered behavior identical.

Also applies to: 5-6

rules/sort-object-types.ts (1)

76-91: Adding fallbackSort.sortBy default keeps value-getter logic well-defined.

Initializing fallbackSort as { type: 'unsorted', sortBy: 'name' } ensures that downstream helpers (like getCustomGroupsCompareOptions) can always rely on a concrete fallbackSort.sortBy, matching the rule’s top-level sortBy: 'name' default.

rules/sort-export-attributes.ts (2)

24-24: LGTM! Import updated consistently with API refactor.

The import change from buildGetCustomGroupOverriddenOptionsFunction to buildDefaultOptionsByGroupIndexComputer aligns with the broader refactoring across multiple sort rules.


139-140: LGTM! Parameter naming improved for clarity.

The rename from getOptionsByGroupIndex to optionsByGroupIndexComputer better conveys that this is a computer function rather than just a getter, and the usage of buildDefaultOptionsByGroupIndexComputer(options) is consistent with the new API.

test/rules/sort-imports/validate-side-effects-configuration.test.ts (2)

6-16: LGTM! Test parameterization improves coverage.

The refactoring to use it.each tests both array-based and object-based group configurations systematically, improving maintainability while reducing duplication.


18-39: LGTM! Parameterization enhances test clarity.

The parameterized approach now clearly tests both flat array groups and object-wrapped groups for the side-effect validation error case, making the test intent more explicit.

rules/sort-imports/validate-side-effects-configuration.ts (3)

4-6: LGTM! New imports support refactored validation logic.

The imports of isStringGroupSideEffectOnlyGroup and computeGroupsNames enable cleaner separation of concerns for side-effect group validation.


35-40: LGTM! Validation logic refactored for clarity.

The change from inline filtering to mapping with computeGroupsNames followed by checking with hasSideEffectGroup makes the validation logic more readable and maintainable.


48-50: LGTM! Helper function improves code clarity.

The hasSideEffectGroup helper encapsulates the check for whether any group in a nested structure is a side-effect group, making the validation logic easier to understand.

utils/sort-nodes.ts (2)

1-1: LGTM! Import paths updated consistently.

The import paths for NodeValueGetterFunction and compare have been updated to reflect the new organization under ./compare/compare.

Also applies to: 5-5


17-17: No issues found with the maxLineLength removal.

Verification confirms that maxLineLength is never passed to sortNodes by any caller in the codebase. The parameter only exists in the sort-imports rule context (where it's part of that rule's specific options type). All three call sites—in rules/sort-switch-case.ts, utils/sort-nodes-by-groups.ts, and test files—only pass fields that are part of CommonOptions, making the type simplification a safe change with no breaking impact.

rules/sort-jsx-props.ts (3)

25-25: LGTM! Import updated for new options computer.

The import change to buildDefaultOptionsByGroupIndexComputer is consistent with the API refactoring across all sort rules.


27-31: LGTM! Additional imports organized properly.

The explicit imports of singleCustomGroupJsonSchema, allModifiers, and allSelectors from the types file improve code organization and make dependencies clearer.


189-190: LGTM! Parameter naming aligns with refactoring.

The change from getOptionsByGroupIndex to optionsByGroupIndexComputer with the new builder function is consistent with the broader API improvements.

rules/sort-named-imports.ts (2)

23-23: LGTM! Import consistent with API refactor.

The import of buildDefaultOptionsByGroupIndexComputer aligns with the standardized per-group options computation across sort rules.


175-176: LGTM! Options computation updated correctly.

The parameter rename to optionsByGroupIndexComputer and use of buildDefaultOptionsByGroupIndexComputer(options) follows the established refactoring pattern.

rules/sort-array-includes.ts (2)

25-25: LGTM! Import updated for consistency.

The import change to buildDefaultOptionsByGroupIndexComputer maintains consistency with the refactoring across all sort rules.


254-255: LGTM! Parameter usage follows new API.

The change to optionsByGroupIndexComputer with buildDefaultOptionsByGroupIndexComputer(options) is consistent with the standardized approach for per-group option computation.

rules/sort-import-attributes.ts (2)

24-24: LGTM! Final import change completes refactoring.

The import of buildDefaultOptionsByGroupIndexComputer completes the consistent API refactoring across all sort-related rules.


139-140: LGTM! Options computation standardized.

The parameter change to optionsByGroupIndexComputer with buildDefaultOptionsByGroupIndexComputer(options) completes the standardization of per-group option computation across the codebase.

rules/sort-exports.ts (1)

22-22: LGTM! Consistent refactoring to the new options computer API.

The rename from buildGetCustomGroupOverriddenOptionsFunction to buildDefaultOptionsByGroupIndexComputer improves clarity, and the option key change to optionsByGroupIndexComputer aligns with the new naming convention. The changes are applied consistently.

Also applies to: 165-166

test/rules/sort-imports/is-string-group-side-effect-only-group.test.ts (1)

1-16: LGTM! Good test coverage for the new utility.

The test suite properly covers both positive cases (the two side-effect group names) and the negative case using parameterized testing. This provides adequate coverage for the simple utility function.

test/rules/sort-imports/is-side-effect-only-group.test.ts (1)

6-8: LGTM! Good defensive test coverage.

Adding test coverage for undefined input ensures the function handles this edge case gracefully, which aligns with the updated function signature that accepts undefined.

rules/sort-object-types/build-node-value-getter.ts (1)

1-1: LGTM! Import path updated to reflect module reorganization.

The import path change aligns with the restructuring of comparison utilities under utils/compare/compare. No functional changes.

rules/sort-imports/is-string-group-side-effect-only-group.ts (1)

1-3: LGTM! Clean utility extraction.

The function is simple, correct, and enables reuse of the side-effect group detection logic. The implementation properly checks for both 'side-effect' and 'side-effect-style' group names.

rules/sort-named-exports.ts (1)

23-23: LGTM! Consistent with the broader refactoring pattern.

The changes mirror those in sort-exports.ts, adopting the new buildDefaultOptionsByGroupIndexComputer API and optionsByGroupIndexComputer option key. The refactoring is applied consistently across rules.

Also applies to: 178-179

utils/compare/build-string-formatter.ts (1)

1-59: LGTM! Well-designed string formatting utility.

The function properly centralizes string formatting logic for comparison operations. Key points:

  • Handles case normalization, special character processing, and whitespace removal
  • Uses appropriate Unicode ranges for Latin-based alphabets with diacritics
  • Includes exhaustive case handling with UnreachableCaseError
  • Well-documented with JSDoc comments

The regex patterns correctly use the u flag for full Unicode support and handle extended Latin character ranges.

docs/content/rules/sort-imports.mdx (1)

265-265: Documentation defaults verified as correct.

Verification confirms all three documentation defaults match the sort-imports rule implementation:

  • maxLineLength: Infinity
  • tsconfig: { rootDir: '' }
  • Empty rootDir configuration present ✓
rules/sort-variable-declarations.ts (2)

22-27: LGTM! Clean refactoring with appropriate validation.

The import updates and addition of validateGeneratedGroupsConfiguration are well-placed. The validation ensures generated groups configuration is correct before processing, which improves error handling.

Also applies to: 89-93


179-180: LGTM! Consistent API refactoring.

The parameter rename from getOptionsByGroupIndex to optionsByGroupIndexComputer is more descriptive and aligns with the function name, improving code clarity.

test/utils/compare/build-string-formatter.test.ts (1)

1-49: LGTM! Comprehensive test coverage.

The test file thoroughly covers the buildStringFormatter functionality:

  • Case-insensitive transformation
  • Whitespace removal
  • Special characters handling (remove, keep, trim)

The test cases are well-structured and validate the expected behavior across different configuration options.

rules/sort-modules.ts (1)

29-29: LGTM! Consistent with the refactoring pattern.

The import and parameter updates align with the systematic refactoring across all sorting rules.

Also applies to: 350-351

rules/sort-union-types.ts (1)

23-23: LGTM! Refactoring applied consistently.

The changes mirror the pattern established in other sorting rule files.

Also applies to: 280-281

rules/sort-objects.ts (1)

28-28: LGTM! Consistent refactoring.

The changes follow the established pattern across the codebase.

Also applies to: 356-357

rules/sort-classes.ts (1)

27-27: LGTM! Refactoring pattern maintained.

The changes are consistent with the systematic refactoring across all sorting rules.

Also applies to: 605-606

rules/sort-decorators.ts (1)

24-24: LGTM! Consistent with refactoring objectives.

The changes align with the systematic refactoring pattern applied throughout the PR.

Also applies to: 265-266

rules/sort-heritage-clauses.ts (1)

22-22: LGTM! Final file completes the consistent refactoring.

The changes complete the systematic refactoring across all affected sorting rule files, maintaining consistency throughout.

Also applies to: 189-190

rules/sort-imports.ts (2)

30-37: Defaults for tsconfig and maxLineLength align with the new typing and schema

Switching defaultOptions to Required<Options[number]> with tsconfig: { rootDir: '' } and maxLineLength: Infinity gives you non‑optional access to options.tsconfig.rootDir / options.tsconfig.filename and options.maxLineLength, while preserving previous behavior:

  • An empty rootDir means the tsconfig search is completely skipped.
  • Infinity means the “use name length for very long imports” path is effectively disabled unless a finite maxLineLength is configured.

This looks consistent with the JSON schema (tsconfig object is only required to have rootDir when the user specifies it) and with how readClosestTsConfigByPath is guarded.

Also applies to: 77-105, 124-133


241-243: maxLineLength threshold logic matches the documented “exceeded” semantics

The new condition:

if (hasMultipleImportDeclarations && size > options.maxLineLength) {
  size = name.length + 10
}

correctly triggers only when the actual node span exceeds maxLineLength, which matches the documentation wording (“When exceeded, import names are used for sorting…”). With the default of Infinity, this remains a no‑op unless the user opts in.

utils/build-default-options-by-group-index-computer.ts (1)

123-141: buildDefaultOptionsByGroupIndexComputer cleanly encapsulates per‑group overrides

The new buildDefaultOptionsByGroupIndexComputer and updated getCustomGroupOverriddenOptions signatures look consistent with the rest of the refactor:

  • Accepting GroupRelatedOptions & CommonOptions matches how rule‑level options are shaped.
  • Returning { options: CommonOptions } aligns with the new optionsByGroupIndexComputer contract in sortNodesByGroups, while still passing through all other options properties at runtime via getCustomGroupOverriddenOptions.

This gives rules a simple, reusable way to plug in group‑specific options without duplicating override logic.

Also applies to: 156-167

rules/sort-enums.ts (1)

3-5: Enums refactor integrates cleanly with the new per‑group options API

The changes here look cohesive:

  • Importing NodeValueGetterFunction, SortEnumsSortingNode, and Options clarifies the public type surface and tightens the typing of computeNodeValueGetter.

  • Wiring sortNodesByGroups through

    optionsByGroupIndexComputer: groupIndex => ({
      options: getCustomGroupOverriddenOptions({
        options: overriddenOptions,
        groupIndex,
      }),
      nodeValueGetter,
    })

    ensures each group sees the numeric‑enum‑aware type while still honoring any group/custom‑group overrides.

This keeps the rule aligned with the new optionsByGroupIndexComputer abstraction without changing its observable behavior.

Also applies to: 23-24, 217-223

test/utils/sort-nodes-by-groups.test.ts (1)

90-107: Per-group callbacks (isNodeIgnoredForGroup, nodeValueGetter, fallbackSortNodeValueGetter) are well covered

The tests exercising:

  • isNodeIgnoredForGroup: ({ node }) => node === nodeB
  • Per-call optionsByGroupIndexComputer that inject nodeValueGetter / fallbackSortNodeValueGetter alongside options

correctly reflect the new object-based callback signature and the per-group options computer pattern. The use of createTestNode to extend SortingNode with actualValue keeps the value-getter tests type-safe and realistic.

No issues from a behavior or typing standpoint here.

Also applies to: 110-157

utils/sort-nodes-by-groups.ts (1)

8-37: New per-group options computer and parameter typing are coherent

The introduction of:

  • OptionsByGroupIndexComputer<Options extends CommonOptions, T extends SortingNode>
  • optionsByGroupIndexComputer in SortNodesByGroupsParameters
  • The object-arg isNodeIgnoredForGroup({ groupOptions, groupIndex, node })

lines up cleanly with how sortNodesByGroups and the tests use these callbacks. The generics (Options extends CommonOptions, T extends SortingNode) keep the core utility flexible while ensuring the options object always matches the rest of the compare/sort pipeline.

From this file’s perspective, the public surface and internal plumbing look sound.

utils/compare/compare.ts (1)

3-8: CommonOptions-only compare pipeline and shared formatter integration look solid

The refactor to:

  • Use CommonOptions directly in CompareParameters and computeCompareValue
  • Export NodeValueGetterFunction for reuse
  • Centralize string normalization in buildStringFormatter for custom, natural, and alphabetical sorting

keeps the compare utility aligned with the new options model and removes the ad‑hoc formatter logic from this file. The same specialCharacters/ignoreCase handling now consistently applies across the different sorting strategies, which is a nice simplification with no obvious behavioral regressions given the shared formatter implementation.

Also applies to: 37-39, 164-167, 229-230, 288-291, 322-325

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
utils/build-default-options-by-group-index-computer.ts (1)

119-132: JSDoc example should reflect { options } wrapper return shape

The example assigns const group1Options = getOverriddenOptions(0), but the function actually returns { options: CommonOptions }. To avoid confusion, consider updating the example to destructure:

- *   const getOverriddenOptions =
- *     buildDefaultOptionsByGroupIndexComputer(options)
- *   const group1Options = getOverriddenOptions(0)
- *   const group2Options = getOverriddenOptions(1)
+ *   const getOverriddenOptions =
+ *     buildDefaultOptionsByGroupIndexComputer(options)
+ *   const group1Options = getOverriddenOptions(0).options
+ *   const group2Options = getOverriddenOptions(1).options

so docs match the actual API.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfc6650 and bada62e.

📒 Files selected for processing (2)
  • test/utils/get-custom-groups-compare-options.test.ts (2 hunks)
  • utils/build-default-options-by-group-index-computer.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/utils/get-custom-groups-compare-options.test.ts
🧰 Additional context used
🧬 Code graph analysis (1)
utils/build-default-options-by-group-index-computer.ts (1)
types/common-options.ts (1)
  • CommonOptions (23-73)
🔇 Additional comments (2)
utils/build-default-options-by-group-index-computer.ts (2)

94-102: Fallback sort override refactor keeps semantics and avoids undefined order

The fallbackOrder temp plus conditional spread cleanly preserves the base fallbackSort.order when no custom override is provided and avoids emitting order: undefined. The behavior for all combinations of global/custom fallbackSort looks correct.


154-165: Options merge helper is correctly typed and ordered

Typing options as GroupRelatedOptions & CommonOptions and returning { ...options, ...getCustomGroupsCompareOptions(...) } cleanly preserves all common options while allowing per-group overrides of fallbackSort, order, and type. Merge order is correct and non-mutating; no issues spotted.

let settings = getSettings(context.settings)
let options = complete(context.options.at(0), settings, defaultOptions)
validateCustomSortConfiguration(options)
validateGeneratedGroupsConfiguration({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you decide to delete this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azat-io

Oops, that's an oversight. I forgot that this does more than check predefined/generated groups.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
utils/validate-groups-configuration.ts (1)

28-55: JSDoc examples reference the old function name.

The @example blocks still show validateGeneratedGroupsConfiguration but the function was renamed to validateGroupsConfiguration. Update these references for consistency.

 * @example
 *   // Valid predefined groups for React imports
-*   validateGeneratedGroupsConfiguration({
+*   validateGroupsConfiguration({
 *     options: {
 *       groups: ['react', 'external', 'internal', 'side-effect-import'],
 ...
 * @example
 *   // Invalid group that doesn't exist
-*   validateGeneratedGroupsConfiguration({
+*   validateGroupsConfiguration({
 *     options: {
 ...
 * @example
 *   // Valid with custom groups for class members
-*   validateGeneratedGroupsConfiguration({
+*   validateGroupsConfiguration({
 *     options: {
🧹 Nitpick comments (1)
utils/validate-groups-configuration.ts (1)

7-15: Consider renaming the interface for consistency.

The interface ValidateGenerateGroupsConfigurationParameters could be renamed to ValidateGroupsConfigurationParameters to match the renamed function. This is optional but would improve naming consistency.

-interface ValidateGenerateGroupsConfigurationParameters {
+interface ValidateGroupsConfigurationParameters {
   options: {
     customGroups: CustomGroupsOption
     groups: GroupsOptions<string>
   }
   selectors: string[]
   modifiers: string[]
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bada62e and fe9b971.

📒 Files selected for processing (20)
  • rules/sort-array-includes.ts (3 hunks)
  • rules/sort-classes.ts (3 hunks)
  • rules/sort-decorators.ts (3 hunks)
  • rules/sort-enums.ts (4 hunks)
  • rules/sort-export-attributes.ts (3 hunks)
  • rules/sort-exports.ts (3 hunks)
  • rules/sort-heritage-clauses.ts (3 hunks)
  • rules/sort-import-attributes.ts (3 hunks)
  • rules/sort-imports.ts (8 hunks)
  • rules/sort-jsx-props.ts (3 hunks)
  • rules/sort-maps.ts (3 hunks)
  • rules/sort-modules.ts (3 hunks)
  • rules/sort-named-exports.ts (3 hunks)
  • rules/sort-named-imports.ts (3 hunks)
  • rules/sort-object-types.ts (4 hunks)
  • rules/sort-objects.ts (4 hunks)
  • rules/sort-union-types.ts (3 hunks)
  • rules/sort-variable-declarations.ts (3 hunks)
  • test/utils/validate-groups-configuration.test.ts (7 hunks)
  • utils/validate-groups-configuration.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • rules/sort-classes.ts
  • rules/sort-variable-declarations.ts
  • rules/sort-union-types.ts
  • rules/sort-decorators.ts
  • rules/sort-array-includes.ts
  • rules/sort-export-attributes.ts
  • rules/sort-import-attributes.ts
  • rules/sort-exports.ts
🧰 Additional context used
🧬 Code graph analysis (10)
test/utils/validate-groups-configuration.test.ts (1)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
rules/sort-heritage-clauses.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
rules/sort-object-types.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/unreachable-case-error.ts (1)
  • UnreachableCaseError (31-43)
rules/sort-modules.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
rules/sort-named-imports.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
rules/sort-maps.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
rules/sort-jsx-props.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
rules/sort-enums.ts (1)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
rules/sort-named-exports.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
rules/sort-objects.ts (2)
utils/validate-groups-configuration.ts (1)
  • validateGroupsConfiguration (75-93)
utils/build-default-options-by-group-index-computer.ts (1)
  • buildDefaultOptionsByGroupIndexComputer (128-139)
🔇 Additional comments (24)
rules/sort-jsx-props.ts (3)

25-33: LGTM! Import updates align with the refactoring pattern.

The new imports for buildDefaultOptionsByGroupIndexComputer, validateGroupsConfiguration, and the type exports from ./sort-jsx-props/types are consistent with the broader refactoring effort across the codebase.


96-100: Validation call correctly updated.

The validateGroupsConfiguration invocation properly passes allSelectors, allModifiers, and options in the expected structure.


189-190: Correct usage of the new options-by-group-index computer.

The optionsByGroupIndexComputer key and buildDefaultOptionsByGroupIndexComputer(options) call match the expected API signature from utils/build-default-options-by-group-index-computer.ts.

utils/validate-groups-configuration.ts (1)

75-93: Core function rename looks correct.

The function signature and implementation are unchanged except for the name. The validation logic correctly validates groups against predefined groups and custom groups.

rules/sort-object-types.ts (3)

42-48: Import additions are appropriate.

The new imports for validateGroupsConfiguration and UnreachableCaseError support the updated validation and exhaustive switch pattern.


200-204: Validation call correctly updated.

The validateGroupsConfiguration invocation uses the proper structure with allSelectors, allModifiers, and options.


315-340: Well-structured options computer and node ignore logic.

The optionsByGroupIndexComputer implementation correctly delegates to getCustomGroupsCompareOptions and returns the expected structure. The isNodeIgnoredForGroup function uses an exhaustive switch with UnreachableCaseError as a guard, which is a good defensive pattern for handling the sortBy discriminant.

rules/sort-heritage-clauses.ts (3)

22-24: Import updates align with the refactoring pattern.

The new imports for buildDefaultOptionsByGroupIndexComputer and validateGroupsConfiguration are consistent with other rules.


105-109: Validation call correctly passes empty arrays.

Heritage clauses don't use modifiers or selectors, so passing empty arrays is appropriate here.


189-190: Correct usage of the new options-by-group-index computer.

The optionsByGroupIndexComputer key and buildDefaultOptionsByGroupIndexComputer(options) call match the expected API.

rules/sort-named-exports.ts (3)

23-30: Import updates are consistent with the refactoring pattern.

The new imports for buildDefaultOptionsByGroupIndexComputer and validateGroupsConfiguration follow the same pattern as other rule files.


85-89: Validation call correctly updated.

The validateGroupsConfiguration invocation properly passes allModifiers, allSelectors, and options in the expected structure.


178-179: Correct usage of the new options-by-group-index computer.

The optionsByGroupIndexComputer key and buildDefaultOptionsByGroupIndexComputer(options) call match the expected API signature.

test/utils/validate-groups-configuration.test.ts (1)

3-3: LGTM! Consistent function rename.

The import and all usage sites have been consistently updated from validateGeneratedGroupsConfiguration to validateGroupsConfiguration.

Also applies to: 6-6, 29-29, 42-42, 61-61, 75-75, 88-88, 110-110

rules/sort-objects.ts (1)

28-28: LGTM! Consistent refactoring to new options computer pattern.

The changes correctly update both the imports and usage to align with the new per-group options computation approach using buildDefaultOptionsByGroupIndexComputer.

Also applies to: 37-37, 111-115, 356-357

rules/sort-modules.ts (1)

29-29: LGTM! Consistent refactoring applied.

The imports and usage have been updated consistently to use the new validation function and options computer pattern.

Also applies to: 36-36, 138-142, 350-351

rules/sort-named-imports.ts (1)

23-23: LGTM! Consistent with the refactoring pattern.

All changes align with the standardized approach to per-group options computation and validation.

Also applies to: 30-30, 88-92, 175-176

rules/sort-imports.ts (4)

77-104: LGTM! Default options expanded appropriately.

The new default options for tsconfig and maxLineLength are sensible:

  • tsconfig: { rootDir: '' } provides a safe default (empty rootDir will skip tsconfig reading)
  • maxLineLength: Infinity means no line length limit by default

124-131: LGTM! Tsconfig access pattern updated correctly.

The changes properly access the nested tsconfig properties with appropriate fallbacks.


511-536: LGTM! Good extraction of name computation logic.

The new getNodeName helper function consolidates the logic for extracting module names from different import node types, improving code organization.


115-119: LGTM! Import sorting refactoring applied consistently.

The changes properly integrate the new validation and options computation patterns, along with the updated tsconfig handling and maxLineLength usage.

Also applies to: 241-243, 312-319

rules/sort-maps.ts (1)

22-22: LGTM! Consistent refactoring for map sorting.

The changes follow the same pattern as other rules, correctly using empty arrays for selectors and modifiers since maps don't have those concepts.

Also applies to: 25-25, 97-101, 180-181

rules/sort-enums.ts (2)

3-4: LGTM! Type organization improved and validation updated.

The type imports from a separate module improve code organization, and the validation function has been consistently updated.

Also applies to: 23-25, 86-90


223-229: LGTM! Custom options computer correctly handles enum-specific needs.

Unlike other rules, this uses an inline optionsByGroupIndexComputer implementation because enums need to pass both options and nodeValueGetter. The logic correctly overrides options per group while including the enum-specific value getter.

@azat-io azat-io merged commit 358217d into azat-io:next Nov 25, 2025
12 checks passed
@hugop95 hugop95 deleted the refactor/sorting-1 branch November 25, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants