ESLint plugin to disallow spaces after the left side of a call or new expression.
In order to disallow spaces between a function name (or an expression evaluating to a function) and
the parentheses that invoke it, ESLint offers the rule
func-call-spacing with the option
Anyway, this setting also disallows newlines and spaces around comments when they are found between
a function name and the left parenthesis.
eslint-plugin-no-spaces-in-call-expression provides the rule
disallow spaces in call or new expressions while still allowing newlines and comments.
This rule was designed as a replacement for the JSCS rule
disallowSpacesInCallExpression which has a
Install ESLint and
$ npm i --save-dev eslint eslint-plugin-no-spaces-in-call-expression
If you installed ESLint globally (using the
-g flag) then you must also install plugins globally:
$ npm i -g eslint-plugin-no-spaces-in-call-expression
"no-spaces-in-call-expression" to the plugins section of your
.eslintrc configuration file.
You can omit the
Then configure the
no-spaces-in-call-expression rule under the
no-spaces-in-call-expression disallows spaces in call or new expressions while still
allowing newlines and comments.
Examples of incorrect code for this rule:
/* eslint no-spaces-in-call-expression/no-spaces-in-call-expression: "error" */;
Examples of correct code for this rule:
/* eslint no-spaces-in-call-expression/no-spaces-in-call-expression: "error" */;fn'foo''bar''baz';fn /* spaces around comments are fine */ ;fn // this is fine, too;