0.1.0 • Published 2 years ago

eslint-plugin-sort-array-values v0.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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"];
0.1.0

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago