ronparkdev / eslint-plugin-sort-annotation

Lint rule for sort the value or properties if it has @sort or @sort-keys annotation
13 stars 2 forks source link
eslint eslint-plugin eslint-rules

⚠️ Changed to eslint-plugin-annotation to add other features besides sorting!

eslint-plugin-sort-annotation

NPM version Build Status

An ESLint plugin for sorting interface properties, object keys and array values if code has annotation. Rules support auto fix and Typescript also.

sort-annotation/sort sort-annotation/sort-keys
sort sort-keys

Installation

You’ll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-sort-annotation:

npm i eslint-plugin-sort-annotation --save-dev

Usage

Here’s a suggested ESLint configuration that:

{
  "parserOptions": { ... }, // Nothing changed
  "plugins": [..., "sort-annotation"], // Add 'sort-annotation' next to old plugins
  "rules": {
    ...
    // Add below rules next to old rules 
    'sort-annotation/sort-keys': 'error',
    'sort-annotation/sort': 'error',
  }
}

Supported Rules

License

BSD License