Skip to content

Commit

Permalink
feat!: make recommended options default
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Jul 22, 2024
1 parent a0208ac commit d0d9115
Show file tree
Hide file tree
Showing 55 changed files with 2,489 additions and 1,964 deletions.
14 changes: 8 additions & 6 deletions docs/content/rules/sort-array-includes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ This rule accepts an options object with the following properties:

### type

<sub>(default: `'alphabetical'`)</sub>
<sub>default: `'alphabetical'`</sub>

Specifies the sorting method.

Expand All @@ -131,7 +131,7 @@ Specifies the sorting method.

### order

<sub>(default: `'asc'`)</sub>
<sub>default: `'asc'`</sub>

Determines whether the sorted items should be in ascending or descending order.

Expand All @@ -140,7 +140,7 @@ Determines whether the sorted items should be in ascending or descending order.

### ignoreCase

<sub>(default: `true`)</sub>
<sub>default: `true`</sub>

Controls whether sorting should be case-sensitive or not.

Expand All @@ -150,7 +150,7 @@ Controls whether sorting should be case-sensitive or not.

### spreadLast

<sub>(default: `false`)</sub>
<sub>default: `true`</sub>

Determines the position of spread elements within the array.

Expand All @@ -175,8 +175,9 @@ Determines the position of spread elements within the array.
'perfectionist/sort-array-includes': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
spreadLast: true,
},
],
Expand All @@ -198,8 +199,9 @@ Determines the position of spread elements within the array.
'perfectionist/sort-array-includes': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
spreadLast: true,
},
],
Expand Down
30 changes: 13 additions & 17 deletions docs/content/rules/sort-astro-attributes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This rule accepts an options object with the following properties:

### type

<sub>(default: `'alphabetical'`)</sub>
<sub>default: `'alphabetical'`</sub>

Specifies the sorting method.

Expand All @@ -120,7 +120,7 @@ Specifies the sorting method.

### order

<sub>(default: `'asc'`)</sub>
<sub>default: `'asc'`</sub>

Determines whether the sorted items should be in ascending or descending order.

Expand All @@ -129,7 +129,7 @@ Determines whether the sorted items should be in ascending or descending order.

### ignoreCase

<sub>(default: `true`)</sub>
<sub>default: `true`</sub>

Controls whether sorting should be case-sensitive or not.

Expand All @@ -138,7 +138,7 @@ Controls whether sorting should be case-sensitive or not.

### groups

<sub>(default: `[]`)</sub>
<sub>default: `[]`</sub>

Allows you to specify a list of Astro attribute groups for sorting. Groups help organize attributes into categories, prioritizing them during sorting. Multiple groups can be combined to achieve the desired sorting order.

Expand Down Expand Up @@ -169,7 +169,7 @@ Example:

### customGroups

<sub>(default: `{}`)</sub>
<sub>default: `{}`</sub>

You can define your own groups for Astro attributes. The [minimatch](https://github.com/isaacs/minimatch) library is used for pattern matching.

Expand Down Expand Up @@ -243,13 +243,11 @@ In order to start using this rule, you need to install additional dependency:
'perfectionist/sort-astro-attributes': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
groups: [
'multiline',
'unknown',
['shorthand', 'astro-shorthand'],
],
ignoreCase: true,
groups: [],
customGroups: {},
},
],
},
Expand All @@ -276,13 +274,11 @@ In order to start using this rule, you need to install additional dependency:
'perfectionist/sort-astro-attributes': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
groups: [
'multiline',
'unknown',
['shorthand', 'astro-shorthand'],
],
ignoreCase: true,
groups: [],
customGroups: {},
},
],
},
Expand Down
42 changes: 34 additions & 8 deletions docs/content/rules/sort-classes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ This rule accepts an options object with the following properties:

### type

<sub>(default: `'alphabetical'`)</sub>
<sub>default: `'alphabetical'`</sub>

Specifies the sorting method.

Expand All @@ -165,7 +165,7 @@ Specifies the sorting method.

### order

<sub>(default: `'asc'`)</sub>
<sub>default: `'asc'`</sub>

Determines whether the sorted items should be in ascending or descending order.

Expand All @@ -174,7 +174,7 @@ Determines whether the sorted items should be in ascending or descending order.

### ignoreCase

<sub>(default: `true`)</sub>
<sub>default: `true`</sub>

Controls whether sorting should be case-sensitive or not.

Expand All @@ -183,7 +183,7 @@ Controls whether sorting should be case-sensitive or not.

### partitionByComment

