eslint-plugin-sorting
Sorting rules for eslint
Last updated 7 years ago by jacobrask .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-sorting 
SYNC missed versions from official npm registry.

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,
      "ignoreMethodSiblings": 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() {}
};

OK if ignoreMethodSiblings: true

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

Current Tags

  • 0.4.1                                ...           latest (7 years ago)

8 Versions

  • 0.4.1                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.0                                ...           10 years ago
  • 0.2.2                                ...           10 years ago
  • 0.2.1                                ...           10 years ago
  • 0.2.0                                ...           10 years ago
  • 0.1.0                                ...           10 years ago
  • 0.0.1                                ...           11 years ago
Downloads
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 7
Last Month 1
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |