Skip to content

Commit 446eb46

Browse files
committed
docs: minor improvements
1 parent c183546 commit 446eb46

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

apps/website/content/docs/rules/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ full: true
2222
| [`avoid-shorthand-fragment`](./avoid-shorthand-fragment) | 0️⃣ | `🔍` | Enforces the use of explicit `<Fragment>` components instead of the shorthand `<>` or `</>` syntax. | |
2323
| [`ensure-forward-ref-using-ref`](./ensure-forward-ref-using-ref) | 1️⃣ | `🔍` | Requires that components wrapped with `forwardRef` must have a `ref` parameter. | |
2424
| [`no-access-state-in-setstate`](./no-access-state-in-setstate) | 2️⃣ | `🔍` | Prevents accessing `this.state` inside `setState` calls. | |
25-
| [`no-array-index-key`](./no-array-index-key) | 1️⃣ | `🔍` | Prevents using array `index` as `key`. | |
25+
| [`no-array-index-key`](./no-array-index-key) | 1️⃣ | `🔍` | Prevents using an item's index in the array as its key | |
2626
| [`no-children-count`](./no-children-count) | 1️⃣ | `🔍` | Prevents using `Children.count`. | |
2727
| [`no-children-for-each`](./no-children-for-each) | 1️⃣ | `🔍` | Prevents using `Children.forEach`. | |
2828
| [`no-children-map`](./no-children-map) | 1️⃣ | `🔍` | Prevents using `Children.map`. | |

packages/plugins/eslint-plugin-react-hooks-extra/src/rules/no-useless-custom-hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function useAuth() {
6666
}
6767
```
6868

69-
Technically, this isn’t enforced by React. In principle, you could make a Hook that doesn’t call other Hooks. This is often confusing and limiting so its best to avoid that pattern. However, there may be rare cases where it is helpful. For example, maybe your function doesn’t use any Hooks right now, but you plan to add some Hook calls to it in the future. Then it makes sense to name it with the `use` prefix:
69+
Technically, this isn’t enforced by React. In principle, you could make a Hook that doesn’t call other Hooks. This is often confusing and limiting so it's best to avoid that pattern. However, there may be rare cases where it is helpful. For example, maybe your function doesn’t use any Hooks right now, but you plan to add some Hook calls to it in the future. Then it makes sense to name it with the `use` prefix:
7070

7171
```tsx
7272
// ✅ Good: A Hook that will likely use some other Hooks later

packages/plugins/eslint-plugin-react-x/src/rules/no-array-index-key.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ react-x/no-array-index-key
2727

2828
## What it does
2929

30-
Warns when an array `index` is used as a `key` prop.
30+
Warns when using an item's index in the array as its key.
3131

3232
The order of items in a list rendering can change over time if an item is inserted, deleted, or the array is reordered. Indexes as keys often lead to subtle and confusing errors.
3333

