Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.28 KB

File metadata and controls

52 lines (38 loc) · 1.28 KB

ESLint-plugin-sort-keys-shorthand

Extended sort-keys rule with shorthand property support, since ESLint doesn't want to support it natively.

Requirements

  • ESLint 10+
  • Node.js 20+

Note: For ESLint 9 support, use v3.x.

Installation

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

Configuration

This plugin uses the ESLint flat config format. Create an eslint.config.js 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'
        }
      ]
    }
  }
];

Rules

Pushing a v* tag triggers the release workflow, which runs tests, publishes to npm with provenance, and creates a GitHub Release.