Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow type: unsorted for all remaining rules #468

Merged
merged 27 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1275913
docs: add missing `fallbackSort` documentation
hugop95 Feb 11, 2025
ae69339
fix(sort-maps): add missing `unsorted` type handling
hugop95 Feb 11, 2025
58b912a
feat: prevent early return with `unsorted` type
hugop95 Feb 11, 2025
96494cf
test: move `unsorted` tests in their own `describe`
hugop95 Feb 11, 2025
f1163ca
test: add additional tests
hugop95 Feb 11, 2025
1062616
fix: allow `unsorted` type for all rules
hugop95 Feb 11, 2025
e10562b
feat(sort-objects): simplify code and update docs
hugop95 Feb 13, 2025
154f7f1
feat(sort-object-types): simplify code and update docs
hugop95 Feb 13, 2025
887097d
docs(sort-interfaces): update documentation
hugop95 Feb 13, 2025
ffef673
feat(sort-array-includes): simplify code and update docs
hugop95 Feb 13, 2025
b3c1ad5
docs(sort-sets): updates documentation
hugop95 Feb 13, 2025
338a549
feat(sort-maps): updates documentation
hugop95 Feb 13, 2025
61bd579
feat(sort-classes): allow `unsorted` type
hugop95 Feb 11, 2025
e832bb3
feat(sort-decorators): allow `unsorted` type
hugop95 Feb 11, 2025
6aac7aa
feat(sort-enums): allow `unsorted` type
hugop95 Feb 11, 2025
77dc8f0
feat(sort-exports): allow `unsorted` type
hugop95 Feb 11, 2025
c86a6e2
feat(sort-heritage-clauses): allow `unsorted` type
hugop95 Feb 11, 2025
833d364
feat(sort-imports): allow `unsorted` type
hugop95 Feb 13, 2025
8014ba1
feat(sort-jsx-props): allow `unsorted` type
hugop95 Feb 11, 2025
7030f8e
feat(sort-switch-case): allow `unsorted` type
hugop95 Feb 11, 2025
79043dd
feat(sort-modules): allow `unsorted` type
hugop95 Feb 11, 2025
817bf4f
feat(sort-union-types): allow `unsorted` type
hugop95 Feb 11, 2025
00e45a6
feat(sort-intersection-types): allow `unsorted` type
hugop95 Feb 11, 2025
a455608
feat(sort-variable-declarations): allow `unsorted` type
hugop95 Feb 11, 2025
ce7961a
feat(sort-named-exports): allow `unsorted` type
hugop95 Feb 11, 2025
73e2a73
feat(sort-named-imports): allow `unsorted` type
hugop95 Feb 11, 2025
9a74d2d
refactor: simplifies condition
hugop95 Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/content/rules/sort-array-includes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. To be used with the [`useConfigurationIf`](#useconfigurationif) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -429,6 +429,7 @@ Custom groups have a higher priority than any predefined group.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'literals-first',
Expand Down Expand Up @@ -459,6 +460,7 @@ Custom groups have a higher priority than any predefined group.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
groupKind: 'literals-first',
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-classes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -767,6 +768,7 @@ Example:
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down Expand Up @@ -820,6 +822,7 @@ Example:
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-decorators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) is still enforced.

### order

