DocumentationRulesis-from-react

is-from-react

Full Name in eslint-plugin-react-debug

react-debug/is-from-react

Full Name in @eslint-react/eslint-plugin

@eslint-react/debug/is-from-react

Features

🐞

Presets

  • debug

What it does

Reports all identifiers that are initialized from React. Useful for debugging. This rule should only be used for debugging purposes. Otherwise, leave it off.

Examples

import { useState } from "react";
//       ^^^^^^^^
//       - [initialized from react] name: 'useState', import source: 'react'.
import React from "react";
//     ^^^^^
//     - [initialized from react] name: 'React', import source: 'react'.
 
const Children = React.Children;
//    ^^^^^^^^   ^^^^^ ^^^^^^^^
//    |          |     - [initialized from react] name: 'Children', import source: 'react'.
//    |          - [initialized from react] name: 'React', import source: 'react'.
//    - [initialized from react] name: 'Children', import source: 'react'.
 
const toArray = Children.toArray;
//    ^^^^^^^   ^^^^^^^^ ^^^^^^^
//    |         |        - [initialized from react] name: 'toArray', import source: 'react'.
//    |         - [initialized from react] name: 'Children', import source: 'react'.
//    - [initialized from react] name: 'Children', import source: 'react'.

When settings["react-x"].importSource is set to "@pika/react"

import { useState } from "@pika/react";
//       ^^^^^^^^
//       - [initialized from react] name: 'useState', import source: '@pika/react'.
import React from "@pika/react";
//     ^^^^^
//     - [initialized from react] name: 'React', import source: '@pika/react'.
 
const Children = React.Children;
//    ^^^^^^^^   ^^^^^ ^^^^^^^^
//    |          |     - [initialized from react] name: 'Children', import source: '@pika/react'.
//    |          - [initialized from react] name: 'React', import source: '@pika/react'.
//    - [initialized from react] name: 'Children', import source: '@pika/react'.
 
const toArray = Children.toArray;
//    ^^^^^^^   ^^^^^^^^ ^^^^^^^
//    |         |        - [initialized from react] name: 'toArray', import source: '@pika/react'.
//    |         - [initialized from react] name: 'Children', import source: '@pika/react'.
//    - [initialized from react] name: 'Children', import source: '@pika/react'.

Implementation