Require Parens for Constructors (new-parens)

JavaScript allows the omission of parentheses when invoking a function via the new keyword and the constructor has no arguments. However, some coders believe that omitting the parentheses is inconsistent with the rest of the language and thus makes code less clear.

var person = new Person;

Rule Details

This rule is aimed at highlighting a lack of convention and increasing code clarity by requiring the use of parentheses when invoking a constructor via the new keyword. As such, it will warn when these parentheses are omitted.

The following patterns are considered warnings:

var person = new Person;

The following patterns are not considered warnings:

var person = new Person();

Version

This rule was introduced in ESLint 0.0.6.

Resources