目录

@typescript-eslint/keyword-spacing

Enforce consistent spacing before and after keywords.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/keyword-spacing": "error"
  }
}

Options

For details, see @typescript-eslint/keyword-spacing.

Example of Correct Code

function isSatisfy1(): boolean {
  return true;
}

function isSatisfy2(): boolean {
  return false;
}
// By default, at least one space is required before and after keywords.
if (isSatisfy1()) {
  //...
} else if (isSatisfy2()) {
  //...
} else {
  //...
}

Example of Incorrect Code

function isSatisfy1(): boolean {
  return true;
}

function isSatisfy2(): boolean {
  return false;
}
// By default, at least one space is required before and after keywords.
if (isSatisfy1()) {
  //...
}else if(isSatisfy2()) {
  //...
}else{
  //...
}

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.