Expand Down Expand Up @@ -325,6 +326,7 @@ class MyClass {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
groups: [],
Expand Down Expand Up @@ -356,6 +358,7 @@ class MyClass {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
groups: [],
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-enums.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -340,6 +341,7 @@ Custom groups have a higher priority than any predefined group.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down Expand Up @@ -371,6 +373,7 @@ Custom groups have a higher priority than any predefined group.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items.

### order

Expand Down Expand Up @@ -216,6 +217,7 @@ Allows you to group exports by their kind, determining whether value exports sho
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down Expand Up @@ -243,6 +245,7 @@ Allows you to group exports by their kind, determining whether value exports sho
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-heritage-clauses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) is still enforced.

### order

Expand Down Expand Up @@ -221,6 +222,7 @@ interface Interface extends WithId, Logged, StartupService {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
groups: [],
Expand All @@ -247,6 +249,7 @@ interface Interface extends WithId, Logged, StartupService {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
groups: [],
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -450,6 +451,7 @@ Specifies which environment’s built-in modules should be recognized. If you ar
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
internalPattern: ['^~/.+'],
Expand Down Expand Up @@ -491,6 +493,7 @@ Specifies which environment’s built-in modules should be recognized. If you ar
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
internalPattern: ['^~/.+'],
Expand Down
4 changes: 3 additions & 1 deletion docs/content/rules/sort-interfaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. To be used with the [`useConfigurationIf`](#useconfigurationif) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -631,6 +631,7 @@ interface User {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
Expand Down Expand Up @@ -663,6 +664,7 @@ interface User {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-intersection-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -358,6 +359,7 @@ This feature is only applicable when `partitionByNewLine` is false.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down Expand Up @@ -386,6 +388,7 @@ This feature is only applicable when `partitionByNewLine` is false.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down
4 changes: 3 additions & 1 deletion docs/content/rules/sort-jsx-props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. To be used with the [`useConfigurationIf`](#useconfigurationif) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -394,6 +394,7 @@ Custom group matching takes precedence over predefined group matching.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
Expand Down Expand Up @@ -424,6 +425,7 @@ Custom group matching takes precedence over predefined group matching.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
Expand Down
4 changes: 3 additions & 1 deletion docs/content/rules/sort-maps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. To be used with the [`useConfigurationIf`](#useconfigurationif) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -370,6 +370,7 @@ Custom groups have a higher priority than any predefined group.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByNewLine: false,
Expand Down Expand Up @@ -400,6 +401,7 @@ Custom groups have a higher priority than any predefined group.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByNewLine: false,
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -559,6 +560,7 @@ This feature is only applicable when `partitionByNewLine` is false.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down Expand Up @@ -601,6 +603,7 @@ This feature is only applicable when `partitionByNewLine` is false.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-named-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items.

### order

Expand Down Expand Up @@ -253,6 +254,7 @@ Each group of members (separated by empty lines) is treated independently, and t
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreAlias: false,
ignoreCase: true,
specialCharacters: 'keep',
Expand Down Expand Up @@ -281,6 +283,7 @@ Each group of members (separated by empty lines) is treated independently, and t
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreAlias: false,
ignoreCase: true,
specialCharacters: 'keep',
Expand Down
3 changes: 3 additions & 0 deletions docs/content/rules/sort-named-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items.

### order

Expand Down Expand Up @@ -253,6 +254,7 @@ import {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreAlias: false,
ignoreCase: true,
specialCharacters: 'keep',
Expand Down Expand Up @@ -281,6 +283,7 @@ import {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreAlias: false,
ignoreCase: true,
specialCharacters: 'keep',
Expand Down
4 changes: 3 additions & 1 deletion docs/content/rules/sort-object-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. To be used with the [`useConfigurationIf`](#useconfigurationif) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -597,6 +597,7 @@ This feature is only applicable when `partitionByNewLine` is false.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
Expand Down Expand Up @@ -628,6 +629,7 @@ This feature is only applicable when `partitionByNewLine` is false.
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
ignorePattern: [],
Expand Down
4 changes: 3 additions & 1 deletion docs/content/rules/sort-objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Specifies the sorting method.
- `'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
- `'line-length'` — Sort items by the length of the code line (shorter lines first).
- `'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. To be used with the [`useConfigurationIf`](#useconfigurationif) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

Expand Down Expand Up @@ -658,6 +658,7 @@ let user = {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down Expand Up @@ -692,6 +693,7 @@ let user = {
{
type: 'alphabetical',
order: 'asc',
fallbackSort: { type: 'unsorted' },
ignoreCase: true,
specialCharacters: 'keep',
partitionByComment: false,
Expand Down
Loading