0.2.6 • Published 1 year ago

eslint-plugin-sort-decorators v0.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

eslint-plugin-sort-decorators

CI npm version Code coverage

An ESLint plugin to sort decorators

Installation

First, the peer dependencies must be installed:

npm i --save-dev typescript eslint @typescript-eslint/parser

Next, install eslint-plugin-sort-decorators:

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

Usage

As this plugin only works with typescript, the parser must be set in a .eslintrc file:

{
  "parser": "@typescript-eslint/parser"
}

The plugin can then be activated by adding sort-decorators to the plugins property:

{
  "plugins": ["sort-decorators"]
}

The different rules can be defined as follows:

{
  "rules": {
    "sort-decorators/sort-on-classes": "error"
  }
}

Or simply extends a configuration preset:

{
  "extends": ["plugin:sort-decorators/recommended"]
}

Configuration presets

NameDescription
plugin:sort-decorators/recommendedEnables all rules with a warn security level.
plugin:sort-decorators/strictEnables all rules with a error security level and autoFix.

All this configuration can be done on a override section: https://eslint.org/docs/latest/use/configure/configuration-files#how-do-overrides-work

Rules

šŸ’¼ Configurations enabled in.\ āš ļø Configurations set to warn in.\ āœ… Set in the recommended configuration.\ šŸ”’ Set in the strict configuration.\ šŸ”§ Automatically fixable by the --fix CLI option.

NameDescriptionšŸ’¼āš ļøšŸ”§
sort-on-accessorsEnforces order of accessors decoratorsšŸ”’āœ…šŸ”§
sort-on-classesEnforces order of class decoratorsšŸ”’āœ…šŸ”§
sort-on-methodsEnforces order of methods decoratorsšŸ”’āœ…šŸ”§
sort-on-parametersEnforces order of parameters decoratorsšŸ”’āœ…šŸ”§
sort-on-propertiesEnforces order of properties decoratorsšŸ”’āœ…šŸ”§

Releases

See information about breaking changes and release notes here.

0.2.6

1 year ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago