Rules
jsx-uses-vars
Full Name in @eslint-react/eslint-plugin
@eslint-react/jsx-uses-varsFull Name in eslint-plugin-react-x
react-x/jsx-uses-varsPresets
x
recommended
strict
Description
Marks variables used in JSX elements as used.
Since 0.17.0, the ESLint no-unused-vars rule does not detect variables used in JSX (see details). This rule finds variables used in JSX and marks them as used.
This rule only has an effect when the no-unused-vars rule is enabled.
Examples
Failing
import Hello from "./Hello";Passing
import Hello from "./Hello";
<Hello name="John" />;Implementation
See Also
jsx-no-undef
Prevents using variables in JSX that are not defined in the scope.jsx-uses-react
Marks React variables as used when JSX is present.jsx-no-duplicated-props
Disallows duplicate props in JSX elements.