
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
eslint-plugin-underscore
Advanced tools
Forked from eslint-plugin-lodash
Linting rules for Underscore
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
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"]
}
}
each
._.each
.thisArg
over binding._.compact
over _.filter
for only truthy values._.constant
over functions returning literals._.filter
over _.each
with an if
statement inside._.findWhere
over _.find
when using matcher shorthand. (fixable)_.invoke
over _.map
with a method call inside._.map
over _.each
with a push
inside._.matches
over conditions like a.foo === 1 && a.bar === 2 && a.baz === 3
._.noop
over empty functions._.pluck
over _.map
when using property shorthand. (fixable)_.reject
over filter with !(expression)
or x.prop1 !== value
._.times
over _.map
without using the iteratee's arguments._.map
) over native array methods._.is*
methods over typeof
and instanceof
checks when applicable._.where
over _.filter
when using matcher shorthand. (fixable)_(x).map().value()
.value()
or non-chainable methods like max()
..value()
on chains that have already ended (e.g. with max()
or reduce()
)._(str).split(' ')...
_.map
) over native and mixed chains.ESLint-plugin-underscore is licensed under the MIT License.
FAQs
Underscore specific linting rules for ESLint
The npm package eslint-plugin-underscore receives a total of 224 weekly downloads. As such, eslint-plugin-underscore popularity was classified as not popular.
We found that eslint-plugin-underscore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.