chore(lint): don't allow excess trailing newlines#816
Merged
Conversation
This enforces that files should not end with blank lines (i.e. more than one trailing newline). The `eol-last` rule (inherited from airbnb's config) already enforces that files end in at least one trailing newline, so adding this rule enforces that it ends in exactly 1. See https://eslint.org/docs/rules/no-multiple-empty-lines and https://eslint.org/docs/rules/eol-last for more information. Inspired by #809.
Member
Author
|
@jumson FYI |
Closed
nfischer
commented
Jan 18, 2018
.eslintrc.json
Outdated
| "consistent-return": "off", | ||
| "no-mixed-operators": "off", | ||
| "no-prototype-builtins": "off", | ||
| "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 } ], |
Member
Author
There was a problem hiding this comment.
@freitagbr We can also make "max": 1, but that involves changing:
Lines 25 to 29 in 902e49c
and
Lines 17 to 21 in 902e49c
Contributor
There was a problem hiding this comment.
2 lines max is fine. "maxBOF": 0 should be added.
freitagbr
requested changes
Jan 25, 2018
.eslintrc.json
Outdated
| "consistent-return": "off", | ||
| "no-mixed-operators": "off", | ||
| "no-prototype-builtins": "off", | ||
| "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 } ], |
Contributor
There was a problem hiding this comment.
2 lines max is fine. "maxBOF": 0 should be added.
Member
Author
|
PTAL |
freitagbr
approved these changes
Jan 25, 2018
Contributor
|
LGTM |
This was referenced Nov 29, 2019
This was referenced Mar 24, 2020
This was referenced Apr 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enforces that files should not end with blank lines (i.e. more than
one trailing newline). The
eol-lastrule (inherited from airbnb'sconfig) already enforces that files end in at least one trailing
newline, so adding this rule enforces that it ends in exactly 1.
See https://eslint.org/docs/rules/no-multiple-empty-lines and
https://eslint.org/docs/rules/eol-last for more information.
Inspired by #809.