Skip to content

fxOne/eslint-plugin-sort-keys-shorthand

Repository files navigation

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.

About

eslint plugin which support sorting shorthand keys

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors