eslint-plugin-destructuring-newline

0.1.1 • Public • Published

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

Package Sidebar

Install

npm i eslint-plugin-destructuring-newline

Weekly Downloads

2,489

Version

0.1.1

License

MIT

Unpacked Size

55.7 kB

Total Files

3

Last publish

Collaborators

  • kusotenpa