Search code examples
reactjsphpstormwebstormjetbrains-ide

PhpStorm running HTML inspection on React/JSX component


I have the "Missing required 'title' element" inspection enabled under Editor > Inspections > HTML > Accessibility.

However, PhpStorm (currently on v2021.2) doesn't seem to know the difference between a React element (<Head />) and a regular HTML element (<head></head>) in this case:

enter image description here

This is inside of a .tsx file. Is there a way to ensure this inspection only runs on actual HTML elements instead of React elements?


Solution

  • Please follow WEB-52091 for updates. For now, I can only suggest suppressing the inspection for file by adding

    // noinspection HtmlRequiredTitleElement
    

    at the top of it;

    Or, you can create a custom scope in Settings | Appearance & Behavior | Scopes with only .html files included and specify this scope for HTML | Accessibility | Missing required 'title' element inspection