eslint-plugin-validate-jsx-nesting
ESLint plugin to validate JSX nesting at compile time
When browsers encounter invalid nesting like <p> inside <p>, they silently fix the DOM structure - causing mismatches between your JSX and the actual DOM. This ESLint plugin catches these errors in your editor as you type. It works with any framework that uses JSX.
Markup
Browser modifies it to this:
This plugin catches these errors in your editor:
Setup
Install the eslint-plugin-validate-jsx-nesting package, add it to the plugins section of your ESLint configuration file, and enable thevalidate-jsx-nesting/no-invalid-jsx-nesting rule in the rules section.