Skip to content

build: lint for unused dependencies with knip - #7200

Merged
trentm merged 7 commits into
open-telemetry:mainfrom
embrace-io:overbalance/knip-ci
Oct 14, 2026
Merged

trentm merged 7 commits into
open-telemetry:mainfrom
embrace-io:overbalance/knip-ci

Conversation

@overbalance

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

Published packages list dependencies they do not use, and consumers install them for nothing. Nothing in CI checks for this.

Stacked on #7196. The first two commits belong to it.

Short description of the changes

  • Add npm run lint:unused-deps, which runs knip --production with knip.json limited to dependency issues, and run it as part of npm run lint. Private workspaces (examples, e2e and integration tests, packages/template) are ignored, because knip finds no production entry points in them.
  • Fix what it reports, one commit each:
    • exporter-metrics-otlp-http: remove @opentelemetry/resources, which nothing in src or test imports, and its project reference.
    • exporter-zipkin: move @opentelemetry/resources to devDependencies, since only test imports it.
    • web-common: the unused @opentelemetry/semantic-conventions is removed in chore(web-common): remove unused semantic-conventions dependency #7196.

Unlisted dependencies are left to the build: #7199 fails it on an emitted import of an undeclared package, and #7197 on an inlined one.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • npm run lint passes, including lint:unused-deps.
  • lint:unused-deps gives the same result with and without dist, so the Lint job does not need a build.
  • Control: adding @opentelemetry/resources back to zipkin dependencies fails it with Unused dependencies (1).
  • exporter-metrics-otlp-http and exporter-zipkin: npm run compile from the root, then lint, test and test:browser in each package pass. Zipkin dist has no reference to @opentelemetry/resources.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-14 23:08 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.12%. Comparing base (5e65e0e) to head (d2e048a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7200   +/-   ##
=======================================
  Coverage   95.12%   95.12%           
=======================================
  Files         384      384           
  Lines       13548    13548           
  Branches     3128     3128           
=======================================
  Hits        12888    12888           
  Misses        660      660           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trentm
trentm marked this pull request as ready for review October 14, 2026 23:02
@trentm
trentm requested a review from a team as a code owner October 14, 2026 23:02
@trentm
trentm added this pull request to the merge queue Oct 14, 2026
Merged via the queue into open-telemetry:main with commit 7d2455e Oct 14, 2026
25 checks passed
@overbalance
overbalance deleted the overbalance/knip-ci branch October 15, 2026 00:19
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.

2 participants