šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-sort-decorators

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-decorators

An ESLint plugin to sort decorators

0.2.6
latest
Source
npm
Version published
Weekly downloads
101
16.09%
Maintainers
1
Weekly downloads
Ā 
Created
Source

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.

Keywords

eslint

FAQs

Package last updated on 24 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts