Skip to content

eslint/sort-keys Style ​

🚧 An auto-fix is still under development.

What it does ​

When declaring multiple properties, sorting property names alphabetically makes it easier to find and/or diff necessary properties at a later time.

Why is this bad? ​

Unsorted property keys can make the code harder to read and maintain.

Examples ​

Examples of incorrect code for this rule:

js
let myObj = {
  c: 1,
  a: 2,
};

Examples of correct code for this rule:

js
let myObj = {
  a: 2,
  c: 1,
};

References ​

Released under the MIT License.