New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

coffeelint-alphabetize-keys

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffeelint-alphabetize-keys

Coffeelint rule that verifies object keys are in alphabetical order

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-56.25%
Maintainers
1
Weekly downloads
 
Created
Source

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"
}

Configuration options

  • overrides - Array of keys to order as a separate category, keys must appear in the order provided.

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 8 categories and each are required to only be individually alphabetical. Keys are separated 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.

Overrides
"alphabetize_keys": {
  "module": "coffeelint-alphabetize-keys",
  "overrides": ["methodC", "methodB", "methodA"]
}
# Good
class A
  methodC: ->
  methodB: ->
  methodA: ->

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

Keywords

FAQs

Package last updated on 08 Mar 2016

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