Skip to content

Commit 7e12fb3

Browse files
committed
refactor: rename no-nested-components rule to no-nested-component-definitions and update related documentation
1 parent c6512b1 commit 7e12fb3

File tree

12 files changed

+72
-62
lines changed

12 files changed

+72
-62
lines changed

apps/website/content/docs/deprecated.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ full: true
88

99
| Rule | Replaced by | Deprecated in |
1010
| :--------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | :------------ |
11-
| [`jsx-no-duplicate-props`](/docs/rules/jsx-no-duplicate-props) | [`no-duplicate-jsx-props`](/docs/rules/no-duplicate-jsx-props) | 1.22.0 |
12-
| [`jsx-uses-vars`](/docs/rules/jsx-uses-vars) | [`use-jsx-vars`](/docs/rules/use-jsx-vars) | 1.22.0 |
1311
| [`ensure-custom-hooks-using-other-hooks`](/docs/rules/hooks-extra-no-useless-custom-hooks) | [`no-useless-custom-hooks`](/docs/rules/hooks-extra-no-useless-custom-hooks) | 1.13.0 |
1412
| [`ensure-forward-ref-using-ref`](/docs/rules/ensure-forward-ref-using-ref) | [`no-useless-forward-ref`](/docs/rules/no-useless-forward-ref) | 1.33.0 |
1513
| [`ensure-use-callback-has-non-empty-deps`](/docs/rules/hooks-extra-ensure-use-callback-has-non-empty-deps) | [`no-unnecessary-use-callback`](/docs/rules/hooks-extra-no-unnecessary-use-callback) | 1.13.0 |
1614
| [`ensure-use-memo-has-non-empty-deps`](/docs/rules/hooks-extra-ensure-use-memo-has-non-empty-deps) | [`no-unnecessary-use-memo`](/docs/rules/hooks-extra-no-unnecessary-use-memo) | 1.13.0 |
15+
| [`jsx-no-duplicate-props`](/docs/rules/jsx-no-duplicate-props) | [`no-duplicate-jsx-props`](/docs/rules/no-duplicate-jsx-props) | 1.22.0 |
16+
| [`jsx-uses-vars`](/docs/rules/jsx-uses-vars) | [`use-jsx-vars`](/docs/rules/use-jsx-vars) | 1.22.0 |
1717
| [`no-children-in-void-dom-elements`](/docs/rules/dom-no-children-in-void-dom-elements) | [`no-void-elements-with-children`](/docs/rules/dom-no-void-elements-with-children) | 1.22.0 |
1818
| [`no-complicated-conditional-rendering`](/docs/rules/no-complicated-conditional-rendering) | [`no-complex-conditional-rendering`](/docs/rules/no-complex-conditional-rendering) | 1.6.0 |
19+
| [`no-nested-components`](/docs/rules/no-nested-components) | [`no-nested-component-definitions`](/docs/rules/no-nested-component-definitions) | 1.34.0 |
1920
| [`no-redundant-custom-hook`](/docs/rules/hooks-extra-no-useless-custom-hooks) | [`no-useless-custom-hooks`](/docs/rules/hooks-extra-no-useless-custom-hooks) | 1.21.0 |
2021

2122
## Presets

apps/website/content/docs/rules/meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"---Core Rules---",
55
"avoid-shorthand-boolean",
66
"avoid-shorthand-fragment",
7-
"no-useless-forward-ref",
87
"no-access-state-in-setstate",
98
"no-array-index-key",
109
"no-children-count",
@@ -32,7 +31,7 @@
3231
"no-missing-component-display-name",
3332
"no-missing-context-display-name",
3433
"no-missing-key",
35-
"no-nested-components",
34+
"no-nested-component-definitions",
3635
"no-prop-types",
3736
"no-redundant-should-component-update",
3837
"no-set-state-in-component-did-mount",
@@ -47,6 +46,7 @@
4746
"no-unused-class-component-members",
4847
"no-unused-state",
4948
"no-use-context",
49+
"no-useless-forward-ref",
5050
"no-useless-fragment",
5151
"prefer-destructuring-assignment",
5252
"prefer-react-namespace-import",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ full: true
4747
| [`no-missing-component-display-name`](./no-missing-component-display-name) | 0️⃣ | `🔍` | Enforces that all components have a `displayName` which can be used in devtools. | |
4848
| [`no-missing-context-display-name`](./no-missing-context-display-name) | 0️⃣ | `🔍` | Enforces that all contexts have a `displayName` which React can use as its `displayName` in devtools. | |
4949
| [`no-missing-key`](./no-missing-key) | 2️⃣ | `🔍` | Prevents missing `key` on items in list rendering. | |
50-
| [`no-nested-components`](./no-nested-components) | 2️⃣ | `🔍` | Prevents nesting component definitions inside other components. | |
50+
| [`no-nested-component-definitions`](./no-nested-component-definitions) | 2️⃣ | `🔍` | Prevents nesting component definitions inside other components. | |
5151
| [`no-prop-types`](./no-prop-types) | 2️⃣ | `🔍` | Prevents using `propTypes` in favor of TypeScript or another type-checking solution. | |
5252
| [`no-redundant-should-component-update`](./no-redundant-should-component-update) | 2️⃣ | `🔍` | Prevents using `shouldComponentUpdate` when extending `React.PureComponent`. | |
5353
| [`no-set-state-in-component-did-mount`](./no-set-state-in-component-did-mount) | 1️⃣ | `🔍` | Prevents calling `this.setState` in `componentDidMount` outside of functions, such as callbacks. | |

