Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-sorting

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sorting

Sorting rules for eslint

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
182
increased by102.22%
Maintainers
2
Weekly downloads
 
Created
Source

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() {}
};

Keywords

FAQs

Package last updated on 12 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc