BTC
BTC

Reputation: 4072

How would I insure NO newline in ESLint

From ESLint:

http://eslint.org/docs/rules/eol-last.html

You can disable a check verifying that each file has a newline trailing. However, there does not appear to be an equal/opposite rule. How would I insure that my files have no newline at the end using ESLint? Is this possible?

Upvotes: 2

Views: 8251

Answers (2)

Manohar Reddy Poreddy
Manohar Reddy Poreddy

Reputation: 27465

Related

1

Below settings for no empty lines at all
is not good:

'no-multiple-empty-lines':['error',{ max:0 }],

2

But below 1 line
looks better:

'no-multiple-empty-lines':['error',{ max:1 }],

For more options:

See https://eslint.org/docs/latest/rules/no-multiple-empty-lines

Upvotes: 0

Matthew Herbst
Matthew Herbst

Reputation: 32003

You should be able to use the rule no-multiple-empty-lines.

"no-multiple-empty-lines": [2, {"max": 99999, "maxEOF": 0}]

max sets the maximum number of consecutive blank lines.

maxEOF can be used to set a different number for the end of file. The last blank lines will then be treated differently. If omitted, the max option is applied everywhere.

Assuming you don't care about the number of empty lines between code, just set max to a high number.

Upvotes: 5

Related Questions