eslint-plugin-sort-array-values

0.1.0 • Public • Published

eslint-plugin-sort-array-values

Enforce array values to be sorted

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-sort-array-values:

npm install eslint-plugin-sort-array-values --save-dev

Usage

Add sort-array-values to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["sort-array-values"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "sort-array-values/rule-name": "error"
  }
}

Rules

Enforce array values to be sorted (sort-array-values)

Useful for large constant array to enforce sorting and avoid merging conflict

Rule Details

Examples of incorrect code for this rule:

// @eslint-sort-array
const mySortableArray = ["x", "b", "a"];

Examples of correct code for this rule:

// No annotation
const mySortableArray = ["z", "b", "x"];

// @eslint-sort-array
const mySortableArray = ["a", "b", "x"];

Package Sidebar

Install

npm i eslint-plugin-sort-array-values

Weekly Downloads

1,639

Version

0.1.0

License

ISC

Unpacked Size

8.32 kB

Total Files

6

Last publish

Collaborators

  • boiteu