Skip to content
8 changes: 4 additions & 4 deletions docs/content/configs/recommended-alphabetical.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Configuration for the `eslint-plugin-perfectionist` plugin, which provides all p

Uses [localeCompare](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) to sort elements.

It makes it just a tiny bit faster to find a declaration in a large list. Remember, you read code far more than you write it.
It makes it just a bit faster to find a declaration in a large list. Remember, you read code far more than you write it.

## When to Use

Use the recommended-alphabetical configuration when you want to enforce a consistent alphabetical order across various data structures in your codebase.
Use the `recommended-alphabetical` configuration when you want to enforce a consistent alphabetical order across various data structures in your codebase.

This configuration is particularly useful in large projects where readability and maintainability are crucial.
This configuration is particularly useful for large projects where readability and maintainability are crucial.

It helps in quickly locating declarations and ensures that similar elements are grouped together, reducing cognitive load for developers navigating the code.
It helps quickly locate declarations and ensures that similar elements are grouped together, reducing cognitive load for developers navigating the code.

## Usage

Expand Down
6 changes: 3 additions & 3 deletions docs/content/configs/recommended-custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import dedent from 'dedent'

Configuration for the `eslint-plugin-perfectionist` plugin, which provides all plugin rules with your predefined custom ordered alphabet.

This configuration allows you to define your own custom order for sorting elements in your codebase as you truly desire.
This configuration allows you to define your own custom order for sorting elements in your codebase as you desire.

## When to Use

Each rule in `eslint-plugin-perfectionist` offers a lot of options that should suit most use cases.
Each rule in `eslint-plugin-perfectionist` offers many options that should suit most use cases.

If this is not enough, you may define your own alphabet and use the `recommended-custom` configuration to enforce a consistent custom order across various data structures in your codebase.

Use this configuration to precisely tune how elements should be sorted while keeping readability and maintainability to their highest levels.
Use this configuration to precisely tune how elements should be sorted while keeping readability and maintainability at their highest levels.

## Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/content/configs/recommended-line-length.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import dedent from 'dedent'

Configuration for the `eslint-plugin-perfectionist` plugin, which provides all plugin rules with preset options: sorting by string length in descending order.

This configuration will make your code prettier and more pleasing to the eye.
This configuration will make your code prettier and more visually pleasing.

## When to Use

Use the `recommended-line-length` configuration when you want your code to look neat and visually pleasing.

This configuration is especially useful in projects where the aesthetic appearance of the code is important and where developers appreciate clean alignment and visual harmony. It helps create code that is easier to read and perceive by minimizing visual clutter and enhancing the overall structure of the code.
This configuration is especially useful for projects where the aesthetic appearance of the code is important and where developers appreciate clean alignment and visual harmony. It helps create code that is easier to read and perceive by minimizing visual clutter and enhancing the overall structure of the code.

## Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/content/configs/recommended-natural.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ This configuration will allow you to navigate through your code faster because a

## When to Use

Use the recommended-natural configuration if you want elements in your code to be sorted in a way that feels more intuitive to humans.
Use the `recommended-natural` configuration if you want elements in your code to be sorted in a way that feels more intuitive to humans.

This configuration is particularly useful in projects where an intuitive understanding of the order of elements is important, such as version files, task lists, or any other data sets that contain numerical values. Natural sorting makes your code more readable and easier to comprehend, especially in situations where numerical values play a key role.
This configuration is particularly useful for projects where an intuitive understanding of the order of elements is important, such as version files, task lists, or any other data sets that contain numerical values. Natural sorting makes your code more readable and easier to comprehend, especially in situations where numerical values play a key role.

## Usage

Expand Down
6 changes: 3 additions & 3 deletions docs/content/guide/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Your support helps the continued development and improvement of this project.

## Installation

