Require or disallow spacing between function identifiers and their invocations
Some problems reported by this rule are automatically fixable by the --fix
command line option
When calling a function, developers may insert optional whitespace between the function’s name and the parentheses that invoke it. The following pairs of function calls are equivalent:
This rule requires or disallows spaces between the function name and the opening parenthesis that calls it.
This rule has a string option:
"never"
(default) disallows space between the function name and the opening parenthesis."always"
requires space between the function name and the opening parenthesis.Further, in "always"
mode, a second object option is available that contains a single boolean allowNewlines
property.
Examples of incorrect code for this rule with the default "never"
option:
Examples of correct code for this rule with the default "never"
option:
Examples of incorrect code for this rule with the "always"
option:
Examples of correct code for this rule with the "always"
option:
By default, "always"
does not allow newlines. To permit newlines when in "always"
mode, set the allowNewlines
option to true
. Newlines are never required.
Examples of incorrect code for this rule with allowNewlines
option enabled:
Examples of correct code for this rule with the allowNewlines
option enabled:
This rule can safely be turned off if your project does not care about enforcing a consistent style for spacing within function calls.
This rule was introduced in ESLint v3.3.0.
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/rules/func-call-spacing