Skip to content

Commit e2b24aa

Browse files
authored
Merge pull request #722 from skoeva/knip
aks-desktop: Clean up knip findings
2 parents 105b4ad + 17143c5 commit e2b24aa

9 files changed

Lines changed: 22 additions & 295 deletions

File tree

knip.json

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,28 @@
33
"ignoreBinaries": [
44
"make"
55
],
6-
"ignore": [
7-
"headlamp/.plugins/**",
8-
"headlamp/app/resources/**"
9-
],
106
"workspaces": {
117
".": {
128
"entry": [
139
"build/*.ts"
1410
],
1511
"project": [
1612
"build/**/*.ts"
17-
],
18-
"ignore": [
19-
"build/download-az-cli.ts"
2013
]
2114
},
2215
"plugins/aks-desktop": {
2316
"entry": [
24-
"src/index.tsx"
17+
"src/index.tsx",
18+
"src/**/*.stories.{ts,tsx}",
19+
"src/**/*.test.{ts,tsx}",
20+
"src/**/*.guidepup.test.{ts,tsx}",
21+
"src/utils/azure/**/*.ts"
2522
],
2623
"project": [
2724
"src/**/*.{ts,tsx}"
2825
],
2926
"ignore": [
30-
"dist/**",
31-
"src/**/*.d.ts",
32-
"src/utils/test/*.test.ts",
33-
"src/utils/test/run-tests.js"
27+
"src/**/*.d.ts"
3428
],
3529
"ignoreDependencies": [
3630
"@azure/arm-resourcegraph",
@@ -39,28 +33,14 @@
3933
"@iconify/react",
4034
"@monaco-editor/react",
4135
"@mui/material",
36+
"@mui/utils",
37+
"@storybook/react",
38+
"@testing-library/jest-dom",
39+
"@types/libsodium-wrappers",
40+
"axe-core",
4241
"eslint-plugin-no-barrel-files",
43-
"react-router-dom"
44-
],
45-
"ignoreBinaries": [
46-
"prettier"
47-
]
48-
},
49-
"plugins/ai-assistant": {
50-
"entry": [
51-
"src/index.tsx"
52-
],
53-
"project": [
54-
"src/**/*.{ts,tsx}"
55-
],
56-
"ignore": [
57-
"dist/**",
58-
"src/**/*.d.ts"
59-
],
60-
"ignoreDependencies": [
61-
"@iconify/react",
62-
"@monaco-editor/react",
63-
"@mui/material",
42+
"i18next",
43+
"react-i18next",
6444
"react-router-dom"
6545
],
6646
"ignoreBinaries": [

plugins/aks-desktop/src/components/CreateAKSProject/types.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,6 @@ export const AVAILABLE_ROLES = ['Admin', 'Writer', 'Reader'] as const;
188188

189189
export type RoleType = (typeof AVAILABLE_ROLES)[number];
190190

191-
// Role descriptions
192-
export const ROLE_DESCRIPTIONS: Record<RoleType, string> = {
193-
Reader:
194-
'Read-only access to most objects in a namespace. Cannot view roles, role bindings, or Secrets.',
195-
Writer:
196-
'Read/write access to most objects in a namespace. Cannot view or modify roles or role bindings. Can access Secrets and run Pods as any ServiceAccount in the namespace.',
197-
Admin:
198-
'Read/write access to most resources in a namespace. Can create roles and role bindings within the namespace. Cannot write to resource quota or the namespace itself.',
199-
};
200-
201191
// Map UI role names to Azure RBAC role names
202192
export function mapUIRoleToAzureRole(uiRole: string): string {
203193
const roleMap: Record<string, string> = {

plugins/aks-desktop/src/components/CreateAKSProject/validators.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const isValidObjectId = (objectId: string): boolean => {
2222
/**
2323
* Validates project name
2424
*/
25-
export const validateProjectName = (projectName: string): ValidationResult => {
25+
const validateProjectName = (projectName: string): ValidationResult => {
2626
const trimmed = projectName.trim();
2727
const errors: string[] = [];
2828

@@ -53,7 +53,7 @@ export const validateProjectName = (projectName: string): ValidationResult => {
5353
/**
5454
* Validates user assignments
5555
*/
56-
export const validateAssignments = (assignments: UserAssignment[]): ValidationResult => {
56+
const validateAssignments = (assignments: UserAssignment[]): ValidationResult => {
5757
const errors: string[] = [];
5858

5959
if (!Array.isArray(assignments)) {
@@ -256,7 +256,7 @@ export const validateBasicsStep = (
256256
/**
257257
* Validates the access step
258258
*/
259-
export const validateAccessStep = (assignments: UserAssignment[]): ValidationResult => {
259+
const validateAccessStep = (assignments: UserAssignment[]): ValidationResult => {
260260
return validateAssignments(assignments);
261261
};
262262

plugins/aks-desktop/src/components/DeployTab/hooks/useClusterDeployStatus.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import { K8s, useTranslation } from '@kinvolk/headlamp-plugin/lib';
55
import { useEffect, useState } from 'react';
66

7-
export const ANNOTATION_DEPLOYED_BY = 'aks-project/deployed-by';
8-
export const ANNOTATION_PIPELINE_REPO = 'aks-project/pipeline-repo';
9-
export const ANNOTATION_PIPELINE_RUN_URL = 'aks-project/pipeline-run-url';
10-
export const ANNOTATION_PIPELINE_WORKFLOW = 'aks-project/pipeline-workflow';
7+
const ANNOTATION_DEPLOYED_BY = 'aks-project/deployed-by';
8+
const ANNOTATION_PIPELINE_REPO = 'aks-project/pipeline-repo';
9+
const ANNOTATION_PIPELINE_RUN_URL = 'aks-project/pipeline-run-url';
10+
const ANNOTATION_PIPELINE_WORKFLOW = 'aks-project/pipeline-workflow';
1111

1212
export type DeploymentProvenance = 'manual' | 'pipeline' | 'vscode' | 'unknown';
1313

plugins/aks-desktop/src/components/DeployWizard/components/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
/**
55
* Helper functions for resource management
66
*/
7-
export const bumpWithUnit = (current: string, step: number, unit: 'm' | 'Mi', min = 1): string => {
8-
const numeric = parseInt(String(current).replace(/[^0-9]/g, ''), 10);
9-
const safe = isNaN(numeric) ? 0 : numeric;
10-
const next = Math.max(min, safe + step);
11-
return `${next}${unit}`;
12-
};
13-
147
export const setFromInput = (
158
raw: string,
169
unit: 'm' | 'Mi',

plugins/aks-desktop/src/components/GitHubPipeline/constants.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ export const COPILOT_SETUP_STEPS_PATH = '.github/workflows/copilot-setup-steps.y
1616
/** Path to the containerization agent config pushed by the setup PR. */
1717
export const AGENT_CONFIG_PATH = '.github/agents/containerization.agent.md';
1818

19-
/**
20-
* GitHub bot usernames that may author PRs created by the Copilot Coding Agent.
21-
* Stored lowercase — always compare with `.toLowerCase()`.
22-
*/
23-
export const COPILOT_BOT_USERS = new Set(['copilot-swe-agent[bot]', 'copilot[bot]', 'copilot']);
24-
2519
/** Default image tag mandated in agent instructions. */
2620
export const DEFAULT_IMAGE_TAG = '1.0';
2721

plugins/aks-desktop/src/components/GitHubPipeline/hooks/usePipelineAnnotationSync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { PipelineDeploymentState } from '../types';
88

99
export const ANNOTATION_PIPELINE_REPOS = 'aks-project/pipeline-repos';
1010
export const ANNOTATION_WORKLOAD_IDENTITY = 'aks-project/workload-identity-id';
11-
export const ANNOTATION_WORKLOAD_TENANT = 'aks-project/workload-identity-tenant';
11+
const ANNOTATION_WORKLOAD_TENANT = 'aks-project/workload-identity-tenant';
1212

1313
const MERGE_PATCH_HEADERS = {
1414
Accept: 'application/json',

plugins/aks-desktop/src/components/Metrics/hooks/useCardMetrics.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
3333
/** Prometheus endpoint cache. */
3434
const promEndpointCache = new Map<string, string>();
3535

36-
/** Clears all card metric caches */
37-
export function clearCardMetricsCaches(): void {
38-
metricsCache.clear();
39-
promEndpointCache.clear();
40-
}
41-
4236
/** Result returned by {@link useCardMetrics}. */
4337
export interface UseCardMetricsResult {
4438
/** Metric values to be displayed on the MetricsCard. */

0 commit comments

Comments
 (0)