DocumentationRulesprefer-react-namespace-import

prefer-react-namespace-import

Full Name in eslint-plugin-react-x

react-x/prefer-react-namespace-import

Full Name in @eslint-react/eslint-plugin

@eslint-react/prefer-react-namespace-import

Features

🔍 🔧

What it does

Enforces React is imported via a namespace import.

Examples

Failing

import React from "react";
 
import type React from "react";
 
import React, { useState } from "react";
 
import type React, { useState } from "react";

Passing

import * as React from "react";
 
import type * as React from "react";
 
import { useState } from "react";
 
import type { useState } from "react";