element-newline

This rule enforces newlines between tags.

How to use

.eslintrc.js
module.exports = {
  rules: {
    "@html-eslint/element-newline": "error",
  },
};

Rule Details

Examples of incorrect code for this rule:

<html>
  <head><title>newline</title></head>
</html>

Examples of correct code for this rule:

<html>
  <head>
    <title>newline</title>
  </head>
</html>

Options

This rule has an object option:

  1. "skip": skips newline checking for the specified element's children.
//...
"@html-eslint/element-newline": ["error", {
  "skip": Array<string>
}]

skip

You can specify list of tag names in the skip option. Newline checking is not performed on children of the specified tags.

Examples of correct code for the { "skip": ["pre", "code"] } option:

<pre>
    <div></div><div></div>
</pre>
<code>
    <span></span><div></div>
</code>