Skip to content

refactor: remove unused optional arguments and fields - #3195

Open
JonasBa wants to merge 1 commit into
npmx-dev:mainfrom
JonasBa:jonas/unused-props-cleanup
Open

refactor: remove unused optional arguments and fields#3195
JonasBa wants to merge 1 commit into
npmx-dev:mainfrom
JonasBa:jonas/unused-props-cleanup

Conversation

@JonasBa

@JonasBa JonasBa commented Aug 21, 2026

Copy link
Copy Markdown

Hey folks, I'm working on an experimental CLI which uses the tsgo toolchain to find optional component and function signatures that are in practice never passed. This is essentially dead code elimination, and a complementary workflow to run alongside a tool like knip.

The changeset in this PR has been done using the script as the reporting tool, and an agent validator loop walking through each reported line one by one to first inspect the report, analyze the call sites, removing them, and later re-running ts. If done correctly, the code that has been removed should have been effectively dead.

The reporting script heavily relies on type quality and only reports on types whos members are statically enumerable.

I'm opening this PR in an effort to help you eliminate dead code, but also to gain feedback on the script and the detection mechanisms. There are always risks of false positive reports, and removal of code that is actually still required at runtime.

Some references of PRs opened to other repositories that have been merged or are still open:
Sentry (4k loc removed)
Sentry (followup 1k loc removed)
Tanstack
npmx (this PR)

Would love to hear your feedback 🙏🏼

Generated with an experimental CLI that checks every call site of a
function and flags optional arguments and object fields that are never
provided. Previous defaults are inlined so runtime behavior is
unchanged. Findings whose call sites live in Vue SFCs (invisible to the
scanner) were verified manually and kept.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview Aug 21, 2026 4:33pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Aug 21, 2026 4:33pm
npmx-lunaria Ignored Ignored Aug 21, 2026 4:33pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 02d11d7f-6c3c-472f-8cd5-1f4ed047eaa8

📥 Commits

Reviewing files that changed from the base of the PR and between 9f6b209 and b254cf0.

📒 Files selected for processing (10)
  • app/composables/npm/useAlgoliaSearch.ts
  • app/composables/useFacetSelection.ts
  • app/composables/useStructuredFilters.ts
  • app/utils/compare-scatter-chart.ts
  • cli/src/npm-client.ts
  • cli/src/npm-process.ts
  • server/api/auth/atproto.get.ts
  • shared/utils/constellation.ts
  • shared/utils/git-providers.ts
  • shared/utils/repository-meta.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Improvements
    • Simplified search and filtering behaviour for more consistent results.
    • Repository links now use standard default branches automatically.
    • Freshness scoring and repository metadata retrieval now follow consistent fixed settings.
    • Improved consistency across npm, authentication, caching and repository integrations.

Walkthrough

The changes remove configurable parameters from search, filtering, process, authentication, repository, provider, and chart utilities. The affected code now uses fixed query names, limits, branches, environment values, TTL handling, and freshness normalisation.

Changes

API Contract Simplification

Layer / File(s) Summary
Search and filter contracts
app/composables/npm/useAlgoliaSearch.ts, app/composables/useFacetSelection.ts, app/composables/useStructuredFilters.ts
Search requests use empty filters, maintainer searches limit results to 1,000, facet URLs use facets, and structured filters start from DEFAULT_FILTERS.
Runtime and authentication contracts
cli/src/npm-client.ts, cli/src/npm-process.ts, server/api/auth/atproto.get.ts
Npm environment creation uses process.env, process command resolution reads process values directly, and random strings always use 16 bytes.
Repository and provider contracts
shared/utils/constellation.ts, shared/utils/repository-meta.ts, shared/utils/git-providers.ts
Repository helpers stop accepting request options and TTL values. Provider URLs use fixed HEAD, main, or master branches.
Fixed freshness normalisation
app/utils/compare-scatter-chart.ts
Freshness scores always use a 365-day normalisation period.

Suggested reviewers: serhalp

Merge Risk: ⚪ Minimal · up to b254c

This PR removes unused optional arguments and fields without any identified production-impacting issue at the current head; it is merge-ready after normal checks and review, with no actionable merge-blocking risk remaining.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the removal of unused optional arguments and fields across the changeset.
Description check ✅ Passed The description explains the experimental tooling, dead-code removal process, validation steps, and purpose of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/composables/npm/useAlgoliaSearch.ts 0.00% 1 Missing ⚠️
cli/src/npm-process.ts 0.00% 0 Missing and 1 partial ⚠️
server/api/auth/atproto.get.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant