Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-underscore

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-underscore

Underscore specific linting rules for ESLint

  • 0.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
304
decreased by-14.61%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Forked from eslint-plugin-lodash

ESLint-plugin-underscore

Linting rules for Underscore

Installation

Install ESLint either locally or globally.

npm install eslint

If you installed ESLint globally, you have to install the Underscore plugin globally too. Otherwise, install it locally.

$ npm install eslint-plugin-underscore

Configuration

Add plugins section and specify ESLint-plugin-underscore as a plugin.

{
  "plugins": ["underscore"]
}

Finally, enable all of the rules that you would like to use.

{
  "rules": {
    "underscore/collection-return": 2,
    "underscore/identity-shorthand": [2, "always"],
    "underscore/jquery-each": [2, "never"],
    "underscore/jquery-extend": [2, "never"],
    "underscore/jquery-proxy": [2, "never"],
    "underscore/matches-shorthand": [2, "always"],
    "underscore/no-return-value-from-each-iteratee": 2,
    "underscore/no-unnecessary-bind": 2,
    "underscore/prefer-chain": [2, 3],
    "underscore/prefer-compact": 2,
    "underscore/prefer-constant": 2,
    "underscore/prefer-filter": 2,
    "underscore/prefer-findwhere": 2,
    "underscore/prefer-invoke": 2,
    "underscore/prefer-map": 2,
    "underscore/prefer-matches": 2,
    "underscore/prefer-noop": 2,
    "underscore/prefer-pluck": 2,
    "underscore/prefer-reject": 2,
    "underscore/prefer-times": 2,
    "underscore/prefer-underscore-method": 2,
    "underscore/prefer-underscore-typecheck": 2,
    "underscore/prefer-where": 2,
    "underscore/preferred-alias": 2,
    "underscore/prop-shorthand": [2, "always"],

    // The below rules are not (yet) supported
    "underscore/no-single-chain": 2,
    "underscore/unwrap": 2,
    "underscore/no-double-unwrap": 2,
    "underscore/prefer-wrapper-method": 2,
    "underscore/prefer-lodash-chain": 2,
    "underscore/chain-style": [2, "as-needed"]
  }
}

List of supported rules

List of Lodash rules which are not yet supported

  • no-single-chain: Prevent chaining syntax for single method, e.g. _(x).map().value().
  • unwrap: Prevent chaining without evaluation via value() or non-chainable methods like max().
  • no-double-unwrap: Do not use .value() on chains that have already ended (e.g. with max() or reduce()).
  • prefer-wrapper-method: Prefer using array and string methods in the chain and not the initial value, e.g. _(str).split(' ')...
  • prefer-lodash-chain: Prefer using Lodash chains (e.g. _.map) over native and mixed chains.
  • chain-style: Enforce a specific chain style: explicit, implicit, or explicit only when necessary.

License

ESLint-plugin-underscore is licensed under the MIT License.

Keywords

FAQs

Package last updated on 13 Feb 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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc