jnewman / coffeelint-alphabetize-keys

Coffeelint rule requiring objects to have keys in alphabetical order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

coffeelint-alphabetize-keys

NPM Version Build Status

Coffeelint rule requiring objects to have keys in alphabetical order

Installation

npm install coffeelint-alphabetize-keys

Usage

Put this in your coffeelint config:

"alphabetize_keys": {
  "module": "coffeelint-alphabetize-keys",
}

Examples

Objects

{keyA, keyB, keyC} # Good
{keyC, keyB, keyA} # Bad

The rule applies to both defining and destructing objects.

Classes

# Good
class A
  methodA: ->
  methodB: ->
  methodC: ->

# Bad
class A
  methodC: ->
  methodB: ->
  methodA: ->

The keys are broken down into breaks 8 categories and each are required to only be individually alphabetical. Keys are seperated based on:

  • function vs variable (based on the type of the value)
  • public vs private (key starting with _ is private)
  • instance vs static

The constructor function is ignored.

About

Coffeelint rule requiring objects to have keys in alphabetical order


Languages

Language:CoffeeScript 100.0%