eslint-plugin-isaacscript
Advanced tools
Comparing version 3.12.1 to 3.12.2
@@ -103,3 +103,3 @@ "use strict"; | ||
// Checking for the literal value is fast, so we do that first. | ||
if (node.type === utils_1.AST_NODE_TYPES.Literal && node.value === 0) { | ||
if (isLiteralZero(node)) { | ||
return true; | ||
@@ -113,3 +113,3 @@ } | ||
// Checking for the literal value is fast, so we do that first. | ||
if (node.type === utils_1.AST_NODE_TYPES.Literal && node.raw === '""') { | ||
if (isLiteralEmptyString(node)) { | ||
return true; | ||
@@ -162,3 +162,3 @@ } | ||
isNumber(node.left) && | ||
isZero(node.right)) { | ||
isLiteralZero(node.right)) { | ||
context.report({ | ||
@@ -174,3 +174,3 @@ loc: node.loc, | ||
isString(node.left) && | ||
isEmptyString(node.right)) { | ||
isLiteralEmptyString(node.right)) { | ||
context.report({ | ||
@@ -184,4 +184,4 @@ loc: node.loc, | ||
if (USELESS_OPERATORS_WITH_ZERO.has(node.operator) && | ||
((isNumber(node.left) && isZero(node.right)) || | ||
(isNumber(node.right) && isZero(node.left)))) { | ||
((isNumber(node.left) && isLiteralZero(node.right)) || | ||
(isNumber(node.right) && isLiteralZero(node.left)))) { | ||
context.report({ | ||
@@ -197,4 +197,4 @@ loc: node.loc, | ||
if (node.operator === "+" && | ||
((isString(node.left) && isEmptyString(node.right)) || | ||
(isString(node.right) && isEmptyString(node.left)))) { | ||
((isString(node.left) && isLiteralEmptyString(node.right)) || | ||
(isString(node.right) && isLiteralEmptyString(node.left)))) { | ||
context.report({ | ||
@@ -282,1 +282,7 @@ loc: node.loc, | ||
}); | ||
function isLiteralZero(node) { | ||
return node.type === utils_1.AST_NODE_TYPES.Literal && node.value === 0; | ||
} | ||
function isLiteralEmptyString(node) { | ||
return node.type === utils_1.AST_NODE_TYPES.Literal && node.raw === '""'; | ||
} |
{ | ||
"name": "eslint-plugin-isaacscript", | ||
"version": "3.12.1", | ||
"version": "3.12.2", | ||
"description": "An ESLint plugin that contains useful rules.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
214667
4691