Skip to content

ESLint Plugin to enforce placing destructuring properties on separate lines.

Notifications You must be signed in to change notification settings

kusotenpa/eslint-plugin-destructuring-newline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1d8e250 Â· Sep 18, 2023

History

14 Commits
Oct 4, 2022
Oct 4, 2022
Oct 4, 2022
Oct 4, 2022
Sep 18, 2023
Oct 4, 2022
Oct 4, 2022
Oct 4, 2022
Jan 6, 2023
Sep 18, 2023
Sep 18, 2023
Oct 4, 2022

Repository files navigation

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