DocumentationRulesdebug/is-from-react

is-from-react

Rule category

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'.