Skip to content

Commit 321be94

Browse files
Merge pull request #2094 from kyoto/pf5-find-unused-exports
PF5: Add AI skill that checks for any unused exports
2 parents c34c2ce + adc9840 commit 321be94

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: unused-exports
3+
description: >-
4+
Find exported symbols that are never imported by another file. Use when the
5+
user says "check exports", "unused exports" or asks to clean up exports.
6+
---
7+
8+
# unused-exports
9+
10+
## Step 1: Run ts-unused-exports
11+
12+
Version is pinned to guard against supply chain attacks:
13+
14+
```sh
15+
npx ts-unused-exports@11.0.1 unit-tests/tsconfig.json \
16+
--findCompletelyUnusedFiles \
17+
--showLineNumber \
18+
--searchNamespaces
19+
```
20+
21+
## Step 2: Filter out entry points
22+
23+
Some exports are consumed externally by the OpenShift console framework, not by
24+
imports within this repo. Read `package.json``consolePlugin.exposedModules`
25+
and `console-extensions.json``$codeRef` values to identify them. Exclude any
26+
finding that is a default export of an exposed module or is named in a
27+
`$codeRef`.
28+
29+
## Step 3: Report findings
30+
31+
Group into **unused exports** and **completely unused files**. If nothing
32+
remains, report that all exports are accounted for. Do not modify any files.

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type Tool = {
4646

4747
export type OlsToolUIComponent = React.ComponentType<{ tool: Tool }>;
4848

49-
export type HistoryCompression = {
49+
type HistoryCompression = {
5050
durationMs?: number;
5151
status: 'compressing' | 'done';
5252
};

unit-tests/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"include": [".", "../src", "../types.d.ts"]
4+
}

0 commit comments

Comments
 (0)