-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: make the 'debug/is-from-react' rule visible in the documentation
- Loading branch information
Showing
5 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 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 | ||
|
||
```tsx twoslash | ||
import { useState } from "react"; | ||
// ^^^^^^^^ | ||
// - [initialized from react] name: 'useState', importSource: 'react'. | ||
``` | ||
|
||
```tsx twoslash | ||
import React from "react"; | ||
// ^^^^^ | ||
// - [initialized from react] name: 'React', importSource: 'react'. | ||
|
||
const Children = React.Children; | ||
// ^^^^^^^^ ^^^^^ ^^^^^^^^ | ||
// | | - [initialized from react] name: 'Children', importSource: 'react'. | ||
// | - [initialized from react] name: 'React', importSource: 'react'. | ||
// - [initialized from react] name: 'Children', importSource: 'react'. | ||
|
||
const toArray = Children.toArray; | ||
// ^^^^^^^ ^^^^^^^^ ^^^^^^^ | ||
// | | - [initialized from react] name: 'toArray', importSource: 'react'. | ||
// | - [initialized from react] name: 'Children', importSource: 'react'. | ||
// - [initialized from react] name: 'Children', importSource: 'react'. | ||
``` | ||
|
||
### When [`settings["react-x"].importSource`](https://eslint-react.xyz/docs/configuration#importsource) is set to `"@pika/react"` | ||
|
||
```tsx | ||
import { useState } from "@pika/react"; | ||
// ^^^^^^^^ | ||
// - [initialized from react] name: 'useState', importSource: '@pika/react'. | ||
``` | ||
|
||
```tsx twoslash | ||
import React from "@pika/react"; | ||
// ^^^^^ | ||
// - [initialized from react] name: 'React', importSource: '@pika/react'. | ||
|
||
const Children = React.Children; | ||
// ^^^^^^^^ ^^^^^ ^^^^^^^^ | ||
// | | - [initialized from react] name: 'Children', importSource: '@pika/react'. | ||
// | - [initialized from react] name: 'React', importSource: '@pika/react'. | ||
// - [initialized from react] name: 'Children', importSource: '@pika/react'. | ||
|
||
const toArray = Children.toArray; | ||
// ^^^^^^^ ^^^^^^^^ ^^^^^^^ | ||
// | | - [initialized from react] name: 'toArray', importSource: '@pika/react'. | ||
// | - [initialized from react] name: 'Children', importSource: '@pika/react'. | ||
// - [initialized from react] name: 'Children', importSource: '@pika/react'. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters