Skip to content

Commit 534bc2a

Browse files
committed
docs: update adrs
1 parent fb3cfe5 commit 534bc2a

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

.adrs/0000-choice-between-useless-and-unnecessary-in-rule-naming.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ Accepted
66

77
## Context
88

9-
When naming rules related to identifying redundant or non-functional code (e.g., in linting or static analysis), the terms "useless" and "unnecessary" both convey a sense of superfluity. However, their nuanced semantic differences could lead to ambiguity if misapplied. For example, a `forwardRef`-wrapped component that is never passed a `ref` is entirely without purpose, but other scenarios might involve optional code that is only redundant in specific contexts. A consistent naming convention is needed to ensure clarity and accuracy in rule documentation and error messaging.
9+
When naming rules related to identifying redundant or non-functional code (e.g., in linting or static analysis), the terms "useless" and "unnecessary" both convey a sense of superfluity. However, their nuanced semantic differences could lead to ambiguity if misapplied. For example, a `forwardRef` call with no `ref` usage is entirely without purpose, but other scenarios might involve optional code that is only redundant in specific contexts. A consistent naming convention is needed to ensure clarity and accuracy in rule documentation and error messaging.
1010

1111
## Decision
1212

13-
Use "useless" to describe code that has no functional purpose under any circumstances (e.g., a `forwardRef` with no `ref` usage).
13+
Use "useless" to describe code that has no functional purpose under any circumstances (e.g., a `forwardRef` call with no `ref` usage).
14+
1415
Use "unnecessary" to describe code that is contextually redundant but not strictly non-functional (e.g., an `useEffect` that runs event-specific logic).
1516

1617
## Consequences

.adrs/0001-rename-ensure-forward-ref-using-ref-to-no-useless-forward-ref.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,22 @@ Accepted
66

77
## Context
88

9-
The rule `ensure-forward-ref-using-ref` detects React `forwardRef`-wrapped components that never receive a `ref` prop. This matches the "useless" criteria defined in ADR 0000, as such components serve no functional purpose. The current name lacks alignment with our established `no-<category>-<term>` naming convention and semantic categorization.
9+
Renaming the `ensure-forward-ref-using-ref` rule to align with the existing rule naming conventions and accurately reflect the rule's focus on non-functional code.
1010

1111
## Decision
1212

13-
Rename the rule to **`no-useless-forward-ref`** to:
14-
15-
1. Adhere to the `no-<category>-<term>` pattern used in similar rules (e.g., `no-useless-state`).
16-
2. Reflect the strict "useless" classification per ADR 0000, since unreferenced `forwardRef` components are functionally inert.
13+
Rename the rule to **`no-useless-forward-ref`** to the `no-<category>-<term>` pattern used in similar rules (e.g., `no-useless-fragment`).
1714

1815
## Consequences
1916

20-
- **Consistency**: Aligns with existing rule taxonomy and terminology.
21-
- **Clarity**: Clearly signals the rule's focus on non-functional code.
22-
- **Documentation updates**: Requires migration guides and rule metadata changes.
17+
- The rule name will be more consistent with other rules in the project.
18+
- The rule name will more accurately reflect the rule's focus on non-functional code.
2319

2420
## Alternatives Considered
2521

2622
Using `no-unnecessary-forward-ref`:
2723

28-
- Rejected because "unnecessary" implies optional redundancy, whereas unreferenced `forwardRef` has zero runtime utility.
24+
- Rejected because "unnecessary" implies optional redundancy, in this case, the `forwardRef` call is always redundant.
2925

3026
## Related ADRs
3127

.github/workflows/publish.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ on:
77
- "**"
88
paths-ignore:
99
- "**/*.gitignore"
10+
- .adrs/**
1011
- .editorconfig
11-
- adrs/**
12-
- docs/**
12+
- apps/**
1313
- examples/**
14-
- website/**
15-
- scripts/**
1614
pull_request: null
1715
jobs:
1816
publish:

0 commit comments

Comments
 (0)