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: adds fallbackSort option to all rules #457

Merged
merged 26 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
204ef1e
feat: adds `fallbackSort` typings and JSON schema
hugop95 Jan 31, 2025
6486253
feat: implements `fallbackSort` algorithm
hugop95 Jan 31, 2025
b766f5a
feat(sort-array-includes): adds tests and documentation
hugop95 Feb 5, 2025
da28c70
feat(sort-sets): adds tests and documentation
hugop95 Feb 5, 2025
e79be0b
feat(sort-maps): adds tests and documentation
hugop95 Feb 5, 2025
2fde748
feat(sort-classes): adds tests and documentation
hugop95 Feb 5, 2025
6195c12
feat(sort-decorators): adds tests and documentation
hugop95 Feb 5, 2025
1e2516e
feat(sort-enums): adds tests and documentation
hugop95 Feb 5, 2025
6799315
feat(sort-exports): adds tests and documentation
hugop95 Feb 5, 2025
a0aeaac
feat(sort-heritage-clauses): adds tests and documentation
hugop95 Feb 5, 2025
0065bcf
feat(sort-imports): adds tests and documentation
hugop95 Feb 5, 2025
f1cab5d
feat(sort-interfaces): adds tests and documentation
hugop95 Feb 5, 2025
a941bae
feat(sort-intersection-types): adds tests and documentation
hugop95 Feb 5, 2025
eb0a18c
feat(sort-jsx-props): adds tests and documentation
hugop95 Feb 5, 2025
9692eef
feat(sort-modules): adds tests and documentation
hugop95 Feb 5, 2025
beab6cc
feat(sort-named-exports): adds tests and documentation
hugop95 Feb 5, 2025
756f52d
feat(sort-named-imports): adds tests and documentation
hugop95 Feb 5, 2025
2dac614
feat(sort-object-types): adds tests and documentation
hugop95 Feb 5, 2025
fa179bf
feat(sort-objects): adds tests and documentation
hugop95 Feb 5, 2025
ff9bd92
feat(sort-switch-case): adds tests and documentation
hugop95 Feb 5, 2025
896e06a
feat(sort-union-types): adds tests and documentation
hugop95 Feb 5, 2025
365f0ce
feat(sort-variable-declarations): adds tests and documentation
hugop95 Feb 5, 2025
4d4b494
FEEDBACK: replaces array with object
hugop95 Feb 9, 2025
8f6d97a
docs: [FEEDBACK] fixes docs
hugop95 Feb 10, 2025
5d102cc
test: [FEEDBACK] improves tests
hugop95 Feb 11, 2025
22302b3
Merge branch 'main' into feat/fallbackSort
hugop95 Feb 11, 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
19 changes: 19 additions & 0 deletions docs/content/rules/sort-array-includes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-classes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-decorators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-enums.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-heritage-clauses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-interfaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-intersection-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-jsx-props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-maps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-named-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-named-imports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
19 changes: 19 additions & 0 deletions docs/content/rules/sort-object-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ Determines whether the sorted items should be in ascending or descending order.
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).

### fallbackSort

<sub>
type: `{ type: string; order?: 'asc' | 'desc' }`
</sub>
<sub>default: `{ type: 'unsorted' }`</sub>

Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
[`type`](#type).

Example: enforce alphabetical sort between two elements with the same length.
```ts
{
type: 'line-length',
order: 'desc'
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```

### alphabet

<sub>default: `''`</sub>
Expand Down
Loading