Blame view
node_modules/eslint/lib/rules/new-parens.js
783 Bytes
c39994410
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
/** * @fileoverview Rule to flag when using constructor without parentheses * @author Ilya Volodin */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { return { "NewExpression": function(node) { var tokens = context.getTokens(node); var prenticesTokens = tokens.filter(function(token) { return token.value === "(" || token.value === ")"; }); if (prenticesTokens.length < 2) { context.report(node, "Missing '()' invoking a constructor"); } } }; }; module.exports.schema = []; |