0.0.1 • Published 4 years ago

eslint-plugin-destructure-check v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

eslint-plugin-destructure-check

Deconstruction assignment check, including depth and must-default

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-destructure-check:

$ npm install eslint-plugin-destructure-check --save-dev

Usage

Add destructure-check to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "destructure-check"
    ]
}

To customize the allowed destructuring depth and ignore React Hooks:

{
  "rules": {
    "destructure-check/max-depth": ["warn", 1, true]
  }
}

This will allow up to 1 level deep of destructuring:

const {
  a: { b }
} = object;

Destructuring assignment must have a default value:

{
  "rules": {
    "destructure-check/must-default": ["warn"]
  }
}

Supported Rules

  • Fill in provided rules here