Skip to content

Commit 5506293

Browse files
committed
docs: move knip refactor pattern into child page
1 parent 0edfc3d commit 5506293

File tree

2 files changed

+81
-63
lines changed

2 files changed

+81
-63
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
layout: default
3+
title: Keep Knip Green During Active Refactor
4+
nav_order: 1
5+
parent: Applied Practice Patterns
6+
grand_parent: Nice-to-Have
7+
---
8+
9+
# Keep Knip Green During Active Refactor
10+
11+
## Problem
12+
13+
Knip findings can be valid and still block progress in the middle of multi-PR work. Typical cases:
14+
15+
- a file intentionally removed in one PR but still referenced in another open branch
16+
- dependencies temporarily present during migration
17+
- exported types kept as public API even when not used internally
18+
19+
## Value
20+
21+
- CI stays green for the team.
22+
- Temporary debt is explicit instead of hidden.
23+
- Cleanup work is tracked and reversible.
24+
25+
## When to use
26+
27+
Use this pattern only when all conditions are true:
28+
29+
1. The work is intentionally split across multiple PRs.
30+
2. Every suppression has an owner and linked ticket.
31+
3. Every suppression has a removal trigger (date or merge milestone).
32+
33+
## Flow (Human + LLM)
34+
35+
1. Run Knip and classify findings into:
36+
- real dead code (remove now)
37+
- intentional API surface (document and allowlist)
38+
- temporary in-progress state (short-term suppression)
39+
2. Apply real fixes first (delete files, remove unused exports/dependencies).
40+
3. Add minimal temporary suppressions in Knip config with reason + ticket + expiry.
41+
4. Re-run Knip and confirm clean output before merge.
42+
5. Create follow-up cleanup task and fail that task if suppressions remain past expiry.
43+
44+
## Example Config Pattern
45+
46+
Use a config file where suppressions can be commented and reviewed:
47+
48+
```ts
49+
// knip.config.ts
50+
export default {
51+
// Temporary: FE-142, remove after refactor phase 2 (2026-03-15)
52+
ignoreDependencies: ['autoprefixer'],
53+
54+
// Temporary: FE-142, file removed after router split lands
55+
ignore: ['src/lib/index.ts'],
56+
};
57+
```
58+
59+
## Example Triage Outcome
60+
61+
Given a report like:
62+
63+
- `src/lib/index.ts` deleted
64+
- `autoprefixer` removed
65+
- `handleGetBase`, `handleListNamespaces`, `handleGetVariant` exports removed
66+
- `ListNamespacesInput`, `ListResumesInput`, `NamespaceRoutes`, `VariantInfo` intentionally kept as public API
67+
68+
A clean policy is:
69+
70+
1. Keep completed removals as-is.
71+
2. Keep intentional API exports documented in API-contract docs.
72+
3. Only suppress what is still transient, and time-box it.
73+
74+
## References
75+
76+
- [Applied Practice Patterns](applied-practice-patterns.md)
77+
- [CI Quality Gates](ci-quality-gates.md)
78+
- [Documentation Structure](../03-should-have/documentation-structure.md)

docs/04-nice-to-have/applied-practice-patterns.md

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: default
33
title: Applied Practice Patterns
44
nav_order: 7
55
parent: Nice-to-Have
6+
has_children: true
67
---
78

89
# Applied Practice Patterns
@@ -30,70 +31,9 @@ docs/
3031
migration-staging-with-feature-flag.md
3132
```
3233

33-
## Example Pattern: Keep Knip Green During Active Refactor
34+
## Pattern Catalog
3435

35-
### Problem
36-
37-
Knip findings can be valid and still block progress in the middle of multi-PR work. Typical cases:
38-
39-
- a file intentionally removed in one PR but still referenced in another open branch
40-
- dependencies temporarily present during migration
41-
- exported types kept as public API even when not used internally
42-
43-
### Value
44-
45-
- CI stays green for the team.
46-
- Temporary debt is explicit instead of hidden.
47-
- Cleanup work is tracked and reversible.
48-
49-
### When to use
50-
51-
Use this pattern only when all conditions are true:
52-
53-
1. The work is intentionally split across multiple PRs.
54-
2. Every suppression has an owner and linked ticket.
55-
3. Every suppression has a removal trigger (date or merge milestone).
56-
57-
### Flow (Human + LLM)
58-
59-
1. Run Knip and classify findings into:
60-
- real dead code (remove now)
61-
- intentional API surface (document and allowlist)
62-
- temporary in-progress state (short-term suppression)
63-
2. Apply real fixes first (delete files, remove unused exports/dependencies).
64-
3. Add minimal temporary suppressions in Knip config with reason + ticket + expiry.
65-
4. Re-run Knip and confirm clean output before merge.
66-
5. Create follow-up cleanup task and fail that task if suppressions remain past expiry.
67-
68-
### Example Config Pattern
69-
70-
Use a config file where suppressions can be commented and reviewed:
71-
72-
```ts
73-
// knip.config.ts
74-
export default {
75-
// Temporary: FE-142, remove after refactor phase 2 (2026-03-15)
76-
ignoreDependencies: ['autoprefixer'],
77-
78-
// Temporary: FE-142, file removed after router split lands
79-
ignore: ['src/lib/index.ts'],
80-
};
81-
```
82-
83-
### Example Triage Outcome
84-
85-
Given a report like:
86-
87-
- `src/lib/index.ts` deleted
88-
- `autoprefixer` removed
89-
- `handleGetBase`, `handleListNamespaces`, `handleGetVariant` exports removed
90-
- `ListNamespacesInput`, `ListResumesInput`, `NamespaceRoutes`, `VariantInfo` intentionally kept as public API
91-
92-
A clean policy is:
93-
94-
1. Keep completed removals as-is.
95-
2. Keep intentional API exports documented in API-contract docs.
96-
3. Only suppress what is still transient, and time-box it.
36+
{% include components/child-pages-list.html parent=page.title path_prefix="docs/04-nice-to-have/" current_url=page.url %}
9737

9838
## Common Mistakes
9939

0 commit comments

Comments
 (0)