Search code examples
eslinttypescript-eslint

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


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 :(


Solution

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

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