For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/react/jsx-uses-react.md.
close

jsx-uses-react

Added in v0.3.0

Configuration

PresetConfigured Value
✅ reactPlugin.configs.recommended"error"
rslint.config.ts
import { defineConfig, reactPlugin } from '@rslint/core';

export default defineConfig([
  reactPlugin.configs.recommended,
  {
    rules: {
      'react/jsx-uses-react': 'error',
    },
  },
]);

Rule Details

Prevent React from being incorrectly marked as unused when JSX is used. This rule is a no-op for configuration compatibility because native no-unused-vars handles implicit factory references for classic JSX directly, without requiring type information.

Select classic JSX with settings.react.runtime: "classic" or the project's jsx: "react" compiler option. Configuration precedence is file pragmas, then explicit Rslint settings, then project compiler options, then default factories. File @jsxRuntime overrides the settings runtime; an explicit settings runtime overrides the project's JSX mode in either direction.

Custom factories can be specified with file @jsx / @jsxFrag pragmas, settings.react.pragma / settings.react.fragment, or project jsxFactory / jsxFragmentFactory, in that order. A factory or fragment declaration alone selects classic JSX only when no explicit runtime has been selected. Automatic JSX does not use the classic factories, even if those factories remain configured. A fragment factory is read only for shorthand fragments. File pragmas follow TypeScript's leading block-comment syntax.

Enabling this rule alone does not select classic JSX.

Original Documentation