@@ -47,7 +47,7 @@ function MyComponent({ items }: MyComponentProps) {
4747
<ul>
4848
{items.map((item, index) => (
4949
// ^^^^^
50-
// - Do not use Array index as 'key'.
50+
// - Do not use item index in the array as its key.
5151
<li key={index}>{item.name}</li>
5252
))}
5353
</ul>

packages/plugins/eslint-plugin-react-x/src/rules/no-array-index-key.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ export default createRule<[], MessageID>({
111111
meta: {
112112
type: "problem",
113113
docs: {
114-
description: "disallow using Array index as 'key'",
114+
description: "disallow using an item's index in the array as its key",
115115
[Symbol.for("rule_features")]: RULE_FEATURES,
116116
},
117117
messages: {
118-
noArrayIndexKey: "Do not use Array index as 'key'.",
118+
noArrayIndexKey: "Do not use item index in the array as its key.",
119119
},
120120
schema: [],
121121
},

packages/plugins/eslint-plugin-react-x/src/rules/no-use-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default createRule<[], MessageID>({
4949
}
5050
context.report({
5151
messageId: "noUseContext",
52-
node,
52+
node: node.callee,
5353
fix(fixer) {
5454
switch (node.callee.type) {
5555
case T.Identifier:

packages/shared/docs/functions/defineSettings.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ This allows to specify a custom import location for React when not using the off
148148

149149
`string` = `...`
150150

151-
The identifier thats used for JSX Element creation.
151+
The identifier that's used for JSX Element creation.
152152

153153
**Default**
154154

@@ -160,7 +160,7 @@ The identifier that’s used for JSX Element creation.
160160

161161
`string` = `...`
162162

163-
The identifier thats used for JSX fragment elements.
163+
The identifier that's used for JSX fragment elements.
164164

165165
**Description**
166166

@@ -206,7 +206,7 @@ This can prevent false positives when using a irrelevant third-party library tha
206206

207207
`string` = `...`
208208

209-
React version to use, "detect" means auto detect React version from the projects dependencies.
209+
React version to use, "detect" means auto detect React version from the project's dependencies.
210210
If `importSource` is specified, an equivalent version of React should be provided here.
211211

212212
**Example**
@@ -357,7 +357,7 @@ This allows to specify a custom import location for React when not using the off
357357

358358
> `optional` **jsxPragma**: `string`
359359
360-
The identifier thats used for JSX Element creation.
360+
The identifier that's used for JSX Element creation.
361361

362362
#### Default
363363

@@ -369,7 +369,7 @@ The identifier that’s used for JSX Element creation.
369369

370370
> `optional` **jsxPragmaFrag**: `string`
371371
372-
The identifier thats used for JSX fragment elements.
372+
The identifier that's used for JSX fragment elements.
373373

374374
#### Description
375375

@@ -415,7 +415,7 @@ This can prevent false positives when using a irrelevant third-party library tha
415415

416416
> `optional` **version**: `string`
417417
418-
React version to use, "detect" means auto detect React version from the projects dependencies.
418+
React version to use, "detect" means auto detect React version from the project's dependencies.
419419
If `importSource` is specified, an equivalent version of React should be provided here.
420420

421421
#### Example

packages/shared/docs/variables/DEFAULT_ESLINT_REACT_SETTINGS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This is used to inform the ESLint React plugins how to treat these components du
4848

4949
> `readonly` `optional` **jsxPragma**: `string`
5050
51-
The identifier thats used for JSX Element creation.
51+
The identifier that's used for JSX Element creation.
5252

5353
#### Default
5454

@@ -60,7 +60,7 @@ The identifier that’s used for JSX Element creation.
6060

6161
> `readonly` `optional` **jsxPragmaFrag**: `string`
6262
63-
The identifier thats used for JSX fragment elements.
63+
The identifier that's used for JSX fragment elements.
6464

6565
#### Description
6666

packages/shared/src/schemas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ export const ESLintReactSettingsSchema = object({
9898
*/
9999
importSource: optional(string()),
100100
/**
101-
* The identifier thats used for JSX Element creation.
101+
* The identifier that's used for JSX Element creation.
102102
* @default `"createElement"`
103103
* @deprecated
104104
*/
105105
jsxPragma: optional(string()),
106106
/**
107-
* The identifier thats used for JSX fragment elements.
107+
* The identifier that's used for JSX fragment elements.
108108
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
109109
* @default `"Fragment"`
110110
* @deprecated
@@ -127,7 +127,7 @@ export const ESLintReactSettingsSchema = object({
127127
*/
128128
skipImportCheck: optional(boolean(), true),
129129
/**
130-
* React version to use, "detect" means auto detect React version from the projects dependencies.
130+
* React version to use, "detect" means auto detect React version from the project's dependencies.
131131
* If `importSource` is specified, an equivalent version of React should be provided here.
132132
* @example `"18.3.1"`
133133
* @default `"detect"`

0 commit comments

Comments
 (0)