apps/website/next.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ const config = {
9494
destination: "/docs/rules/no-useless-forward-ref",
9595
permanent: true,
9696
},
97+
{
98+
source: "/docs/rules/no-nested-components",
99+
destination: "/docs/rules/no-nested-component-definitions",
100+
permanent: true,
101+
},
97102
{
98103
source: "/docs/rules/dom-no-children-in-void-dom-elements",
99104
destination: "/docs/rules/dom-no-void-elements-with-children",

eslint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const GLOB_TEST = [
1616
"**/spec.{ts,tsx,cts,mts}",
1717
"**/test.{ts,tsx,cts,mts}",
1818
];
19-
// const GLOB_YAML = ["*.{yaml,yml}", "**/*.{yaml,yml}"];
19+
2020
const GLOB_CONFIG = ["*.config.{ts,tsx,cts,mts}", "**/*.config.{ts,tsx,cts,mts}"];
2121
const GLOB_SCRIPT = ["scripts/**/*.{ts,cts,mts}"];
2222
const GLOB_IGNORES = [

packages/plugins/eslint-plugin-react-x/src/configs/recommended.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const rules = {
2525
"react-x/no-forward-ref": "warn",
2626
"react-x/no-implicit-key": "warn",
2727
"react-x/no-missing-key": "error",
28-
"react-x/no-nested-components": "error",
28+
"react-x/no-nested-component-definitions": "error",
2929
"react-x/no-prop-types": "error",
3030
"react-x/no-redundant-should-component-update": "error",
3131
"react-x/no-set-state-in-component-did-mount": "warn",

packages/plugins/eslint-plugin-react-x/src/plugin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import noLeakedConditionalRendering from "./rules/no-leaked-conditional-renderin
2828
import noMissingComponentDisplayName from "./rules/no-missing-component-display-name";
2929
import noMissingContextDisplayName from "./rules/no-missing-context-display-name";
3030
import noMissingKey from "./rules/no-missing-key";
31-
import noNestedComponents from "./rules/no-nested-components";
31+
import noNestedComponentDefinitions from "./rules/no-nested-component-definitions";
3232
import noPropTypes from "./rules/no-prop-types";
3333
import noRedundantShouldComponentUpdate from "./rules/no-redundant-should-component-update";
3434
import noSetStateInComponentDidMount from "./rules/no-set-state-in-component-did-mount";
@@ -87,7 +87,7 @@ export const plugin = {
8787
"no-missing-component-display-name": noMissingComponentDisplayName,
8888
"no-missing-context-display-name": noMissingContextDisplayName,
8989
"no-missing-key": noMissingKey,
90-
"no-nested-components": noNestedComponents,
90+
"no-nested-component-definitions": noNestedComponentDefinitions,
9191
"no-prop-types": noPropTypes,
9292
"no-redundant-should-component-update": noRedundantShouldComponentUpdate,
9393
"no-set-state-in-component-did-mount": noSetStateInComponentDidMount,
@@ -120,5 +120,7 @@ export const plugin = {
120120
"jsx-uses-vars": useJsxVars,
121121
/** @deprecated Use `no-complex-conditional-rendering` instead */
122122
"no-complicated-conditional-rendering": noComplexConditionalRendering,
123+
/** @deprecated Use `no-nested-component-definitions` instead */
124+
"no-nested-components-": noNestedComponentDefinitions,
123125
},
124126
} as const;

packages/plugins/eslint-plugin-react-x/src/rules/no-nested-components.md renamed to packages/plugins/eslint-plugin-react-x/src/rules/no-nested-component-definitions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
title: no-nested-components
2+
title: no-nested-component-definitions
33
---
44

55
**Full Name in `eslint-plugin-react-x`**
66

77
```plain copy
8-
react-x/no-nested-components
8+
react-x/no-nested-component-definitions
99
```
1010

1111
**Full Name in `@eslint-react/eslint-plugin`**
1212

1313
```plain copy
14-
@eslint-react/no-nested-components
14+
@eslint-react/no-nested-component-definitions
1515
```
1616

1717
**Features**
@@ -63,8 +63,8 @@ When a child component needs some data from a parent, [pass it by props](https:/
6363

6464
## Implementation
6565

66-
- [Rule source](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x/src/rules/no-nested-components.ts)
67-
- [Test source](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x/src/rules/no-nested-components.spec.ts)
66+
- [Rule source](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x/src/rules/no-nested-component-definitions.ts)
67+
- [Test source](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x/src/rules/no-nested-component-definitions.spec.ts)
6868

6969
## Further Reading
7070

0 commit comments

Comments
 (0)