Is there a way to prevent source files starting with a new line

Viewed 23

Using eslint, is it possible to configure a rule to prevent source files starting with a newline?.

Looking around, thought padding-line-between-statements might have been the answer but it does not have a sof / eof option in there :(

1 Answers

Use the rule no-multiple-empty-lines with option maxBOF set to 0, e.g.:

{
  ...
  no-multiple-empty-lines: ["error", { max: 2, maxBOF: 0 }]
  ...
}
Related