diff --git a/.cursor/skills/unused-exports/SKILL.md b/.cursor/skills/unused-exports/SKILL.md new file mode 100644 index 00000000..c046d2f3 --- /dev/null +++ b/.cursor/skills/unused-exports/SKILL.md @@ -0,0 +1,32 @@ +--- +name: unused-exports +description: >- + Find exported symbols that are never imported by another file. Use when the + user says "check exports", "unused exports" or asks to clean up exports. +--- + +# unused-exports + +## Step 1: Run ts-unused-exports + +Version is pinned to guard against supply chain attacks: + +```sh +npx ts-unused-exports@11.0.1 unit-tests/tsconfig.json \ + --findCompletelyUnusedFiles \ + --showLineNumber \ + --searchNamespaces +``` + +## Step 2: Filter out entry points + +Some exports are consumed externally by the OpenShift console framework, not by +imports within this repo. Read `package.json` → `consolePlugin.exposedModules` +and `console-extensions.json` → `$codeRef` values to identify them. Exclude any +finding that is a default export of an exposed module or is named in a +`$codeRef`. + +## Step 3: Report findings + +Group into **unused exports** and **completely unused files**. If nothing +remains, report that all exports are accounted for. Do not modify any files. diff --git a/src/flags.ts b/src/flags.ts index 47576fc5..8878949d 100644 --- a/src/flags.ts +++ b/src/flags.ts @@ -1,6 +1,6 @@ import { SetFeatureFlag } from '@openshift-console/dynamic-plugin-sdk'; -export const FLAG_LIGHTSPEED_PLUGIN = 'LIGHTSPEED_PLUGIN'; +const FLAG_LIGHTSPEED_PLUGIN = 'LIGHTSPEED_PLUGIN'; export const enableLightspeedPluginFlag = (setFeatureFlag: SetFeatureFlag) => setFeatureFlag(FLAG_LIGHTSPEED_PLUGIN, true); diff --git a/src/hooks/useOpenOLS.ts b/src/hooks/useOpenOLS.ts index a1a3b1e0..fc3f85d2 100644 --- a/src/hooks/useOpenOLS.ts +++ b/src/hooks/useOpenOLS.ts @@ -7,7 +7,7 @@ import { Attachment } from '../types'; // Hook that provides a callback function to open the OpenShift Lightspeed UI with an optional // initial prompt. Exposed as a console extension so other console pages and plugins can discover // and invoke it. -export const useOpenOLS = (): (( +const useOpenOLS = (): (( // Optional initial prompt text to populate the input field prompt?: string, // Optional array of attachments to include with the prompt diff --git a/src/types.ts b/src/types.ts index 122c4b68..388d5be8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -46,7 +46,7 @@ export type Tool = { export type OlsToolUIComponent = React.ComponentType<{ tool: Tool }>; -export type HistoryCompression = { +type HistoryCompression = { durationMs?: number; status: 'compressing' | 'done'; }; diff --git a/unit-tests/tsconfig.json b/unit-tests/tsconfig.json new file mode 100644 index 00000000..148099b8 --- /dev/null +++ b/unit-tests/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../tsconfig.json", + "include": [".", "../src", "../types.d.ts"] +}