eslint-plugin-lodash
Advanced tools
Comparing version 1.6.9 to 1.7.0
@@ -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' | ||
} | ||
} | ||
} | ||
}]; |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130007
2577