Enforces consistent spacing after keywords.
Some style guides will require or disallow spaces following the certain keywords.
if (condition) {
doSomething();
} else {
doSomethingElse();
}
if(condition) {
doSomething();
}else{
doSomethingElse();
}
This rule will enforce consistency of spacing after the keywords if, else, for, while, do, switch, try, catch, finally, and with.
This rule takes one argument. If it is "always" then the keywords must be followed by at least one space. If "never" then there should be no spaces following. The default is "always".
Examples of incorrect code for this rule:
if(a) {}
if (a) {} else{}
do{} while (a);
if (a) {}
Examples of correct code for this rule:
if (a) {}
if (a) {} else {}
if(a) {}
This rule was introduced in ESLint v0.6.0 and removed in v2.0.0-beta.3.
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/rules/space-after-keywords