void-dom-elements-no-children
Configuration
rslint.config.ts
Rule Details
Prevent void DOM elements (e.g. <img />, <br />, <hr />) from receiving children. Void elements are HTML elements that cannot have any content. Passing children or dangerouslySetInnerHTML to these elements is a mistake.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Limitations
- Detects
<pragma>.createElement(...)where<pragma>defaults toReactand can be overridden viasettings.react.pragma. DestructuredcreateElement(e.g.import { createElement } from 'react') and@jsxcomment pragmas are not supported.