0.1.1 • Published 2 years ago

eslint-plugin-destructuring-newline v0.1.1

Weekly downloads
132
License
MIT
Repository
github
Last release
2 years ago

eslint-plugin-destructuring-newline

Enforce placing destructuring properties on separate lines.

Installation

$ npm install --save-dev eslint eslint-plugin-destructuring-newline

Rules

šŸ”§: Fixable

RulešŸ”§
destructuring-newline/object-property-newlinešŸ”§

Usage

In your .eslintrc

{
  "plugins": [
    "destructuring-newline"
  ],
  "rules": {
    "object-curly-newline": 2, // recommended
    "destructuring-newline/object-property-newline": 2
  }
}

Rule Details

// bad
const { a, b } = obj

// good
const { a } = obj
const {
    a,
    b,
} = obj

Option

maxProperties

Limit the number of properties per line.

// "destructuring-newline/object-property-newline": [2, { maxProperties: 3 }]

// bad
const {
  a,
  b,
  c,
  d,
} = obj

// good
const {
  a, b, c,
  d,
} = obj

const { a, b } = obj