Skip to content

Add knip and clean up unused code#117

Merged
illume merged 8 commits into
Azure:mainfrom
skoeva:knip
Jan 14, 2026
Merged

Add knip and clean up unused code#117
illume merged 8 commits into
Azure:mainfrom
skoeva:knip

Conversation

@skoeva
Copy link
Copy Markdown
Collaborator

@skoeva skoeva commented Jan 13, 2026

These changes do the following:

  • Introduce and configure knip, which helps address unused code
  • Remove duplicate imports, exports, and types
  • Remove unused code, files, and dependencies
  • Fix Jest config paths
  • Ignore unlisted dependencies and utility files

Fixes: #35

Testing

  • Run npm run knip

Note

NOTICE.md should be regenerated before release

@skoeva skoeva self-assigned this Jan 13, 2026
Copilot AI review requested due to automatic review settings January 13, 2026 19:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces knip, a tool for detecting unused code, and performs comprehensive cleanup of unused exports, imports, types, and entire files. The changes improve code maintainability by removing dead code while ensuring all remaining code is properly referenced.

Changes:

  • Added knip configuration and tooling to detect unused code
  • Removed unused files: graph-api.test.ts, metrics-api.ts, types.ts, graph-api.ts, client.ts
  • Removed unused functions and types from existing files
  • Converted default exports to named exports for consistency
  • Fixed Jest config paths and moved test dependencies to devDependencies

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
knip.json New knip configuration with proper entry points, ignore patterns, and Jest integration
package.json Added knip script, moved test dependencies to devDependencies, updated TypeScript and @types/node
package-lock.json Updated lockfile with knip and its dependencies
plugins/aks-desktop/package.json Moved jest-environment-jsdom and ts-jest from dependencies to devDependencies
plugins/aks-desktop/test-config/jest/jest.config.babel.js Fixed rootDir and setupFilesAfterEnv paths
plugins/aks-desktop/src/utils/test/graph-api.test.ts Deleted unused test file (861 lines)
plugins/aks-desktop/src/utils/shared/metrics-api.ts Deleted unused metrics API file (742 lines)
plugins/aks-desktop/src/utils/azure/types.ts Deleted unused type definitions file (75 lines)
plugins/aks-desktop/src/utils/azure/graph-api.ts Deleted unused Graph API implementation (231 lines)
plugins/aks-desktop/src/utils/azure/client.ts Deleted unused Azure client factory (146 lines)
plugins/aks-desktop/src/utils/azure/aks.ts Removed unused AzureResult type and deprecated getAKSKubeconfig function
plugins/aks-desktop/src/hooks/useAzureAuth.tsx Removed unused React import and withAzureAuth HOC
plugins/aks-desktop/src/components/CreateAKSProject/validators.ts Removed unused functions: validateEmail, sanitizeProjectName, isValidKubernetesName; removed unused EmailValidationResult import
plugins/aks-desktop/src/components/CreateAKSProject/types.ts Removed unused types: StepValidation, CreationState, AssignmentRowProps, EmailValidationResult, AzureApiResponse types, StepName
plugins/aks-desktop/src/components/CreateAKSProject/components/*.tsx Removed duplicate default exports, keeping only named exports
plugins/aks-desktop/src/components/InfoTab/InfoTab.tsx Changed imports from default to named exports
plugins/aks-desktop/src/components/DeployWizard/DeployWizard.tsx Changed Breadcrumb import from default to named export
plugins/aks-desktop/src/components/CreateAKSProject/CreateAKSProject.tsx Changed all component imports from default to named exports
Files not reviewed (1)
  • plugins/aks-desktop/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • plugins/aks-desktop/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

illume
illume previously approved these changes Jan 13, 2026
Copy link
Copy Markdown
Collaborator

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! 🎉

@skoeva skoeva dismissed illume’s stale review January 14, 2026 14:15

The merge-base changed after approval.

illume
illume previously approved these changes Jan 14, 2026
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • plugins/aks-desktop/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@vyncent-t vyncent-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying these changes

Copy link
Copy Markdown
Collaborator

@vyncent-t vyncent-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran the cmd and everything looks like it works as intended, theses are the unused exports shown from my local testing.

If this is consistent with yours feel free to move this along 👍

lmk what you think @illume

image

@illume illume merged commit 2f9a23a into Azure:main Jan 14, 2026
13 checks passed
@webpro
Copy link
Copy Markdown

webpro commented Jan 15, 2026

Saw this by accident the other day and it inspired me to add https://github.com/webpro-nl/knip/blob/31eaaf544c88bd4c26003025da515a0f8ac134dd/packages/create-config/index.js#L154-L164

In other words, in a "faux monorepo" like this, config could be improved by adding workspaces: https://knip.dev/features/monorepos-and-workspaces#additional-workspaces

@skoeva skoeva deleted the knip branch January 15, 2026 13:17
@skoeva skoeva mentioned this pull request Jan 15, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused code, and add a CI check for unused code

5 participants