Skip to content

Conversation

@snomiao
Copy link
Member

@snomiao snomiao commented Aug 12, 2025

Summary

  • Improved knip configuration to better detect unused code by adding missing entry points
  • Added support for Next.js App Router patterns and middleware detection
  • Updated configuration file references to match current project structure

Changes

  • Added middleware.ts and orval.config.ts to entry points
  • Added app/**/*.{js,jsx,ts,tsx} pattern for App Router support
  • Updated next.config.mjs reference to next.config.ts
  • Added @algolia/autocomplete-shared to ignored dependencies to prevent false positives

Test plan

  • Run bun run knip to verify configuration works correctly
  • Confirm no false positives are reported for legitimate dependencies
  • Verify unused code detection still functions as expected

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings August 12, 2025 13:59
@vercel
Copy link

vercel bot commented Aug 12, 2025

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

Project Deployment Preview Comments Updated (UTC)
registry-web Ready Ready Preview Comment Nov 18, 2025 11:31am

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 adds knip as a development dependency to help identify unused code, dependencies, and exports in the codebase. Knip is a static analysis tool that can help maintain code quality by detecting dead code.

  • Added knip@^5.62.0 as a development dependency
  • Created a comprehensive knip.json configuration file with project-specific settings
  • Configured entry points, project files, and ignore patterns for the Next.js project

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
package.json Added knip dependency to devDependencies
knip.json Created configuration file with entry points, ignore patterns, and framework-specific settings

@github-actions
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

@snomiao snomiao changed the title Add knip dependency for unused code detection feat: improve knip configuration for better unused code detection Aug 12, 2025
@github-actions
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

@github-actions
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

@github-actions
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

@snomiao
Copy link
Member Author

snomiao commented Aug 21, 2025

let sno rebase to origin/main and solve conflicts

@snomiao
Copy link
Member Author

snomiao commented Aug 21, 2025

Rebase and Conflict Resolution Task List

All tasks completed successfully!

  • Reply to PR comment with todolist of tasks
  • Fetch latest changes from origin/main
  • Rebase current branch onto origin/main
  • Resolve any merge conflicts
  • Test the changes after rebase
  • Push rebased changes to branch
  • Update tracking comment with completion summary

Summary

✅ Successfully rebased sno-knip branch onto origin/main
✅ Resolved conflicts in package.json and bun.lock
✅ Regenerated lockfile with bun install
✅ Verified knip configuration works correctly (found 2 unused devDependencies as expected)
✅ Lint passed with only 1 minor warning
✅ Force-pushed rebased changes to remote branch

The PR is now up-to-date with the latest main branch and ready for review!

@github-actions
Copy link

🎨 Chromatic Visual Testing Results

Resource URL
🔍 Build Results Chromatic Build
📚 Storybook View Storybook

Check the visual changes and approve or request changes as needed.

snomiao and others added 4 commits October 16, 2025 19:06
- Added knip@^5.62.0 as development dependency
- Created knip.json configuration file for project setup
- This will help identify unused code, dependencies, and exports

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update entry points to include middleware.ts and orval.config.ts
- Add app directory pattern for Next.js App Router support
- Update next.config reference from .mjs to .ts
- Add @algolia/autocomplete-shared to ignored dependencies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove next.config.ts and middleware.ts from entry points since Next.js loads them automatically
- Move these files to ignore list to prevent false positive warnings
- Remove @types/node from ignoreDependencies to allow proper unused detection
- Add storybook plugin configuration for story file detection
- Configuration now properly detects unused dependencies without false positives

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Cleaned up package.json and bun.lock by removing dependencies that are no longer used:
- Removed various unused development and runtime dependencies
- Updated lock file to reflect the changes
- Improved project maintainability and reduced bundle size

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
snomiao and others added 6 commits October 16, 2025 19:06
Fixes Chromatic CI build failure by adding package.json with "type": "module"
to the .storybook directory. This allows Node.js to properly resolve ES module
imports in mockResolverPlugin.js, specifically the @snomiao/glob-watch package.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The package was added to package.json in commit c43542f but the lockfile
was not updated, causing CI builds to fail. This commit adds the missing
lockfile entries for @snomiao/glob-watch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@socket-security
Copy link

socket-security bot commented Oct 16, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

snomiao and others added 2 commits October 25, 2025 13:35
- Update biome schema to 2.3.0
- Enable tailwindDirectives in CSS parser to support Tailwind @apply
- Increase maxSize to 2MB for large generated files
- Add .biomeignore for styles/globals.css
- Apply biome formatting fixes across codebase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Merge main branch changes including Storybook deployment config
- Keep knip dependency from sno-knip branch
- Regenerate bun.lock with all dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Revert schema version from 2.3.0 to 2.2.6
- Remove unsupported tailwindDirectives option
- Keep overrides to exclude styles/globals.css
- Keep maxSize increase for large generated files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@@ -0,0 +1,3 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

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

may not necessary

snomiao and others added 2 commits November 18, 2025 11:27
The .storybook/package.json file with only {"type": "module"} is not necessary
for knip configuration. Knip works identically with or without this file, as
verified by testing both scenarios.

Addresses review comment: #203 (comment)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings November 18, 2025 11:28
Copilot finished reviewing on behalf of snomiao November 18, 2025 11:30
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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"src/**/*.{js,jsx,ts,tsx}",
"utils/**/*.{js,jsx,ts,tsx}",
"scripts/**/*.{js,jsx,ts,tsx}",
"orval.config.ts"
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

The configuration lists orval.config.ts as an entry point but it's also listed in the ignore array (line 24-25). This is contradictory. Entry points should be analyzed, not ignored. Consider removing orval.config.ts from the ignore list if it should be an entry point, or remove it from the entry list if it should be ignored.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
"next.config.ts",
"middleware.ts"
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

The configuration lists middleware.ts in the ignore array, but according to the PR description, middleware detection support was added. If middleware.ts is an entry point (as typical for Next.js middleware), it should not be ignored. Consider removing it from the ignore list to allow knip to analyze it for unused exports/imports.

Suggested change
"next.config.ts",
"middleware.ts"
"next.config.ts"

Copilot uses AI. Check for mistakes.
"glob": "^11.0.3",
"husky": "^9.1.7",
"i18next-typescript-parser": "^0.3.0",
"knip": "^5.62.0",
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

[nitpick] Version mismatch detected: package.json specifies knip@^5.62.0, but bun.lock has [email protected] installed. While this is within the semver range, it's recommended to run bun install to ensure package.json and bun.lock are synchronized, or update package.json to reflect the actual installed version for better reproducibility.

Suggested change
"knip": "^5.62.0",
"knip": "5.66.3",

Copilot uses AI. Check for mistakes.
@snomiao
Copy link
Member Author

snomiao commented Nov 18, 2025

Fixed in commit 7405228

You're right, the .storybook/package.json file is not necessary. I tested knip with and without this file and confirmed it works identically in both cases. The file has been removed.

All CI checks are passing. Thank you for the review!

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