JSPM

coffeelint-alphabetize-keys

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q46794F
  • License MIT

Coffeelint rule that verifies object keys are in alphabetical order

Package Exports

  • coffeelint-alphabetize-keys

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coffeelint-alphabetize-keys) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

The rule differentiates between variables and methods, and each are required to only be individually alphabetical.

# Good
class A
  variableA: 1 * 2
  variableB: 'abc'
  variableC: fn()

  methodA: ->
  methodB: ->
  methodC: ->

# Bad
class A
  variableC: fn()
  variableB: 'abc'
  variableA: 1 * 2

  methodC: ->
  methodB: ->
  methodA: ->

Methods and variables are also broken down into static, instance, and private instance (starting with _) where each are required to only be individually alphabetical.