1 # disallow trailing whitespace at the end of lines (no-trailing-spaces)
3 Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before check-in.
7 This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines.
9 Examples of **incorrect** code for this rule:
12 /*eslint no-trailing-spaces: "error"*/
19 Examples of **correct** code for this rule:
22 /*eslint no-trailing-spaces: "error"*/
30 This rule has an object option:
32 * `"skipBlankLines": false` (default) disallows trailing whitespace on empty lines
33 * `"skipBlankLines": true` allows trailing whitespace on empty lines
34 * `"ignoreComments": false` (default) disallows trailing whitespace in comment blocks
35 * `"ignoreComments": true` allows trailing whitespace in comment blocks
39 Examples of **correct** code for this rule with the `{ "skipBlankLines": true }` option:
42 /*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/
51 Examples of **correct** code for this rule with the `{ "ignoreComments": true }` option:
54 /*eslint no-trailing-spaces: ["error", { "ignoreComments": true }]*/