Skip to content

chore(lint): don't allow excess trailing newlines#816

Merged
nfischer merged 2 commits intomasterfrom
chore-eslint-eol
Jan 25, 2018
Merged

chore(lint): don't allow excess trailing newlines#816
nfischer merged 2 commits intomasterfrom
chore-eslint-eol

Conversation

@nfischer
Copy link
Copy Markdown
Member

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.

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.
@nfischer
Copy link
Copy Markdown
Member Author

@jumson FYI

@nfischer nfischer mentioned this pull request 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 } ],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freitagbr We can also make "max": 1, but that involves changing:

shelljs/src/tempdir.js

Lines 25 to 29 in 902e49c

}
//@
//@ ### tempdir()

and

shelljs/src/test.js

Lines 17 to 21 in 902e49c

});
//@
//@ ### test(expression)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 lines max is fine. "maxBOF": 0 should be added.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

.eslintrc.json Outdated
"consistent-return": "off",
"no-mixed-operators": "off",
"no-prototype-builtins": "off",
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 } ],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 lines max is fine. "maxBOF": 0 should be added.

@nfischer
Copy link
Copy Markdown
Member Author

PTAL

@freitagbr
Copy link
Copy Markdown
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants