Rules
jsx-uses-react
Full Name in eslint-plugin-react-x
react-x/jsx-uses-reactFull Name in @eslint-react/eslint-plugin
@eslint-react/jsx-uses-reactPresets
xrecommended
Description
Marks React variables as used when JSX is used.
If you are using the @jsx pragma this rule will mark the designated variable and not the React one.
This rule does nothing when using the New JSX Transform or if the no-unused-vars rule is not enabled.
Examples
Failing
import React from "react";
// nothing to do with React/** @jsx Foo */
import React from "react";
// nothing to do with React
const Hello = <div>Hello</div>;Passing
import React from "react";
const Hello = <div>Hello</div>;/** @jsx Foo */
import Foo from "foo";
const Hello = <div>Hello</div>;Implementation
See Also
jsx-no-undef
Prevents using variables in JSX that are not defined in the scope.jsx-uses-vars
Marks variables used in JSX elements as used.jsx-no-duplicated-props
Disallow duplicate props in JSX elements.