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

eslint-plugin-array-func

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-array-func - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

2

package.json
{
"name": "eslint-plugin-array-func",
"version": "3.1.1",
"version": "3.1.2",
"description": "Rules dealing with Array functions and methods.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -43,2 +43,11 @@ /**

fix(fixer) {
if(reversed === "lastIndexOf" || reversed === "indexOf") {
return [
fixer.insertTextBefore(parent.callee, `${parent.callee.object.name}.length - 1 - `),
fixer.replaceTextRange([
parent.callee.property.start,
node.callee.property.end
], reversed)
];
}
return fixer.replaceTextRange([

@@ -45,0 +54,0 @@ parent.callee.property.start,

@@ -10,3 +10,3 @@ /**

docs: {
description: "Prefer using the flatMap over an immediate .map() call after a .flat().",
description: "Prefer using the flatMap over an immediate .flat() call after a .map().",
recommended: true

@@ -19,3 +19,3 @@ },

return {
'CallExpression[callee.type="MemberExpression"] > MemberExpression[property.name="map"] > CallExpression[callee.type="MemberExpression"][callee.property.name="flat"]'(node) {
'CallExpression[callee.type="MemberExpression"] > MemberExpression[property.name="flat"] > CallExpression[callee.type="MemberExpression"][callee.property.name="map"]'(node) {
const parent = node,

@@ -31,8 +31,14 @@ callee = node.parent;

},
message: "Use flatMap instead of .flat().map()",
message: "Use flatMap instead of .map().flat()",
fix(fixer) {
return fixer.replaceTextRange([
parent.callee.property.start,
node.callee.property.end
], 'flatMap');
return [
fixer.replaceTextRange([
parent.callee.property.start,
parent.callee.property.end
], 'flatMap'),
fixer.removeRange([
callee.object.end,
callee.parent.end
])
];
}

@@ -39,0 +45,0 @@ });

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