Socket
Socket
Sign inDemoInstall

eslint-plugin-no-unused-vars-rest

Package Overview
Dependencies
152
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-no-unused-vars-rest

An enhanced version of the ESLint core rule no-unused-vars with allowances for experimental object rest properties.


Version published
Weekly downloads
172
increased by6.17%
Maintainers
1
Install size
8.50 kB
Created
Weekly downloads
 

Readme

Source

build status test coverage npm

eslint-plugin-no-unused-vars-rest

DEPRECATED: As of ESLint 3.15.0 this functionality is supported by the core no-unused-vars rule.

An enhanced version of the ESLint core rule no-unused-vars with allowances for experimental object rest properties.

This plugin provides a single rule which functions the same as the core rule no-unused-vars, except it adds the ignoreDestructuredVarsWithRest option. Enabling this option will allow unused variables appearing in destructuring assignments that also contain experimental rest properties. This is useful for shallow-cloning an object while omitting certain properties.

Installation

Install ESLint and eslint-plugin-no-unused-vars-rest:

$ npm install --save-dev eslint eslint-plugin-no-unused-vars-rest

Usage

Add no-unused-vars-rest to the plugins section of your .eslintrc configuration file, and configure the rule under the rules section. Don't forget to disable the core rule no-unused-vars.

{
  "plugins": [
    "no-unused-vars-rest"
  ],
  "rules": {
    "no-unused-vars": 0,
    "no-unused-vars-rest/no-unused-vars": [2, {"ignoreDestructuredVarsWithRest": true}]
  }
}

Alternatively you may use the plugin's recommended configuration, which applies the above configuration.

{
  "extends": ["plugin:no-unused-vars-rest/recommended"]
}

When not using this rule the following pattern is considered a problem by the core rule no-unused-vars:

const { extra, ...rest } = blah; // Error 'extra' is defined but never used.
return rest;

When using this rule with ignoreDestructuredVarsWithRest: true the following pattern is acceptable:

const { extra, ...rest } = blah;
return rest;

Keywords

FAQs

Last updated on 30 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc