Rule: no-trailing-spaces in comments
See original GitHub issueWhen trailing spaces are present in comments (illustrated as underscore):
/* eslint no-trailing-spaces: 1 */
// trailing space _
ESLint produces the same warning as for lines of code: Trailing spaces not allowed no-trailing-spaces
I believe this rule should be relaxed for comments, or at least there should be an option to configure this.
<bountysource-plugin>
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 9 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
no-trailing-spaces - ESLint - Pluggable JavaScript Linter
This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines. Examples of incorrect code for this...
Read more >no-trailing-whitespace - Rule
Disallows trailing whitespace at the end of a line. Rationale. Keeps version control diffs clean as it prevents accidental whitespace from being committed....
Read more >Always Getting an Error of "Trailing Spaces not Allowed" in ...
In settings search bar type "trim trailing whitespace"; Underneath check "trim trailing whitespace" option. Restart vscode. Now whenever you ...
Read more >No-trailing-spaces - ESLint - W3cubDocs
This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines. Examples of incorrect code for this...
Read more >ESLint / no-trailing-spaces | Spec-Zone.ru
This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines. Examples of incorrect code for this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d also welcome this. Sometimes I do:
@nzakas Both, I guess… 🤷 I have worked on systems in the past that used Markdown flavored JSDocs. We weren’t using ESLint at the time and it was a custom Ruby-based doc system, IIRC.
I’d be happy with two separate rules, or maybe just an option on
no-trailing-spaces
for “ignore-comments” which defaults totrue
(which would match JSLint/JSHint behavior if I’m understanding @asapach’s https://github.com/eslint/eslint/issues/1229#issuecomment-55011448 correctly). If for some reason I wanted ESLint to tell me that my doc comments had trailing spaces, I could always pref it on using something like:So I can think of places I probably wouldn’t want spaces in doc comments, as well as the use case above where trailing spaces are required (unless you want to manually throw in
tags into your JSDoc comments).
Or not, what do I know. (Spoiler alert: Nothing. I don’t know nothing.)