0.0.7 • Published 11 months ago

eslint-plugin-array-tokens-sorter v0.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

eslint-plugin-array-tokens-sorter

Purpose

For an example you have an array of elements, and you want to sort each element in alphabetical order

Code before:

class A {}
class B {}
class C {}

const SCOPE: unknown[] = [];

// eslint: enable-alphabetical-order-array
export default [...SCOPE, A, B, C];

export default [...SCOPE, A, B, C]; // eslint: enable-alphabetical-order-array - a second sample of usage

// eslint: enable-unique-alphabetical-order-array
export default [...SCOPE, A, A, B, C];

After fixing the code

class A {}
class B {}
class C {}

const SCOPE: unknown[] = [];

// eslint: enable-alphabetical-order-array
export default [...SCOPE, A, B, C];

export default [...SCOPE, A, B, C]; // eslint: enable-alphabetical-order-array - a second sample of usage

// eslint: enable-unique-alphabetical-order-array
export default [...SCOPE, A, B, C];

Installation

yarn add -D eslint-plugin-array-tokens-sorter

Setup

Add array-tokens-sorter to your list of plugins in your ESLint config.

JSON ESLint config example:

{
  "plugins": ["array-tokens-sorter"],
  "rules": {
    "array-tokens-sorter/array": ["error", { "spreadVariablesFirst": true }]
  }
}
0.0.5

11 months ago

0.0.4

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.3

1 year ago

0.0.2

1 year ago