Skip to content

Delete unused code in tests#1101

Merged
JasonYeMSFT merged 1 commit intomicrosoft:mainfrom
JasonYeMSFT:chuye/no-unused-export
Mar 4, 2026
Merged

Delete unused code in tests#1101
JasonYeMSFT merged 1 commit intomicrosoft:mainfrom
JasonYeMSFT:chuye/no-unused-export

Conversation

@JasonYeMSFT
Copy link
Member

This PR adds a new ESLint plugin with rules to detect duplicate imports and unused exports.

  • If a module is imported, there can be only one import statement for it.
  • If a module is exported, another module other than itself must use it.

I removed the export operator from the unused exports detected and then removed the unused code revealed.

Copilot AI review requested due to automatic review settings March 2, 2026 23:12
Copy link
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 cleans up unused test utilities/exports and tightens linting by adding eslint-plugin-import (including a rule to surface unused exports), then removing code that becomes unused as a result.

Changes:

  • Add eslint-plugin-import to the tests ESLint flat config and enable import/no-unused-modules (unused exports) as a warning.
  • Remove unused exports/utility functions across tests/utils/** (e.g., fixture helpers, unused detectors, unused wrapper factories).
  • Consolidate several duplicate import statements in integration tests.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/utils/trigger-matcher.ts Removes unused exported types/helpers and minor formatting cleanup.
tests/utils/skill-loader.ts Removes unused exported helpers and narrows exported surface area.
tests/utils/regression-detectors.ts Removes unused detector functions and trims unused imports.
tests/utils/git-clone.ts Makes an internal options type non-exported.
tests/utils/fixtures.ts Deletes unused fixtures utility module.
tests/utils/evaluate.ts Removes an unused exported helper and reformats types.
tests/utils/agent-runner.ts Removes unused exports (deploy link helper + multi-turn conversation runner).
tests/package.json Adds eslint-plugin-import.
tests/package-lock.json Locks new dependency tree for the lint plugin (and updated transitive deps).
tests/microsoft-foundry/integration.test.ts Consolidates imports from evaluate.
tests/microsoft-foundry/foundry-agent/create/integration.test.ts Consolidates imports from evaluate.
tests/eslint.config.mjs Adds eslint-plugin-import flat configs + enables import/no-unused-modules.
tests/azure-validate/utils.ts Removes an unused helper and trims related comment text.
tests/azure-validate/integration.test.ts Consolidates imports from evaluate.
tests/azure-resource-visualizer/integration.test.ts Consolidates imports from evaluate.
tests/azure-rbac/integration.test.ts Consolidates imports from evaluate.
tests/azure-prepare/integration.test.ts Consolidates imports from evaluate.
tests/azure-messaging/integration.test.ts Consolidates imports from evaluate.
tests/azure-hosted-copilot-sdk/util.ts Makes internal helper functions non-exported.
tests/.eslintrc Adds a legacy ESLint config file intended to ignore jest.config.ts.
Files not reviewed (1)
  • tests/package-lock.json: Language not supported

@JasonYeMSFT JasonYeMSFT force-pushed the chuye/no-unused-export branch from a08b98f to 291e41c Compare March 3, 2026 22:39
@JasonYeMSFT JasonYeMSFT merged commit 69a03e5 into microsoft:main Mar 4, 2026
10 checks passed
@saikoumudi
Copy link
Contributor

can we have a way to prevent duplicate imports going forward? maybe by enabling import/no-duplicates

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.

4 participants