Perfectionist

Getting Started

Before you start, take a moment to support the project by giving us a star on GitHub.

Your support helps the continued development and improvement of this project.

Installation

Okay, let’s get started. You’ll first need to install ESLint:

Next, install eslint-plugin-perfectionist:

Usage

Add perfectionist to the plugins section of your ESLint configuration. Then configure the rules you want to use under the rules section.

Settings

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.

In settings you can set the following options:

  • type — The type of sorting. Possible values are 'alphabetical', 'natural' and 'line-length'.
  • order — The order of sorting. Possible values are 'asc' and 'desc'.
  • ignoreCase — Ignore case when sorting.
  • ignorePattern — Ignore sorting for elements that match the pattern.
  • partitionByComment — Partition the sorted elements by comments. Values can be true, false or glob pattern string.
  • partitionByNewLine — Partition the sorted elements by new lines. Values can be true or false.

Example:

Table of Contents