Okay, let's get started. You'll first need to install [ESLint](https://eslint.org/) v8.45.0 or greater:
Let's get started. You'll need to install [ESLint](https://eslint.org/) v8.45.0 or greater:

<CodeTabs
code={[
Expand Down Expand Up @@ -136,9 +136,9 @@ lang="tsx"

Many rules have common settings. You can set them in the `settings` field.

The highest priority is given to the settings of a particular rule. Next comes the settings field and the lowest priority has default values.
The highest priority is given to the settings of a particular rule. Next comes the settings field, and then the default values.

In settings you can set the following options:
In settings, you can set the following options:

- `type` — The type of sorting. Possible values are `'alphabetical'`, `'natural'`, `'line-length'` and `custom`.
- `order` — The order of sorting. Possible values are `'asc'` and `'desc'`.
Expand Down
54 changes: 27 additions & 27 deletions docs/content/rules/sort-array-includes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ Specifies the sorting method.

- `'alphabetical'` — Sort items alphabetically (e.g., “a” < “b” < “c”) using [localeCompare](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare).
- `'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.
- `'line-length'` — Sort items by code line length (shorter lines first).
- `'custom'` — Sort items using the alphabet specified in the [`alphabet`](#alphabet) option.
- `'unsorted'` — Do not sort items. [`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.

### order

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

Determines whether the sorted items should be in ascending or descending order.
Specifies whether to sort items 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).
Expand All @@ -153,14 +153,14 @@ Determines whether the sorted items should be in ascending or descending order.
</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
Specifies fallback sort options for 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'
order: 'desc',
fallbackSort: { type: 'alphabetical', order: 'asc' }
}
```
Expand All @@ -169,7 +169,7 @@ Example: enforce alphabetical sort between two elements with the same length.

<sub>default: `''`</sub>

Only used when the [`type`](#type) option is set to `'custom'`. Specifies the custom alphabet to use when sorting.
Used only when the [`type`](#type) option is set to `'custom'`. Specifies the custom alphabet for sorting.

Use the `Alphabet` utility class from `eslint-plugin-perfectionist/alphabet` to quickly generate a custom alphabet.

Expand All @@ -179,7 +179,7 @@ Example: `0123456789abcdef...`

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

Controls whether sorting should be case-sensitive or not.
Specifies whether sorting should be case-sensitive.

- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
- `false` — Consider case when sorting (e.g., “a” comes before “A”).
Expand All @@ -188,7 +188,7 @@ Controls whether sorting should be case-sensitive or not.

<sub>default: `keep`</sub>

Controls whether special characters should be trimmed, removed or kept before sorting.
Specifies whether to trim, remove, or keep special characters before sorting.

- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
Expand All @@ -198,7 +198,7 @@ Controls whether special characters should be trimmed, removed or kept before so

<sub>default: `'en-US'`</sub>

Specifies the sorting locales. See [String.prototype.localeCompare() - locales](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#locales).
Specifies the sorting locales. Refer To [String.prototype.localeCompare() - locales](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#locales).

- `string` — A BCP 47 language tag (e.g. `'en'`, `'en-US'`, `'zh-CN'`).
- `string[]` — An array of BCP 47 language tags.
Expand All @@ -209,7 +209,7 @@ Specifies the sorting locales. See [String.prototype.localeCompare() - locales](

Use the [groups](#groups) option with the `literal` and `spread` selectors instead. Make sure to set this option to `mixed`.

Allows you to group array elements by their kind, determining whether spread values should come before or after literal values.
Groups array elements by their kind, determining whether spread values should come before or after literal values.

- `mixed` — Do not group array elements by their kind; spread values are sorted together with literal values.
- `literals-first` — Group all literal values before spread values.
Expand All @@ -219,7 +219,7 @@ Allows you to group array elements by their kind, determining whether spread val

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

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

- `true` — All comments will be treated as delimiters, creating partitions.
- `false` — Comments will not be used as delimiters.
Expand All @@ -231,7 +231,7 @@ Allows you to use comments to separate the members of arrays into logical groups

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

When `true`, the rule will not sort the members of an array if there is an empty line between them. This can be useful for keeping logically separated groups of members in their defined order.
When `true`, the rule will not sort the members of an array if there is an empty line between them. This helps maintain the defined order of logically separated groups of members.

```ts
if ([
Expand Down Expand Up @@ -261,7 +261,7 @@ Each group of elements (separated by empty lines) is treated independently, and

<sub>default: `'ignore'`</sub>

Specifies how new lines should be handled between groups.
Specifies how to handle new lines between groups.

- `ignore` — Do not report errors related to new lines.
- `always` — Enforce one new line between each group, and forbid new lines inside a group.
Expand All @@ -271,7 +271,7 @@ You can also enforce the newline behavior between two specific groups through th

See the [`groups`](#newlines-between-groups) option.

This option is only applicable when `partitionByNewLine` is `false`.
This option is only applicable when [`partitionByNewLine`](#partitionbynewline) is `false`.

### useConfigurationIf

Expand All @@ -280,7 +280,7 @@ This option is only applicable when `partitionByNewLine` is `false`.
</sub>
<sub>default: `{}`</sub>

Allows you to specify filters to match a particular options configuration for a given array.
Specifies filters to match a particular options configuration for a given array.

The first matching options configuration will be used. If no configuration matches, the default options configuration will be used.

Expand Down Expand Up @@ -325,7 +325,7 @@ Example configuration:
</sub>
<sub>default: `[]`</sub>

Allows you to specify a list of groups for sorting. Groups help organize elements into categories.
Specifies a list of groups for sorting. Groups help organize elements into categories.

Each element will be assigned a single group specified in the `groups` option (or the `unknown` group if no match is found).
The order of items in the `groups` option determines how groups are ordered.
Expand All @@ -339,16 +339,16 @@ Predefined groups are characterized by a selector.

##### List of selectors

- `literal`: Array elements that are not spread values.
- `spread`: Array elements that are spread values.
- `literal` Array elements that are not spread values.
- `spread` Array elements that are spread values.

#### Newlines between groups

You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups.

See the [`newlinesBetween`](#newlinesbetween) option.

This feature is only applicable when `partitionByNewLine` is false.
This feature is only applicable when [`partitionByNewLine`](#partitionbynewline) is `false`.

```ts
{
Expand All @@ -368,7 +368,7 @@ This feature is only applicable when `partitionByNewLine` is false.
</sub>
<sub>default: `[]`</sub>

You can define your own groups and use regexp patterns to match specific object type members.
Defines custom groups to match specific object type members.

A custom group definition may follow one of the two following interfaces:

Expand Down Expand Up @@ -406,13 +406,13 @@ An array element will match a `CustomGroupAnyOfDefinition` group if it matches a

#### Attributes

- `groupName`: The group's name, which needs to be put in the `groups` option.
- `selector`: Filter on the `selector` of the element.
- `elementNamePattern`: If entered, will check that the name of the element matches the pattern entered.
- `type`: Overrides the sort type for that custom group. `unsorted` will not sort the group.
- `order`: Overrides the sort order for that custom group
- `fallbackSort`: Overrides the fallbackSort option for that custom group
- `newlinesInside`: Enforces a specific newline behavior between elements of the group.
- `groupName`The group's name, which needs to be put in the [`groups`](#groups) option.
- `selector` Filter on the `selector` of the element.
- `elementNamePattern` If entered, will check that the name of the element matches the pattern entered.
- `type`Overrides the [`type`](#type) option for that custom group. `unsorted` will not sort the group.
- `order`Overrides the [`order`](#order) option for that custom group.
- `fallbackSort`Overrides the [`fallbackSort`](#fallbacksort) option for that custom group.
- `newlinesInside` Enforces a specific newline behavior between elements of the group.

#### Match importance

Expand Down
Loading