2 * @fileoverview Rule to flag when using constructor for wrapper objects
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
17 description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects",
18 category: "Best Practices",
20 url: "https://eslint.org/docs/rules/no-new-wrappers"
31 const wrapperObjects = ["String", "Number", "Boolean", "Math", "JSON"];
33 if (wrapperObjects.indexOf(node.callee.name) > -1) {
34 context.report({ node, message: "Do not use {{fn}} as a constructor.", data: { fn: node.callee.name } });