Skip to content

chore: update knip config & remove unused code#2126

Merged
danielroe merged 4 commits intonpmx-dev:mainfrom
webpro:chore/remove-unused-code
Mar 18, 2026
Merged

chore: update knip config & remove unused code#2126
danielroe merged 4 commits intonpmx-dev:mainfrom
webpro:chore/remove-unused-code

Conversation

@webpro
Copy link
Copy Markdown
Contributor

@webpro webpro commented Mar 18, 2026

🔗 Linked issue

🧭 Context

After adding support for auto-imports in the Nuxt plugin, we can reduce Knip config. This revealed unused code, which is also deleted in this PR.

📚 Description

  • Removes entry patterns that the Knip plugin adds (better)
  • Removes unused code (fully automated using knip --fix ↔ oxlint ↔ remove-unused-vars)
  • Adds --exclude dependencies for production mode in CI (for flexible dev/deps division)

Please review the removals, let me know what we should restore/ignore!

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 18, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 18, 2026 5:51am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 18, 2026 5:51am
npmx-lunaria Ignored Ignored Mar 18, 2026 5:51am

Request Review

@webpro webpro changed the title chore: opdate knip config & remove unused code chore: update knip config & remove unused code Mar 18, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 18, 2026

Codecov Report

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

Files with missing lines Patch % Lines
app/utils/atproto/likes.ts 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@webpro webpro marked this pull request as ready for review March 18, 2026 05:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

This PR systematically reduces the public API surface of the codebase by converting numerous exported types, interfaces, functions, and constants to internal declarations. Changes span Vue component types, composables, configuration files, utility modules, and schema definitions. Key modifications include removing export keywords from interfaces in Vue components, making helper functions and environment detection constants private, deleting unused validation schemas, removing the parseBasicFrontmatter utility function, and refactoring knip configuration settings. The CI workflow is also updated with an additional knip command flag for dependency exclusion.

Possibly related PRs

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The PR description clearly relates to the changeset, explaining the context, objectives, and changes made throughout the pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
lunaria/components.ts (1)

144-146: Consider defensive handling for localisation lookup.

The non-null assertion on line 146 relies on upstream filtering to guarantee the localisation exists. While the current data flow is safe (the find is within missingFiles.map which only contains files with a matching localisation), a defensive check or early return would guard against future refactoring that might alter the filtering logic.

The same pattern appears at lines 177–179, 258, and 285–287.

♻️ Optional defensive pattern
 ${missingFiles.map(file => {
   const localization = file.localizations.find(
     localizationItem => localizationItem.lang === lang,
-  )!
+  )
+  if (!localization) return ''
   return html`
knip.ts (1)

42-43: Add a brief rationale for these ignores to prevent future false-negative confusion.

ignoreUnresolved/ignoreFiles here are non-obvious and likely intentional; a short inline note will make later clean-ups safer.

♻️ Suggested tweak
-      ignoreUnresolved: ['#oauth/config'],
-      ignoreFiles: ['app/components/Tooltip/Announce.vue', 'app/components/UserCombobox.vue'],
+      /** Nuxt resolution pattern not statically resolved by Knip */
+      ignoreUnresolved: ['#oauth/config'],
+      /** Known Knip false-positives for auto-registered/template-resolved components */
+      ignoreFiles: ['app/components/Tooltip/Announce.vue', 'app/components/UserCombobox.vue'],

As per coding guidelines "Add comments only to explain complex logic or non-obvious implementations".


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5a001bcf-4753-4c9a-a2b0-ac92412153a7

📥 Commits

Reviewing files that changed from the base of the PR and between ad2b174 and 41d586a.

📒 Files selected for processing (19)
  • .github/workflows/ci.yml
  • app/components/Compare/ComparisonGrid.vue
  • app/components/Package/ListControls.vue
  • app/components/Select/Field.vue
  • app/composables/npm/useAlgoliaSearch.ts
  • app/composables/npm/useNpmSearch.ts
  • app/composables/useVirtualInfiniteScroll.ts
  • app/utils/atproto/likes.ts
  • app/utils/atproto/profile.ts
  • config/env.ts
  • knip.ts
  • lunaria/components.ts
  • server/utils/diff.ts
  • shared/schemas/atproto.ts
  • shared/schemas/package.ts
  • shared/schemas/publicUserSession.ts
  • shared/schemas/social.ts
  • shared/schemas/user.ts
  • shared/utils/parse-basic-frontmatter.ts
💤 Files with no reviewable changes (5)
  • shared/schemas/social.ts
  • shared/schemas/atproto.ts
  • shared/schemas/publicUserSession.ts
  • server/utils/diff.ts
  • shared/utils/parse-basic-frontmatter.ts

Copy link
Copy Markdown
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

🔥

@danielroe danielroe added this pull request to the merge queue Mar 18, 2026
Merged via the queue into npmx-dev:main with commit a482999 Mar 18, 2026
21 checks passed
@github-actions github-actions bot mentioned this pull request Mar 18, 2026
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