Rule: no-trailing-whitespace

Disallows trailing whitespace at the end of a line.

Rationale

Keeps version control diffs clean as it prevents accidental whitespace from being committed.

Notes:
Has Fixer

Config

Possible settings are:

  • "ignore-template-strings": Allows trailing whitespace in template strings.
  • "ignore-comments": Allows trailing whitespace in comments.
  • "ignore-jsdoc": Allows trailing whitespace only in JSDoc comments.
  • "ignore-blank-lines": Allows trailing whitespace on empty lines.
Config examples
"no-trailing-whitespace": true
"no-trailing-whitespace": [true, "ignore-comments"]
"no-trailing-whitespace": [true, "ignore-jsdoc"]
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "ignore-comments",
      "ignore-jsdoc",
      "ignore-template-strings",
      "ignore-blank-lines"
    ]
  }
}