Skip to content

Commit 665af13

Browse files
committed
Rename component kinds
1 parent 1d14f23 commit 665af13

26 files changed

Lines changed: 89 additions & 40 deletions

packages/core/docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
| ------ | ------ |
3030
| [ComponentDetectionHint](type-aliases/ComponentDetectionHint.md) | - |
3131
| [ComponentFlag](type-aliases/ComponentFlag.md) | - |
32-
| [ComponentKind](type-aliases/ComponentKind.md) | Represents the kind of a React component |
32+
| [ComponentKind](type-aliases/ComponentKind.md) | Represents the kind of a React function |
3333
| [ComponentSemanticNode](type-aliases/ComponentSemanticNode.md) | Represents a React Component |
3434
| [FindEnclosingComponentOrHookFilter](type-aliases/FindEnclosingComponentOrHookFilter.md) | - |
3535
| [FunctionSemanticNode](type-aliases/FunctionSemanticNode.md) | Represents a React Function |

packages/core/docs/interfaces/ClassComponentSemanticNode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Represents a React Class Component
1717
| <a id="hint"></a> `hint` | `bigint` | Hint for how the component was detected | [`SemanticNode`](SemanticNode.md).[`hint`](SemanticNode.md#hint) | - |
1818
| <a id="id"></a> `id` | `BindingName` \| `undefined` | The identifier of the component | [`SemanticNode`](SemanticNode.md).[`id`](SemanticNode.md#id) | - |
1919
| <a id="key"></a> `key` | `string` | - | - | [`SemanticNode`](SemanticNode.md).[`key`](SemanticNode.md#key) |
20-
| <a id="kind"></a> `kind` | `"class"` | The kind of component | [`SemanticNode`](SemanticNode.md).[`kind`](SemanticNode.md#kind) | - |
20+
| <a id="kind"></a> `kind` | `"class-component"` | The kind of component | [`SemanticNode`](SemanticNode.md).[`kind`](SemanticNode.md#kind) | - |
2121
| <a id="methods"></a> `methods` | `TSESTreeMethodOrProperty`[] | List of methods and properties in the class | - | - |
2222
| <a id="name"></a> `name` | `string` \| `undefined` | - | - | [`SemanticNode`](SemanticNode.md).[`name`](SemanticNode.md#name) |
2323
| <a id="node"></a> `node` | `TSESTreeClass` | The AST node of the class | [`SemanticNode`](SemanticNode.md).[`node`](SemanticNode.md#node) | - |

packages/core/docs/interfaces/FunctionComponentSemanticNode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Represents a React Function Component
2222
| <a id="isexportdefault"></a> `isExportDefault` | `boolean` | Indicates if the component is inside an export default declaration | - | - |
2323
| <a id="isexportdefaultdeclaration"></a> `isExportDefaultDeclaration` | `boolean` | Indicates if the component is itself an export default declaration | - | - |
2424
| <a id="key"></a> `key` | `string` | - | - | [`SemanticNode`](SemanticNode.md).[`key`](SemanticNode.md#key) |
25-
| <a id="kind"></a> `kind` | `"function"` | The kind of component | [`SemanticNode`](SemanticNode.md).[`kind`](SemanticNode.md#kind) | - |
25+
| <a id="kind"></a> `kind` | `"function-component"` | The kind of component | [`SemanticNode`](SemanticNode.md).[`kind`](SemanticNode.md#kind) | - |
2626
| <a id="name"></a> `name` | `string` \| `undefined` | - | - | [`SemanticNode`](SemanticNode.md).[`name`](SemanticNode.md#name) |
2727
| <a id="node"></a> `node` | `TSESTreeFunction` | The AST node of the function | [`SemanticNode`](SemanticNode.md).[`node`](SemanticNode.md#node) | - |
2828
| <a id="rets"></a> `rets` | (`Expression` \| `null`)[] | List of expressions returned by the component | - | - |

packages/core/docs/type-aliases/ComponentKind.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Type Alias: ComponentKind
44

55
```ts
6-
type ComponentKind = "classComponent" | "functionComponent";
6+
type ComponentKind = "client-function" | "server-function";
77
```
88

9-
Represents the kind of a React component
9+
Represents the kind of a React function

packages/core/src/component/component-collector-legacy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function useComponentCollectorLegacy(context: RuleContext): useComponentC
5050
{
5151
id,
5252
key,
53-
kind: "class",
53+
kind: "class-component",
5454
name,
5555
node,
5656
// TODO: Get displayName of class component

packages/core/src/component/component-collector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function useComponentCollector(
6969
const entry = {
7070
id: getFunctionComponentId(context, node),
7171
key,
72-
kind: "function",
72+
kind: "function-component",
7373
name,
7474
node,
7575
directives,

packages/core/src/component/component-kind.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/core/src/component/component-semantic-node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface FunctionComponentSemanticNode extends SemanticNode {
2020
/**
2121
* The kind of component
2222
*/
23-
kind: "function";
23+
kind: "function-component";
2424

2525
/**
2626
* The AST node of the function
@@ -91,7 +91,7 @@ export interface ClassComponentSemanticNode extends SemanticNode {
9191
/**
9292
* The kind of component
9393
*/
94-
kind: "class";
94+
kind: "class-component";
9595

9696
/**
9797
* The AST node of the class

packages/core/src/component/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export * from "./component-flag";
66
export * from "./component-id";
77
export * from "./component-init-path";
88
export * from "./component-is";
9-
export type * from "./component-kind";
109
export * from "./component-method-callback";
1110
export * from "./component-method-is";
1211
export * from "./component-name";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Represents the kind of a React function
3+
*/
4+
export type ComponentKind =
5+
| "client-function"
6+
| "server-function";

0 commit comments

Comments
 (0)