require-li-container

This rule enforces <li> to be in <ul>, <ol> or <menu>.

Why?

The <li> tag should be contained in a parent element: <ol>, <ul> or <menu>.

How to use

.eslintrc.js
module.exports = {
  rules: {
    "@html-eslint/require-li-container": "error",
  },
};

Rule Details

Examples of incorrect code for this rule:

<div>
  <li>item 1</li>
  <li>item 2</li>
</div>

Examples of correct code for this rule:

<ol>
  <li>item 1</li>
  <li>item 2</li>
</ol>

<ul>
  <li>item 1</li>
  <li>item 2</li>
</ul>

Further Reading

  1. MDN - li