-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
147 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import mod from '../index' | ||
|
||
export default { | ||
plugins: { | ||
perfectionist: mod, | ||
}, | ||
rules: mod.configs['recommended-line-length'].rules, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import mod from '../index' | ||
|
||
export default { | ||
plugins: { | ||
perfectionist: mod, | ||
}, | ||
rules: mod.configs['recommended-natural'].rules, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: Configs | ||
--- | ||
|
||
# Configs | ||
|
||
The easiest way to use `eslint-plugin-perfectionist` is to use ready-made configs. Config files use all the rules of the current plugin, but you can override them. | ||
|
||
This plugin provides two configs out of the box. | ||
|
||
See the [ESLint docs](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files) for more information about extending config files. | ||
|
||
| Name | Description | | ||
| :---------------------------------------------------------- | :--------------------------------------------------------------- | | ||
| [recommended-natural](/configs/recommended-natural) | All plugin rules with natural sorting in ascending order | | ||
| [recommended-line-length](/configs/recommended-line-length) | All plugin rules with sorting by line length in descending order | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: recommended-line-length | ||
--- | ||
|
||
# recommended-line-length | ||
|
||
## 📖 Details | ||
|
||
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. | ||
|
||
## ⚙️ Usage | ||
|
||
### Legacy config | ||
|
||
<!-- prettier-ignore --> | ||
```json | ||
// .eslintrc | ||
{ | ||
"extends": [ | ||
"plugin:perfectionist/recommended-line-length" | ||
] | ||
} | ||
``` | ||
|
||
### Flat config | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
// eslint.config.js | ||
import perfectionistPluginRecommendedLineLength from 'eslint-plugin-perfectionist/config/recommended-line-length' | ||
|
||
export default [ | ||
perfectionistPluginRecommendedLineLength | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: recommended-natural | ||
--- | ||
|
||
# recommended-natural | ||
|
||
## 📖 Details | ||
|
||
Configuration for the `eslint-plugin-perfectionist` plugin, which provides all plugin rules with predefined options: natural sorting in ascending order. | ||
|
||
What is the difference between natural sorting and alphabetical sorting? Natural sort compares strings containing a mixture of letters and numbers, just as a human would do when sorting. For example: `item-1`, `item-2`, `item-10`. | ||
|
||
This configuration will allow you to navigate through your code faster because all the data that can be safely sorted will be in order. | ||
|
||
## ⚙️ Usage | ||
|
||
### Legacy config | ||
|
||
<!-- prettier-ignore --> | ||
```json | ||
// .eslintrc | ||
{ | ||
"extends": [ | ||
"plugin:perfectionist/recommended-natural" | ||
] | ||
} | ||
``` | ||
|
||
### Flat config | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
// eslint.config.js | ||
import perfectionistPluginRecommendedNatural from 'eslint-plugin-perfectionist/config/recommended-natural' | ||
|
||
export default [ | ||
perfectionistPluginRecommendedNatural | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters