Detalhes do pacote

eslint-plugin-sort-keys-shorthand

fxOne1.5kMIT3.0.0

eslint plugin which support sorting shorthand keys

eslint

readme (leia-me)

ESLint-plugin-sort-keys-shorthand

Extended short-key rule to handle shorthand properties as ESLint doesn't want to support it

ESLint 9+ Support

This plugin is compatible with ESLint 9 and above. If you are using ESLint 9+, please use the new flat config format as shown below.

Installation

Install ESLint either locally or globally. (Note that locally, per project, is strongly preferred)

$ npm install eslint --save-dev

If you installed ESLint globally, you have to install this plugin globally too. Otherwise, install it locally.

$ npm install eslint-plugin-sort-keys-shorthand --save-dev

Configuration (ESLint 9+ Flat Config Example)

Create an eslint.config.js file in your project root:

import sortKeysShorthand from 'eslint-plugin-sort-keys-shorthand';

export default [
  {
    plugins: {
      'sort-keys-shorthand': sortKeysShorthand
    },
    rules: {
      'sort-keys-shorthand/sort-keys-shorthand': [
        'error',
        'asc',
        {
          caseSensitive: true,
          minKeys: 2,
          natural: false,
          shorthand: 'first'
        }
      ]
    }
  }
];

Migration from .eslintrc

If you are migrating from .eslintrc to flat config, move your plugin and rule configuration as shown above. The old .eslintrc format is no longer recommended for ESLint 9+.

Rules

changelog (log de mudanças)

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

To Be Released

3.0.0

  • Update to eslint 9

2.3.0

  • Add support for suggestions

2.2.0

  • Support ESLint 8 #16

    2.1.0

  • Support ESLint 7

2.0.0

  • Add support for ignoreSingleline

1.0.0

  • Initial release