Sha256: 00736178ee96bde3385867e88b3ad4155960c4c35501fda0eeba1090f9f8622d

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

/**
 * @fileoverview Rule to flag when using constructor for wrapper objects
 * @author Ilya Volodin
 */

"use strict";

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

module.exports = function(context) {

    return {

        "NewExpression": function(node) {
            var wrapperObjects = ["String", "Number", "Boolean", "Math", "JSON"];
            if (wrapperObjects.indexOf(node.callee.name) > -1) {
                context.report(node, "Do not use {{fn}} as a constructor.", { fn: node.callee.name });
            }
        }
    };

};

module.exports.schema = [];

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eslint_node_modules-1.6.0.1 vendor/node_modules/eslint/lib/rules/no-new-wrappers.js
eslint_node_modules-1.6.0 vendor/node_modules/eslint/lib/rules/no-new-wrappers.js