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 1.6.9 to 1.7.0

12

CHANGELOG.md

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

[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v1.6.9...HEAD
[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v1.7.0...HEAD
## [1.7.0] - 2016-04-21
### Added
- Added option `ignoreObjects` to options object of `prefer-lodash-method` ([`3fc85bd`][3fc85bd])
### Fixed
- Fixed false positive reporting of `no-extra-args` when a lodash chain was within a non-lodash chain. ([`de02121`][de02121])
[3fc85bd]: https://github.com/wix/eslint-plugin-lodash/commit/3fc85bdd3f499bd59d9d6e9f667ee7264a76bf14
[de02121]: https://github.com/wix/eslint-plugin-lodash/commit/de021216e8a8d5e91f62654deefebd20f0263299
[1.7.0]: https://github.com/wix/eslint-plugin-lodash/compare/v1.7.0...v1.6.9
## [1.6.9] - 2016-04-19

@@ -15,0 +25,0 @@ ### Fixed

@@ -17,2 +17,3 @@ /**

var exceptions = _.get(context, ['options', 0, 'except'], []);
var ignoredObjects = _.get(context, ['options', 0, 'ignoreObjects'], []);

@@ -36,4 +37,9 @@ function isStaticNativeMethodCall(node) {

function isIgnoredObject(node) {
var caller = astUtil.getCaller(node);
return caller && caller.type === 'Identifier' && _.includes(ignoredObjects, caller.name);
}
function isRuleException(node) {
return _.includes(exceptions, astUtil.getMethodName(node));
return _.includes(exceptions, astUtil.getMethodName(node)) || _.includes(ignoredObjects, astUtil.getCallerName);
}

@@ -43,3 +49,3 @@

CallExpression: function CallExpression(node) {
if (!isRuleException(node) && canUseLodash(node) && !isUsingLodash(node)) {
if (!isRuleException(node) && !isIgnoredObject(node) && canUseLodash(node) && !isUsingLodash(node)) {
context.report(node, REPORT_MESSAGE, { method: astUtil.getMethodName(node) });

@@ -59,4 +65,10 @@ }

}
},
ignoreObjects: {
type: 'array',
items: {
type: 'string'
}
}
}
}];

4

lib/util/lodashUtil.js

@@ -177,6 +177,8 @@ 'use strict';

if (isLodashChainStart(node, settings.pragma)) {
var prevNode = node;
node = node.parent.parent;
while (astUtil.isMethodCall(node) && !isChainBreaker(node, settings.version)) {
while (astUtil.getCaller(node) === prevNode && astUtil.isMethodCall(node) && !isChainBreaker(node, settings.version)) {
iterateeIndex = methodDataUtil.getIterateeIndex(settings.version, astUtil.getMethodName(node));
reporter(node, node.arguments[iterateeIndex - 1]);
prevNode = node;
node = node.parent.parent;

@@ -183,0 +185,0 @@ }

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

@@ -5,0 +5,0 @@ "description": "Lodash specific linting rules for ESLint",

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