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

eslint-plugin-lodash

Package Overview
Dependencies
Maintainers
3
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-lodash - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

9

CHANGELOG.md

@@ -11,4 +11,11 @@ # Change Log

[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v2.2.0...HEAD
[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v2.2.1...HEAD
## [2.2.1] - 2016-11-30
### Fixed
- Fixed crash in `chaining` rule. ([`ccdae5`][ccdae5])
[ccdae5]: https://github.com/wix/eslint-plugin-lodash/commit/ccdae593a9e91b8300890cc31a10d3bdd73c05b7
[2.2.1]: https://github.com/wix/eslint-plugin-lodash/compare/v2.2.1...v2.2.0
## [2.2.0] - 2016-11-09

@@ -15,0 +22,0 @@ ### Added

2

lib/rules/chaining.js

@@ -60,3 +60,3 @@ /**

if (isNestedNLevels(node, ruleDepth)) {
context.report(getCaller(node.arguments[0]), 'Prefer chaining to composition');
context.report(node, 'Prefer chaining to composition');
} else if (lodashContext.isLodashChainStart(node)) {

@@ -63,0 +63,0 @@ var firstCall = node.parent.parent;

@@ -9,9 +9,6 @@ 'use strict';

var _methodDataByVersion = {};
var _shorthandMethodsByVersion = {};
var _expandedAliasesByVersion = {};
function getMethodData(version) {
_methodDataByVersion[version] = _methodDataByVersion[version] || require('./methodDataByVersion/' + version);
return _methodDataByVersion[version];
}
var getMethodData = _.memoize(function (version) {
return require('./methodDataByVersion/' + version);
});
/**

@@ -23,15 +20,14 @@ * Gets a major version number and method name and returns all its aliases including itself.

*/
function expandAlias(version, method) {
if (!_.get(_expandedAliasesByVersion, [version, method])) {
var methodData = getMethodData(version);
var aliases = _.keys(_.pickBy(methodData.aliases, function (x) {
return x === method;
}));
var wrapperAliases = _.keys(_.pickBy(methodData.wrapperAliases, function (x) {
return x === method;
}));
_.set(_expandedAliasesByVersion, [version, method], [method].concat(_toConsumableArray(aliases), _toConsumableArray(wrapperAliases)));
}
return _expandedAliasesByVersion[version][method];
}
var expandAlias = _.memoize(function (version, method) {
var methodData = getMethodData(version);
var aliases = _.keys(_.pickBy(methodData.aliases, function (x) {
return x === method;
}));
var wrapperAliases = _.keys(_.pickBy(methodData.wrapperAliases, function (x) {
return x === method;
}));
return [method].concat(_toConsumableArray(aliases), _toConsumableArray(wrapperAliases));
}, function (version, method) {
return version + '-' + method;
});

@@ -76,9 +72,13 @@ /**

/**
* Gets a list of methods that support all shorthands per version
* Gets a lookup table of methods that support all shorthands per version
* @param {Number} version
* @returns {[string]}
* @returns {object}
*/
function getShorthandMethods(version) {
return expandAliases(version, getMethodData(version).shorthand);
}
var getShorthandMethodsLookup = _.memoize(function (version) {
var methods = expandAliases(version, getMethodData(version).shorthand);
return _.reduce(methods, function (obj, key) {
return _.assign(obj, _defineProperty({}, key, true));
}, {});
});
/**

@@ -91,9 +91,3 @@ * Returns whether the node's method call supports using shorthands in the specified version

function methodSupportsShorthand(version, method) {
if (!_shorthandMethodsByVersion[version]) {
var methods = getShorthandMethods(version);
_shorthandMethodsByVersion[version] = _.reduce(methods, function (obj, key) {
return _.assign(obj, _defineProperty({}, key, true));
}, {});
}
return _shorthandMethodsByVersion[version][method];
return getShorthandMethodsLookup(version)[method];
}

@@ -174,3 +168,2 @@

getChainableAliases: getChainableAliases,
getShorthandMethods: getShorthandMethods,
methodSupportsShorthand: methodSupportsShorthand,

@@ -177,0 +170,0 @@ getWrapperMethods: getWrapperMethods,

{
"name": "eslint-plugin-lodash",
"version": "2.2.0",
"version": "2.2.1",
"author": "Omer Ganim <ganimomer@gmail.com>",

@@ -8,3 +8,3 @@ "description": "Lodash specific linting rules for ESLint",

"scripts": {
"coveralls": "cat ./reports/coverage/lcov.info | coveralls",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint ./",

@@ -11,0 +11,0 @@ "test": "npm run lint && npm run unit-test",

ESLint-Plugin-Lodash
===================
[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Dependencies][deps-image]][deps-url]
[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Dependencies][deps-image]][deps-url] [![Build Status][build-image]][build-url]

@@ -130,1 +130,4 @@ Lodash-specific linting rules for ESLint.

[status-image]: http://img.shields.io/badge/status-maintained-brightgreen.svg?style=flat-square
[build-image]: https://travis-ci.org/wix/eslint-plugin-lodash.svg?branch=master
[build-url]: https://travis-ci.org/wix/eslint-plugin-lodash
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