Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Jan 25, 2018
Merged

Conversation

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

@jumson FYI

@nfischer nfischer mentioned this pull request Jan 18, 2018
.eslintrc.json Outdated
@@ -23,6 +23,7 @@
"consistent-return": "off",
"no-mixed-operators": "off",
"no-prototype-builtins": "off",
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 } ],
Copy link
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
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
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
@@ -23,6 +23,7 @@
"consistent-return": "off",
"no-mixed-operators": "off",
"no-prototype-builtins": "off",
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 } ],
Copy link
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
Member Author

PTAL

@freitagbr
Copy link
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.

None yet

2 participants