# eslint-plugin-newline-destructuring

> Eslint plugin for enforcing newlines in object destructuring assignment past a certain number of properties.

Latest version **1.2.2** (published 2024-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-newline-destructuring
pnpm add eslint-plugin-newline-destructuring
yarn add eslint-plugin-newline-destructuring
bun add eslint-plugin-newline-destructuring
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2024-04-15 |
| First published | 2021-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Maintainers | urielvan |
| Keywords | eslint, eslint-plugin, eslintplugin, lint, destructuring |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-newline-destructuring
- Repository: https://github.com/urielvan/eslint-plugin-newline-destructuring
- Homepage: https://github.com/urielvan/eslint-plugin-newline-destructuring#readme
- Issues: https://github.com/urielvan/eslint-plugin-newline-destructuring/issues
- npm.io page: https://npm.io/package/eslint-plugin-newline-destructuring

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2024-04-15
- 1.2.1 — 2023-03-07
- 1.2.0 — 2023-03-07
- 1.1.1 — 2022-11-01
- 1.1.0 — 2022-11-01
- 1.0.1 — 2021-08-25
- 1.0.0 — 2021-04-08
- 0.0.4 — 2021-01-14
- 0.0.3 — 2021-01-05
- 0.0.2 — 2021-01-04
- 0.0.1 — 2021-01-04

## README

# eslint-plugin-newline-destructuring

Eslint plugin for enforcing newlines in object destructuring assignment past a certain number of properties.

## Usage

Add `newline-destructuring` to the plugins section of your eslint configuration file.

``` js
plugins: [
  'newline-destructuring'
]
```

Then add the rule in the rules section

``` js
rules: {
  'newline-destructuring/newline': 'error'
}
```

### Options

The rule accepts an option object with the following properties:

- `items` [number] (default: `2`) - Specifies the maximum number of properties before the plugin requires breaking up the statement to multiple lines. If there are exactly this many or fewer properties, then the plugin will make sure the statement stays on one line unless it would violate the `maxLength` option or `consistent` option is used. More properties than this number will always be split onto multiple lines.

- `itemsWithRest` [number] (default: `1`) - Specifies the maximum number of properties **contain rest pattern** before the plugin requires breaking up the statement to multiple lines. If there are exactly this many or fewer properties, then the plugin will make sure the statement stays on one line unless it would violate the `maxLength` option or `consistent` option is used. More properties than this number will always be split onto multiple lines.

- `maxLength` [number] (default: `Infinity`) - Specifies the maximum length for source code lines in your project, the plugin will split long destructuring lines even if they contains properties less than value in `items` or `itemsWithRest`

- `consistent` [boolean] (default: false) - If there are less than the threshold items, allow new lines consistent with whether the curly braces are on their own lines or not.

- `allowAllPropertiesOnSameLine` [boolean] (default: false) - If there are less than the threshold items, allow all properties to be on the same line. But one like

  ``` js
  const {
    a,b,
    c
  } = obj
  ```
  will be split into multiple lines

---
_Source: https://npm.io/package/eslint-plugin-newline-destructuring · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
