Rule: one-line

Requires the specified tokens to be on the same line as the expression preceding them.

Notes:
Has Fixer

Config

Five arguments may be optionally provided:

  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • "check-else" checks that else is on the same line as the closing brace for if.
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • "check-whitespace" checks preceding whitespace for the specified tokens.
Config examples
"one-line": [true, "check-catch", "check-finally", "check-else"]
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "check-catch",
      "check-finally",
      "check-else",
      "check-open-brace",
      "check-whitespace"
    ]
  },
  "minLength": 0,
  "maxLength": 5
}