Skip to content

Ouicar/eslint-plugin-sorting

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

npm install --save-dev eslint eslint-plugin-sorting

In the plugins section of your .eslintrc, add sorting.

{
  "plugins": [
    "sorting"
  ],
  "rules": {
    "sorting/sort-object-props": [ 1, { "ignoreCase": true, "ignoreMethods": false } ]
  }
}

Rule Details

By default all rules are case insensitive and methods (functions as values) are not ignored.

Warnings:

var obj = {
  c: "foo",
  a: "bar",
  b: {
    e: 1,
    d: 2,
  },
  A: 5
};

OK:

var obj = {
  A: 5,
  a: "bar",
  b: {
    d: 2,
    e: 1,
  },
  c: "foo",
};

OK if ignoreMethods: true

var Foo = {
  b: function() {},
  a: function() {}
};

About

ESLint plugin for sorting of various things.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%