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 3.1.0 to 4.0.0

2

lib/rules/prop-shorthand.js

@@ -50,4 +50,4 @@ /**

never: 'Do not use property shorthand syntax'
});
}, 'prop');
}
};

@@ -61,2 +61,6 @@ 'use strict';

self.methods[spec.local.name] = spec.imported.name;
if (spec.imported.name === 'chain') {
self.general[spec.local.name] = true;
}
break;

@@ -83,2 +87,6 @@ }

self.methods[prop.value.name] = prop.key.name;
if (prop.value.name === 'chain') {
self.general[prop.value.name] = true;
}
});

@@ -145,3 +153,3 @@ }

value: function isImplicitChainStart(node) {
return this.pragma && node.callee.name === this.pragma || this.isImportedLodash(node.callee);
return this.pragma && node.callee.name === this.pragma || this.isImportedLodash(node.callee) && node.callee.name !== 'chain';
}

@@ -162,2 +170,14 @@

/**
* Returns whether the node is chain start imported as member, chain()... import { chain } from 'lodash'
* @param node
* @returns {boolean|undefined}
*/
}, {
key: 'isImportedChainStart',
value: function isImportedChainStart(node) {
return node.callee.name === 'chain' && this.isImportedLodash(node.callee);
}
/**
* Returns whether the node is a Lodash chain start, implicit or explicit

@@ -171,3 +191,3 @@ * @param node

value: function isLodashChainStart(node) {
return node && node.type === 'CallExpression' && (this.isImplicitChainStart(node) || this.isExplicitChainStart(node));
return node && node.type === 'CallExpression' && (this.isImplicitChainStart(node) || this.isExplicitChainStart(node) || this.isImportedChainStart(node));
}

@@ -174,0 +194,0 @@

@@ -120,3 +120,3 @@ 'use strict';

function getShorthandVisitors(context, checks, messages) {
function getShorthandVisitors(context, checks, messages, shorthandType) {
var lodashContext = new LodashContext(context);

@@ -129,3 +129,3 @@ var visitors = lodashContext.getImportVisitors();

if (methodDataUtil.methodSupportsShorthand(version, method) && checks.canUseShorthand(iteratee, lodashContext)) {
if (methodDataUtil.methodSupportsShorthand(version, method, shorthandType) && checks.canUseShorthand(iteratee, lodashContext)) {
context.report(iteratee, messages.always);

@@ -132,0 +132,0 @@ }

@@ -1789,5 +1789,7 @@ 'use strict';

wrapper: false,
shorthand: false,
shorthand: {
prop: true
},
chainable: true,
iteratee: false
iteratee: true
},

@@ -1794,0 +1796,0 @@ sortedIndex: {

@@ -71,5 +71,6 @@ 'use strict';

*/
function methodSupportsShorthand(version, method) {
function methodSupportsShorthand(version, method, shorthandType) {
var mainAlias = getMainAlias(version, method);
return _.get(getMethodData(version), [mainAlias, 'shorthand']);
var methodShorthandData = _.get(getMethodData(version), [mainAlias, 'shorthand']);
return _.isBoolean(methodShorthandData) ? methodShorthandData : Boolean(shorthandType && methodShorthandData[shorthandType]);
}

@@ -76,0 +77,0 @@

{
"name": "eslint-plugin-lodash",
"version": "3.1.0",
"version": "4.0.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