Skip to content

Commit

Permalink
Revert "Refactor implicit coercion check in no-implicit-coercion rule"
Browse files Browse the repository at this point in the history
This reverts commit e0c8555.
  • Loading branch information
gurgunday committed Dec 26, 2023
1 parent 2a9b163 commit ef0ed3e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rules/no-implicit-coercion.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ module.exports = {
// -(-foo)
operatorAllowed = options.allow.includes("- -");
if (!operatorAllowed && options.number && node.operator === "-" && node.argument.type === "UnaryExpression" && node.argument.operator === "-" && !isNumeric(node.argument.argument)) {
report(node);
const recommendation = `Number(${sourceCode.getText(node.argument.argument)})`;

report(node, recommendation, true);
}
},

Expand Down

0 comments on commit ef0ed3e

Please sign in to comment.