Socket
Book a DemoInstallSign in
Socket

eslint-plugin-consistent-return-legacy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-consistent-return-legacy

The consistent-return rule from ESLint 1.x.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

eslint-plugin-consistent-return-legacy Build Status

The consistent-return rule from ESLint 1.x.

In ESLint 1.x (as in this plugin), the rule only verifies that all or none of the return statements return a value.

For example, this would be legal:

function() {
  if (foo) return foo;

  if (bar) return bar;
}

In ESLint 2+, it verifies that all or none of the code paths return a value.

So the first example would not be legal; you'd need to do this:

function() {
  if (foo) return foo;

  if (bar) return bar;
  
  return baz;
}

In some code the new behavior may produce many false negatives, e.g. when returning false in jQuery event handlers.

Usage

npm i --save-dev eslint-plugin-consistent-return-legacy

{
  "plugins": [
    "consistent-return-legacy"
  ],
  "rules": {
    "consistent-return-legacy/consistent-return": 2
  }
}

Keywords

eslint

FAQs

Package last updated on 07 Mar 2016

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.