Socket
Socket
Sign inDemoInstall

eslint-plugin-sort-decorators

Package Overview
Dependencies
37
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-decorators

An ESLint plugin to sort decorators


Version published
Maintainers
1
Created

Changelog

Source

0.2.6 (2024-03-24)

Bug Fixes

  • deps: bump @typescript-eslint/parser peer to ^7.0.0 (2fbac11)

Readme

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

FAQs

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc