Skip to content

Commit

Permalink
Remove Math and JSON from no-new-wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Mar 24, 2020
1 parent ca3572f commit 792f8a3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-new-wrappers.js
Expand Up @@ -32,7 +32,7 @@ module.exports = {
return {

NewExpression(node) {
const wrapperObjects = ["String", "Number", "Boolean", "Math", "JSON"];
const wrapperObjects = ["String", "Number", "Boolean"];

if (wrapperObjects.indexOf(node.callee.name) > -1) {
context.report({
Expand Down
20 changes: 0 additions & 20 deletions tests/lib/rules/no-new-wrappers.js
Expand Up @@ -53,26 +53,6 @@ ruleTester.run("no-new-wrappers", rule, {
},
type: "NewExpression"
}]
},
{
code: "var a = new Math();",
errors: [{
messageId: "noConstructor",
data: {
fn: "Math"
},
type: "NewExpression"
}]
},
{
code: "var a = new JSON({ myProp: 10 });",
errors: [{
messageId: "noConstructor",
data: {
fn: "JSON"
},
type: "NewExpression"
}]
}
]
});

0 comments on commit 792f8a3

Please sign in to comment.