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.5 to 2.3.0

lib/rules/import-scope.js

12

CHANGELOG.md

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

[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v2.2.5...HEAD
[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v2.3.0...HEAD
## [2.3.0] - 2017-01-16
### Added
- Added rule `import-scope` ([`def5067`][def5067])
### Fixed
- Fixed case in `v3` where `collection-method-value` warns when using `commit` ([`38394d4`][38394d4])
[def5067]: https://github.com/wix/eslint-plugin-lodash/commit/def50672f52a372dd89d219f94deb647faddf0ef
[38394d4]: https://github.com/wix/eslint-plugin-lodash/commit/38394d4c5a32f69a575362a30786b7befd7829d4
[2.3.0]: https://github.com/wix/eslint-plugin-lodash/compare/v2.3.0...v2.2.5
## [2.2.5] - 2016-12-20

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

@@ -18,2 +18,3 @@ 'use strict';

'lodash/identity-shorthand': [2, 'always'],
'lodash/import-scope': [2],
'lodash/matches-prop-shorthand': [2, 'always'],

@@ -57,3 +58,8 @@ 'lodash/matches-shorthand': [2, 'always', 3],

recommended: recommended,
canonical: _.assign({ settings: { lodash: { pragma: '_' } } }, recommended),
canonical: _.defaultsDeep({
settings: { lodash: { pragma: '_' } },
rules: {
'lodash/import-scope': [2, 'full']
}
}, recommended),
v3: {

@@ -73,2 +79,3 @@ settings: {

'lodash/consistent-compose': [2, "flow"],
'lodash/import-scope': [2, 'full'],
'lodash/identity-shorthand': [2, 'always'],

@@ -75,0 +82,0 @@ 'lodash/matches-prop-shorthand': [2, 'always'],

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

var getLodashMethodVisitors = _require.getLodashMethodVisitors;
var isCallToMethod = _require.isCallToMethod;

@@ -46,2 +47,6 @@ var _require2 = require('../util/astUtil');

function isParentCommit(node, callType, version) {
return callType === 'chained' && isCallToMethod(node.parent.parent, version, 'commit');
}
return getLodashMethodVisitors(context, function (node, iteratee, _ref) {

@@ -54,3 +59,3 @@ var method = _ref.method;

context.report(node, 'Use value returned from _.' + method);
} else if (isSideEffectIterationMethod(method, version) && parentUsesValue(node, callType, version)) {
} else if (isSideEffectIterationMethod(method, version) && parentUsesValue(node, callType, version) && !isParentCommit(node, callType, version)) {
context.report(node, 'Do not use value returned from _.' + getMethodName(node));

@@ -57,0 +62,0 @@ }

21

lib/util/LodashContext.js

@@ -7,4 +7,2 @@ 'use strict';

var get = require('lodash/get');
var _require = require('./settingsUtil');

@@ -21,19 +19,10 @@

var _require3 = require('./importUtil');
function getNameFromCjsRequire(init) {
if (get(init, 'callee.name') === 'require' && get(init, 'arguments.length') === 1 && init.arguments[0].type === 'Literal') {
return init.arguments[0].value;
}
}
var getNameFromCjsRequire = _require3.getNameFromCjsRequire;
var isFullLodashImport = _require3.isFullLodashImport;
var getMethodImportFromName = _require3.getMethodImportFromName;
var isFullLodashImport = function isFullLodashImport(str) {
return (/^lodash(-es)?$/.test(str)
);
};
var getMethodImportFromName = function getMethodImportFromName(str) {
var match = /^lodash(-es)?\/(\w+)$/.exec(str);
return match && match[2];
};
/* Class representing lodash data for a given context */
/* Class representing lodash data for a given context */
module.exports = function () {

@@ -40,0 +29,0 @@ /**

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

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

@@ -83,2 +83,3 @@ ESLint-Plugin-Lodash

* [identity-shorthand](docs/rules/identity-shorthand.md): Prefer identity shorthand syntax
* [import-scope](docs/rules/import-scope.md): Prefer a specific import scope (e.g. `lodash/map` vs `lodash`)
* [matches-prop-shorthand](docs/rules/matches-prop-shorthand.md): Prefer matches property shorthand syntax

@@ -85,0 +86,0 @@ * [matches-shorthand](docs/rules/matches-shorthand.md): Prefer matches shorthand syntax

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