<sub>(default: `false`)</sub>
<sub>default: `false`</sub>

Allows you to use comments to separate the class members into logical groups. This can help in organizing and maintaining large enums by creating partitions within the enum based on comments.

Expand All @@ -193,7 +193,23 @@ Allows you to use comments to separate the class members into logical groups. Th

### groups

<sub>(default: `['property', 'constructor', 'method', 'unknown']`)</sub>
<sub>
default:
```
[
'index-signature',
'static-property',
'private-property',
'property',
'constructor',
'static-method',
'private-method',
'method',
['get-method', 'set-method'],
'unknown',
]
```
</sub>

Allows you to specify a list of class member groups for sorting. Groups help organize class members into categories, prioritizing them during sorting. Multiple groups can be combined to achieve the desired sorting order.

Expand Down Expand Up @@ -314,7 +330,7 @@ class Example {

### customGroups

<sub>(default: `{}`)</sub>
<sub>default: `{}`</sub>

You can define your own groups for class members. The [minimatch](https://github.com/isaacs/minimatch) library is used for pattern matching.

Expand Down Expand Up @@ -360,8 +376,10 @@ Example:
'perfectionist/sort-classes': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
partitionByComment: false,
groups: [
'index-signature',
'static-property',
Expand All @@ -371,7 +389,10 @@ Example:
'static-method',
'private-method',
'method',
['get-method', 'set-method'],
'unknown',
],
customGroups: {},
},
],
},
Expand All @@ -392,8 +413,10 @@ Example:
'perfectionist/sort-classes': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
partitionByComment: false,
groups: [
'index-signature',
'static-property',
Expand All @@ -403,7 +426,10 @@ Example:
'static-method',
'private-method',
'method',
['get-method', 'set-method'],
'unknown',
],
customGroups: {},
},
],
},
Expand Down
16 changes: 10 additions & 6 deletions docs/content/rules/sort-enums.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This rule accepts an options object with the following properties:

### type

<sub>(default: `'alphabetical'`)</sub>
<sub>default: `'alphabetical'`</sub>

Specifies the sorting method.

Expand All @@ -96,7 +96,7 @@ Specifies the sorting method.

### order

<sub>(default: `'asc'`)</sub>
<sub>default: `'asc'`</sub>

Determines whether the sorted items should be in ascending or descending order.

Expand All @@ -105,7 +105,7 @@ Determines whether the sorted items should be in ascending or descending order.

### ignoreCase

<sub>(default: `true`)</sub>
<sub>default: `true`</sub>

Controls whether sorting should be case-sensitive or not.

Expand All @@ -114,7 +114,7 @@ Controls whether sorting should be case-sensitive or not.

### partitionByComment

<sub>(default: `false`)</sub>
<sub>default: `false`</sub>

Allows you to use comments to separate the members of enums into logical groups. This can help in organizing and maintaining large enums by creating partitions within the enum based on comments.

Expand All @@ -140,8 +140,10 @@ Allows you to use comments to separate the members of enums into logical groups.
'perfectionist/sort-enums': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
partitionByComment: false,
},
],
},
Expand All @@ -162,8 +164,10 @@ Allows you to use comments to separate the members of enums into logical groups.
'perfectionist/sort-enums': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
partitionByComment: false,
},
],
},
Expand Down
12 changes: 7 additions & 5 deletions docs/content/rules/sort-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This rule accepts an options object with the following properties:

### type

<sub>(default: `'alphabetical'`)</sub>
<sub>default: `'alphabetical'`</sub>

Specifies the sorting method.

Expand All @@ -90,7 +90,7 @@ Specifies the sorting method.

### order

<sub>(default: `'asc'`)</sub>
<sub>default: `'asc'`</sub>

Determines whether the sorted items should be in ascending or descending order.

Expand All @@ -99,7 +99,7 @@ Determines whether the sorted items should be in ascending or descending order.

### ignoreCase

<sub>(default: `true`)</sub>
<sub>default: `true`</sub>

Controls whether sorting should be case-sensitive or not.

Expand All @@ -124,8 +124,9 @@ Controls whether sorting should be case-sensitive or not.
'perfectionist/sort-exports': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
},
],
},
Expand All @@ -146,8 +147,9 @@ Controls whether sorting should be case-sensitive or not.
'perfectionist/sort-exports': [
'error',
{
type: 'natural',
type: 'alphabetical',
order: 'asc',
ignoreCase: true,
},
],
},
Expand Down
Loading

0 comments on commit d0d9115

Please sign in to comment.