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

eslint-plugin-indexof

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-indexof - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

10

lib/index.js

@@ -10,8 +10,2 @@ /**

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var requireIndex = require("requireindex");
//------------------------------------------------------------------------------
// Plugin Definition

@@ -22,5 +16,7 @@ //------------------------------------------------------------------------------

// import all rules in lib/rules
module.exports.rules = requireIndex("./rules");
module.exports.rules = {
"no-indexof": require("./rules/no-indexof.js")
}

@@ -18,5 +18,9 @@ /**

function isMethodCall(node) {
return !!node.callee.property;
}
return {
CallExpression: function (node) {
if(node.callee.property.name === 'indexOf'){
if(isMethodCall(node) && node.callee.property.name === 'indexOf'){
if(exceptOn.indexOf(node.callee.object.name) < 0) {

@@ -23,0 +27,0 @@ context.report(node, "Unexpected indexOf");

{
"name": "eslint-plugin-indexof",
"version": "0.0.0",
"version": "0.1.0",
"description": "Disallow using the method indexOf",

@@ -10,3 +10,3 @@ "keywords": [

],
"author": "Jordan Eldredge <jordan@jordaneldredge.com>",
"author": "Jordan Eldredge",
"main": "lib/index.js",

@@ -13,0 +13,0 @@ "scripts": {

@@ -26,3 +26,5 @@ /**

"myArray.myMethod(x);",
{ code: "_.indexOf(myArray, x);", options: [{'exceptOn': ['_']}] }
{ code: "_.indexOf(myArray, x);", options: [{'exceptOn': ['_']}] },
"indexOf(x);",
"anotherFunction(x);"
],

@@ -29,0 +31,0 @@ invalid: [ {

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