keyword-spacing
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"keyword-spacing": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
if (foo) {
//...
}else if (bar) {
//...
}else {
//...
}if (foo) {
//...
} else if (bar) {
//...
} else {
//...
}if(foo) {
//...
} else if(bar) {
//...
} else{
//...
}if (foo) {
//...
}else if (bar) {
//...
}else {
//...
}if(foo) {
//...
} else if(bar) {
//...
} else{
//...
}/*eslint keyword-spacing: ["error", { "overrides": {
"if": { "after": false },
"for": { "after": false },
"while": { "after": false },
"static": { "after": false },
"as": { "after": false }
} }]*/
if(foo) {
//...
} else if(bar) {
//...
} else {
//...
}
for(;;);
while(true) {
//...
}
class C {
static{
//...
}
}
export { C as"my class" };Examples from the ESLint documentation.
keyword-spacing
eslint
export default [
{
rules: {
"keyword-spacing": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce consistent spacing before and after keywords in <template>
Disallow the use of alert, confirm, and prompt
Enforce the use of variables within the scope they are defined