Conversation
There was a problem hiding this comment.
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-importto the tests ESLint flat config and enableimport/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
| { | ||
| "ignorePatterns": [ | ||
| "jest.config.ts" | ||
| ] | ||
| } No newline at end of file |
There was a problem hiding this comment.
This repo uses ESLint v9 flat config (tests/eslint.config.mjs), so this legacy .eslintrc file won’t affect npm run lint and may lead to inconsistent linting between CI/editor setups. If the goal is to ignore jest.config.ts, add it to the ignores list in tests/eslint.config.mjs (or configure import/no-unused-modules), and remove this file to avoid config ambiguity.
| { | |
| "ignorePatterns": [ | |
| "jest.config.ts" | |
| ] | |
| } | |
| {} |
| "license": "Apache-2.0", | ||
| "peer": true, | ||
| "engines": { | ||
| "node": "^20.19.0 || ^22.13.0 || >=24" |
There was a problem hiding this comment.
eslint-visitor-keys@5.0.1 in the lockfile declares an engines requirement of ^20.19.0 || ^22.13.0 || >=24. CI jobs like .github/workflows/pr.yml use node-version: '20', and local devs may be on earlier Node 20 minors; this can lead to install/runtime issues. Consider pinning to a compatible eslint-visitor-keys/@typescript-eslint/* version set, or tightening the workflows/node tooling requirement to a Node version that satisfies these engines constraints.
| "node": "^20.19.0 || ^22.13.0 || >=24" | |
| "node": "20 || >=22" |
| // We don't have deterministic metrics for them yet. | ||
| "jest/expect-expect": "off" | ||
| "jest/expect-expect": "off", | ||
| "import/no-unused-modules": [1, { "unusedExports": true }] |
There was a problem hiding this comment.
import/no-unused-modules will report unusedExports for modules that are executed by Jest via configuration (e.g. jest.config.ts and jest.globalSetup.mjs) but are never imported in code. Consider either adding those files to the flat-config ignores list (preferred, since ESLint 9 uses eslint.config.mjs), or configuring import/no-unused-modules with ignoreExports / scoping the rule to only the directories you actually want to police (e.g. tests/utils/**).
| "import/no-unused-modules": [1, { "unusedExports": true }] | |
| "import/no-unused-modules": [1, { | |
| "unusedExports": true, | |
| "ignoreExports": [ | |
| "**/jest.config.ts", | |
| "**/jest.globalSetup.mjs" | |
| ] | |
| }] |
This PR adds a new ESLint plugin with rules to detect duplicate imports and unused exports.
I removed the export operator from the unused exports detected and then removed the unused code revealed.