New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@roadmunk/eslint-plugin-roadmunk-custom

Package Overview
Dependencies
Maintainers
7
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@roadmunk/eslint-plugin-roadmunk-custom - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

10

lib/helper.js

@@ -51,11 +51,11 @@ "use strict";

// If the scope's parent is a BinaryExpression (eg ===) or LogicalExpression (eg &&)
// If the scope's parent is a BinaryExpression (eg ===)
// then wrap the fixedCode in brackets to avoid inadvertently changing the result
// Eg: We don't want to turn `testVar === _.isNull(5)` to `testVar === 5 === null`
// It should be turned into `testVar === (5 === null)`
if (scope.parent.type === 'BinaryExpression' || scope.parent.type === 'LogicalExpression') {
fixedCode = `(${fixedCode})`;
}
if (scope.parent.type === 'BinaryExpression') {
fixedCode = `(${fixedCode})`;
}
return fixer.replaceText(scope, fixedCode);
return fixer.replaceText(scope, fixedCode);
}

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

{
"name": "@roadmunk/eslint-plugin-roadmunk-custom",
"version": "1.0.1",
"version": "1.0.2",
"description": "Plugin to hold custom ESLint rules for Roadmunk",

@@ -5,0 +5,0 @@ "keywords": [

@@ -46,4 +46,5 @@ # eslint-plugin-roadmunk-custom

* Fill in provided rules here
`no-lodash-isundefined` : Prevents usage of `_.isUndefined` method
`no-lodash-isnull` : Prevents usage of `_.isNull` method.

@@ -53,1 +54,2 @@

@@ -11,3 +11,3 @@ /**

const rule = require("../../../lib/rules/no-lodash-isnull");
const rule = require("../../../lib/rules/no-lodash-isnull");
const RuleTester = require("eslint").RuleTester;

@@ -20,4 +20,4 @@

const errors = [{
message : "Use native JavaScript to check for null",
type : "MemberExpression"
message: "Use native JavaScript to check for null",
type: "MemberExpression"
}];

@@ -28,301 +28,374 @@

valid: [
"valid = 5;",
"valid = _.isNil(5);",
"valid = 5 === null;",
"test2 = function(opts) { return _.forEach([1, 2], function(v){ return v + 1}) }",
"test = function() { if(test === 'something'){ return; } }",
"obj = { method1 : function(){} }",
"test = function() { return test ? 1 : 2 }",
"test = true ? 1 : 2",
"test = function(){ var test2 = {}; test2 === null ? 1 : 2 }",
],
valid: [
"valid = 5;",
"valid = _.isNil(5);",
"valid = 5 === null;",
"test2 = function(opts) { return _.forEach([1, 2], function(v){ return v + 1}) }",
"test = function() { if(test === 'something'){ return; } }",
"obj = { method1 : function(){} }",
"test = function() { return test ? 1 : 2 }",
"test = true ? 1 : 2",
"test = function(){ var test2 = {}; test2 === null ? 1 : 2 }",
],
invalid: [
//Simple tests with multiple data types
{
code: "test = _.isNull(5)",
errors,
output : "test = 5 === null",
},
{
code: "test = !!_.isNull(5)",
errors,
output : "test = 5 === null",
},
{
code: "test = !_.isNull(5)",
errors,
output : "test = 5 !== null",
},
{
code: "test = _.isNull(5) ? 1 : 2",
errors,
output: "test = 5 === null ? 1 : 2",
},
{
code: "test = !!_.isNull(5) ? 1 : 2",
errors,
output: "test = 5 === null ? 1 : 2",
},
{
code: "test = !_.isNull(5) ? 1 : 2",
errors,
output: "test = 5 !== null ? 1 : 2",
},
{
code: "test = _.isNull('5')",
errors,
output : "test = '5' === null",
},
{
code: "test = _.isNull('') ? 1 : 2",
errors,
output: "test = '' === null ? 1 : 2",
},
{
code: "test = !_.isNull('') ? 1 : 2",
errors,
output: "test = '' !== null ? 1 : 2",
},
{
code: "test = _.isNull(true)",
errors,
output : "test = true === null",
},
{
code: "test = !_.isNull(true)",
errors,
output : "test = true !== null",
},
{
code: "test = _.isNull(false) ? 1 : 2",
errors,
output: "test = false === null ? 1 : 2",
},
{
code: "test = !!_.isNull(false) ? 1 : 2",
errors,
output: "test = false === null ? 1 : 2",
},
{
code: "test = _.isNull([])",
errors,
output : "test = [] === null",
},
{
code: "test = !_.isNull([])",
errors,
output : "test = [] !== null",
},
{
code: "test = _.isNull([1,2]) ? 1 : 2",
errors,
output: "test = [1,2] === null ? 1 : 2",
},
{
code: "test = !!_.isNull([1,2]) ? 1 : 2",
errors,
output: "test = [1,2] === null ? 1 : 2",
},
{
code: "test = _.isNull(function(){})",
errors,
output : "test = function(){} === null",
},
{
code: "test = !_.isNull(function(){})",
errors,
output : "test = function(){} !== null",
},
{
code: "test = _.isNull(function(){}) ? 1 : 2",
errors,
output: "test = function(){} === null ? 1 : 2",
},
{
code: "test = !!_.isNull(function(){}) ? 1 : 2",
errors,
output: "test = function(){} === null ? 1 : 2",
},
{
code: "test = _.isNull(null)",
errors,
output : "test = null === null",
},
{
code: "test = !_.isNull(null)",
errors,
output : "test = null !== null",
},
{
code: "var condition = null; test = _.isNull(condition) ? 1 : 2",
errors,
output: "var condition = null; test = condition === null ? 1 : 2",
},
{
code: "var condition = null; test = !_.isNull(condition) ? 1 : 2",
errors,
output: "var condition = null; test = condition !== null ? 1 : 2",
},
{
code: "var condition = {}; test = _.isNull(condition) ? 1 : 2",
errors,
output: "var condition = {}; test = condition === null ? 1 : 2",
},
{
code: "var condition = {}; test = !!_.isNull(condition) ? 1 : 2",
errors,
output: "var condition = {}; test = condition === null ? 1 : 2",
},
{
code: "var condition = function(){}; test = _.isNull(condition) ? 1 : 2",
errors,
output: "var condition = function(){}; test = condition === null ? 1 : 2",
},
//Testing object methods
{
code: "obj = { method1 : function(){ _.isNull(5) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ 5 === null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ !!_.isNull(5) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ 5 === null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ !_.isNull(5) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ 5 !== null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ _.isNull('5') ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ '5' === null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ _.isNull([1,2]) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ [1,2] === null ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ _.isNull(this.method1) ? 1 : 2 } }",
errors,
output: "obj = { method1: null, method2 : function(){ this.method1 === null ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ !_.isNull(this.method1) ? 1 : 2 } }",
errors,
output: "obj = { method1: null, method2 : function(){ this.method1 !== null ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ var val = _.isNull(this.method1) ? 1 : 2; var val2 = null; } }",
errors,
output: "obj = { method1: null, method2 : function(){ var val = this.method1 === null ? 1 : 2; var val2 = null; } }",
},
{
code: "obj = { method1: null, method2 : function(){ var val = !!_.isNull(this.method1) ? 1 : 2; var val2 = null; } }",
errors,
output: "obj = { method1: null, method2 : function(){ var val = this.method1 === null ? 1 : 2; var val2 = null; } }",
},
{
code: "obj = { outer : { inner : function(arg){ return _.isNull(arg); } } }",
errors,
output: "obj = { outer : { inner : function(arg){ return arg === null; } } }",
},
//Testing functions
{
code: "test2 = function(opt) { return _.isNull(opt) }",
errors,
output : "test2 = function(opt) { return opt === null }"
},
{
code: "test2 = function() { if(_.isNull(opt)) { return false; } }",
errors,
output: "test2 = function() { if(opt === null) { return false; } }",
},
{
code: "test2 = function() { return function(){ if(_.isNull(opt)) { return false; } } }",
errors,
output: "test2 = function() { return function(){ if(opt === null) { return false; } } }",
},
{
code: "test = function(){ var test2 = {}; _.isNull(test2) ? 1 : 2 }",
errors,
output: "test = function(){ var test2 = {}; test2 === null ? 1 : 2 }"
},
{
code: "test = function(test2){ if(_.isNull(test2)) { return 1 } }",
errors,
output : "test = function(test2){ if(test2 === null) { return 1 } }",
},
{
code: "test = function(){ if(_.isNull([])) { return 1 } }",
errors,
output : "test = function(){ if([] === null) { return 1 } }",
},
// Mixing in logical & binary expressions
{
code: "test = testVar === _.isNull(5)",
errors,
output: "test = testVar === (5 === null)",
},
{
code: "test = testVar !== _.isNull(5)",
errors,
output: "test = testVar !== (5 === null)",
},
{
code: "test = testVar !== !_.isNull(5)",
errors,
output: "test = testVar !== (5 !== null)",
},
{
code: "test = testVar !== !!_.isNull(5)",
errors,
output: "test = testVar !== (5 === null)",
},
{
code: "test = testVar === _.isNull(testVar2)",
errors,
output: "test = testVar === (testVar2 === null)",
},
{
code: "test = _.isNull(5) === testVar",
errors,
output: "test = (5 === null) === testVar",
},
{
code: "test = !_.isNull(5) === testVar",
errors,
output: "test = (5 !== null) === testVar",
},
{
code: "test = !!_.isNull(5) === testVar",
errors,
output: "test = (5 === null) === testVar",
},
{
code : "test4 = _.isNull(5) && 8 ? true : false;",
errors,
output : "test4 = (5 === null) && 8 ? true : false;"
},
{
code : "test4 = 8 && _.isNull(5) ? true : false;",
errors,
output : "test4 = 8 && (5 === null) ? true : false;"
},
//Confirm that if the user stores isNull in a variable, autofix will not be applied
{
code : "test = _.isNull",
errors,
output : "test = _.isNull"
},
{
code : "test = !_.isNull",
errors,
output : "test = !_.isNull"
},
]
invalid: [
//Simple tests with multiple data types
{
code: "test = _.isNull(5)",
errors,
output: "test = 5 === null",
},
{
code: "test = !!_.isNull(5)",
errors,
output: "test = 5 === null",
},
{
code: "test = !_.isNull(5)",
errors,
output: "test = 5 !== null",
},
{
code: "test = _.isNull(5) ? 1 : 2",
errors,
output: "test = 5 === null ? 1 : 2",
},
{
code: "test = !!_.isNull(5) ? 1 : 2",
errors,
output: "test = 5 === null ? 1 : 2",
},
{
code: "test = !_.isNull(5) ? 1 : 2",
errors,
output: "test = 5 !== null ? 1 : 2",
},
{
code: "test = _.isNull('5')",
errors,
output: "test = '5' === null",
},
{
code: "test = _.isNull('') ? 1 : 2",
errors,
output: "test = '' === null ? 1 : 2",
},
{
code: "test = !_.isNull('') ? 1 : 2",
errors,
output: "test = '' !== null ? 1 : 2",
},
{
code: "test = _.isNull(true)",
errors,
output: "test = true === null",
},
{
code: "test = !_.isNull(true)",
errors,
output: "test = true !== null",
},
{
code: "test = _.isNull(false) ? 1 : 2",
errors,
output: "test = false === null ? 1 : 2",
},
{
code: "test = !!_.isNull(false) ? 1 : 2",
errors,
output: "test = false === null ? 1 : 2",
},
{
code: "test = _.isNull([])",
errors,
output: "test = [] === null",
},
{
code: "test = !_.isNull([])",
errors,
output: "test = [] !== null",
},
{
code: "test = _.isNull([1,2]) ? 1 : 2",
errors,
output: "test = [1,2] === null ? 1 : 2",
},
{
code: "test = !!_.isNull([1,2]) ? 1 : 2",
errors,
output: "test = [1,2] === null ? 1 : 2",
},
{
code: "test = _.isNull(function(){})",
errors,
output: "test = function(){} === null",
},
{
code: "test = !_.isNull(function(){})",
errors,
output: "test = function(){} !== null",
},
{
code: "test = _.isNull(function(){}) ? 1 : 2",
errors,
output: "test = function(){} === null ? 1 : 2",
},
{
code: "test = !!_.isNull(function(){}) ? 1 : 2",
errors,
output: "test = function(){} === null ? 1 : 2",
},
{
code: "test = _.isNull(null)",
errors,
output: "test = null === null",
},
{
code: "test = !_.isNull(null)",
errors,
output: "test = null !== null",
},
{
code: "var condition = null; test = _.isNull(condition) ? 1 : 2",
errors,
output: "var condition = null; test = condition === null ? 1 : 2",
},
{
code: "var condition = null; test = !_.isNull(condition) ? 1 : 2",
errors,
output: "var condition = null; test = condition !== null ? 1 : 2",
},
{
code: "var condition = {}; test = _.isNull(condition) ? 1 : 2",
errors,
output: "var condition = {}; test = condition === null ? 1 : 2",
},
{
code: "var condition = {}; test = !!_.isNull(condition) ? 1 : 2",
errors,
output: "var condition = {}; test = condition === null ? 1 : 2",
},
{
code: "var condition = function(){}; test = _.isNull(condition) ? 1 : 2",
errors,
output: "var condition = function(){}; test = condition === null ? 1 : 2",
},
//Testing object methods
{
code: "obj = { method1 : function(){ _.isNull(5) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ 5 === null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ !!_.isNull(5) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ 5 === null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ !_.isNull(5) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ 5 !== null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ _.isNull('5') ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ '5' === null ? 1 : 2 } }",
},
{
code: "obj = { method1 : function(){ _.isNull([1,2]) ? 1 : 2 } }",
errors,
output: "obj = { method1 : function(){ [1,2] === null ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ _.isNull(this.method1) ? 1 : 2 } }",
errors,
output: "obj = { method1: null, method2 : function(){ this.method1 === null ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ !_.isNull(this.method1) ? 1 : 2 } }",
errors,
output: "obj = { method1: null, method2 : function(){ this.method1 !== null ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ var val = _.isNull(this.method1) ? 1 : 2; var val2 = null; } }",
errors,
output: "obj = { method1: null, method2 : function(){ var val = this.method1 === null ? 1 : 2; var val2 = null; } }",
},
{
code: "obj = { method1: null, method2 : function(){ var val = !!_.isNull(this.method1) ? 1 : 2; var val2 = null; } }",
errors,
output: "obj = { method1: null, method2 : function(){ var val = this.method1 === null ? 1 : 2; var val2 = null; } }",
},
{
code: "obj = { outer : { inner : function(arg){ return _.isNull(arg); } } }",
errors,
output: "obj = { outer : { inner : function(arg){ return arg === null; } } }",
},
//Testing functions
{
code: "test2 = function(opt) { return _.isNull(opt) }",
errors,
output: "test2 = function(opt) { return opt === null }"
},
{
code: "test2 = function() { if(_.isNull(opt)) { return false; } }",
errors,
output: "test2 = function() { if(opt === null) { return false; } }",
},
{
code: "test2 = function() { return function(){ if(_.isNull(opt)) { return false; } } }",
errors,
output: "test2 = function() { return function(){ if(opt === null) { return false; } } }",
},
{
code: "test = function(){ var test2 = {}; _.isNull(test2) ? 1 : 2 }",
errors,
output: "test = function(){ var test2 = {}; test2 === null ? 1 : 2 }"
},
{
code: "test = function(test2){ if(_.isNull(test2)) { return 1 } }",
errors,
output: "test = function(test2){ if(test2 === null) { return 1 } }",
},
{
code: "test = function(){ if(_.isNull([])) { return 1 } }",
errors,
output: "test = function(){ if([] === null) { return 1 } }",
},
// Mixing in logical & binary expressions
{
code: "test = testVar === _.isNull(5)",
errors,
output: "test = testVar === (5 === null)",
},
{
code: "test = testVar !== _.isNull(5)",
errors,
output: "test = testVar !== (5 === null)",
},
{
code: "test = testVar !== !_.isNull(5)",
errors,
output: "test = testVar !== (5 !== null)",
},
{
code: "test = testVar !== !!_.isNull(5)",
errors,
output: "test = testVar !== (5 === null)",
},
{
code: "test = testVar === _.isNull(testVar2)",
errors,
output: "test = testVar === (testVar2 === null)",
},
{
code: "test = _.isNull(5) === testVar",
errors,
output: "test = (5 === null) === testVar",
},
{
code: "test = !_.isNull(5) === testVar",
errors,
output: "test = (5 !== null) === testVar",
},
{
code: "test = !!_.isNull(5) === testVar",
errors,
output: "test = (5 === null) === testVar",
},
{
code: "test4 = _.isNull(5) && 8 ? true : false;",
errors,
output: "test4 = 5 === null && 8 ? true : false;"
},
{
code: "test4 = 8 && _.isNull(5) ? true : false;",
errors,
output: "test4 = 8 && 5 === null ? true : false;"
},
//Multiple errors on same line & weird mixes of logical & binary expressions
{
code: "_.isNull(5) === _.isNull(10) && _.isNull(15)",
errors: [
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
}
],
output: "(5 === null) === (10 === null) && 15 === null"
},
{
code: "_.isNull(null) || _.isNull(10) && _.isNull(15)",
errors: [
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
}
],
output: "null === null || 10 === null && 15 === null"
},
{
code: "_.isNull(undefined) || _.isNull(10) && _.isNull(null)",
errors: [
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
}
],
output: "undefined === null || 10 === null && null === null"
},
{
code: "_.isNull(undefined) || _.isNull(null) && _.isNull(10)",
errors: [
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for null",
type: "MemberExpression"
}
],
output: "undefined === null || null === null && 10 === null"
},
//Confirm that if the user stores isNull in a variable, autofix will not be applied
{
code: "test = _.isNull",
errors,
output: "test = _.isNull"
},
{
code: "test = !_.isNull",
errors,
output: "test = !_.isNull"
},
]
});

@@ -91,10 +91,10 @@ /**

{
code: "var condition = null; test = _.isUndefined(condition) ? 1 : 2",
code: "var condition = undefined; test = _.isUndefined(condition) ? 1 : 2",
errors,
output: "var condition = null; test = condition === undefined ? 1 : 2",
output: "var condition = undefined; test = condition === undefined ? 1 : 2",
},
{
code: "var condition = null; test = !_.isUndefined(condition) ? 1 : 2",
code: "var condition = undefined; test = !_.isUndefined(condition) ? 1 : 2",
errors,
output: "var condition = null; test = condition !== undefined ? 1 : 2",
output: "var condition = undefined; test = condition !== undefined ? 1 : 2",
},

@@ -143,20 +143,20 @@ {

{
code: "obj = { method1: null, method2 : function(){ _.isUndefined(this.method1) ? 1 : 2 } }",
code: "obj = { method1: undefined, method2 : function(){ _.isUndefined(this.method1) ? 1 : 2 } }",
errors,
output: "obj = { method1: null, method2 : function(){ this.method1 === undefined ? 1 : 2 } }",
output: "obj = { method1: undefined, method2 : function(){ this.method1 === undefined ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ !_.isUndefined(this.method1) ? 1 : 2 } }",
code: "obj = { method1: undefined, method2 : function(){ !_.isUndefined(this.method1) ? 1 : 2 } }",
errors,
output: "obj = { method1: null, method2 : function(){ this.method1 !== undefined ? 1 : 2 } }",
output: "obj = { method1: undefined, method2 : function(){ this.method1 !== undefined ? 1 : 2 } }",
},
{
code: "obj = { method1: null, method2 : function(){ var val = _.isUndefined(this.method1) ? 1 : 2; var val2 = null; } }",
code: "obj = { method1: undefined, method2 : function(){ var val = _.isUndefined(this.method1) ? 1 : 2; var val2 = undefined; } }",
errors,
output: "obj = { method1: null, method2 : function(){ var val = this.method1 === undefined ? 1 : 2; var val2 = null; } }",
output: "obj = { method1: undefined, method2 : function(){ var val = this.method1 === undefined ? 1 : 2; var val2 = undefined; } }",
},
{
code: "obj = { method1: null, method2 : function(){ var val = !!_.isUndefined(this.method1) ? 1 : 2; var val2 = null; } }",
code: "obj = { method1: undefined, method2 : function(){ var val = !!_.isUndefined(this.method1) ? 1 : 2; var val2 = undefined; } }",
errors,
output: "obj = { method1: null, method2 : function(){ var val = this.method1 === undefined ? 1 : 2; var val2 = null; } }",
output: "obj = { method1: undefined, method2 : function(){ var val = this.method1 === undefined ? 1 : 2; var val2 = undefined; } }",
},

@@ -243,3 +243,3 @@ {

errors,
output : "test4 = (5 === undefined) && 8 ? true : false;"
output : "test4 = 5 === undefined && 8 ? true : false;"
},

@@ -249,4 +249,77 @@ {

errors,
output : "test4 = 8 && (5 === undefined) ? true : false;"
},
output : "test4 = 8 && 5 === undefined ? true : false;"
},
//Multiple errors on same line & weird mixes of logical & binary expressions
{
code: "_.isUndefined(5) === _.isUndefined(10) && _.isUndefined(15)",
errors: [
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
}
],
output: "(5 === undefined) === (10 === undefined) && 15 === undefined"
},
{
code: "_.isUndefined(undefined) || _.isUndefined(10) && _.isUndefined(15)",
errors: [
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
}
],
output: "undefined === undefined || 10 === undefined && 15 === undefined"
},
{
code: "_.isUndefined(undefined) || _.isUndefined(10) && _.isUndefined(undefined)",
errors: [
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
}
],
output: "undefined === undefined || 10 === undefined && undefined === undefined"
},
{
code: "_.isUndefined(undefined) || _.isUndefined(undefined) && _.isUndefined(10)",
errors: [
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
},
{
message: "Use native JavaScript to check for undefined",
type: "MemberExpression"
}
],
output: "undefined === undefined || undefined === undefined && 10 === undefined"
},
//Confirm that if the user stores isUndefined in a variable, autofix will not be applied

@@ -253,0 +326,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