Skip to content

chore: update knip config and include in CI#30410

Merged
lyzno1 merged 9 commits intomainfrom
12-31-knip
Dec 31, 2025
Merged

chore: update knip config and include in CI#30410
lyzno1 merged 9 commits intomainfrom
12-31-knip

Conversation

@hyoban
Copy link
Member

@hyoban hyoban commented Dec 31, 2025

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

part of #30407

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hyoban, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the project's code health and build efficiency by enforcing and optimizing the knip tool. It involves streamlining the knip configuration to better integrate with Next.js, removing unnecessary development dependencies, upgrading the knip tool itself, and performing minor cleanup in ESLint rule documentation. These changes aim to ensure that the codebase remains lean, well-maintained, and free of unused code and dependencies, ultimately improving maintainability and potentially build times.

Highlights

  • Knip Configuration Streamlining: The knip.config.ts file has been significantly refactored to leverage Knip's Next.js plugin, reducing boilerplate by automatically detecting common Next.js entry points and simplifying entry and ignore patterns.
  • Dependency Optimization: Several unused development dependencies, including babel-loader, istanbul-lib-coverage, and lodash, have been removed from package.json and pnpm-lock.yaml, leading to a leaner dependency tree.
  • Knip Version Upgrade: The knip dependency has been updated to version 5.78.0, bringing in the latest features and improvements of the unused code detection tool.
  • ESLint Rule Documentation Cleanup: Redundant JSDoc comments for internal helper functions and variables have been removed from several ESLint rule files, improving code readability and reducing noise.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request focuses on enforcing knip to identify and remove unused code, which is a valuable step towards improving the project's maintainability. The changes include simplifying the knip.config.ts by leveraging its plugins, updating dependencies in package.json, and removing several JSDoc comments from ESLint rules. While the configuration cleanup and dependency removal are positive changes, I have concerns about the removal of JSDoc comments that provide type information in JavaScript files. These annotations are crucial for code clarity, static analysis, and long-term maintenance, especially for complex data structures. I've added specific comments suggesting their restoration.

I am having trouble creating individual review comments. Click here to see my feedback.

web/eslint-rules/rules/no-as-any-in-t.js (32-36)

medium

This JSDoc block provides valuable type information for the node parameter (import('estree').CallExpression). In a JavaScript file, this kind of annotation is very helpful for maintainability and static analysis. Please consider keeping it.

web/eslint-rules/rules/no-legacy-namespace-prefix.js (22-41)

medium

Multiple JSDoc blocks containing valuable type information have been removed from this file. In a JavaScript file, these annotations are crucial for maintainability, static analysis, and developer understanding, especially for complex data structures and function parameters. Please consider restoring the JSDoc comments throughout this file.

web/eslint-rules/rules/require-ns-option.js (15-19)

medium

This JSDoc block provides valuable type information for the node parameter and the return type. Please consider keeping it to improve code clarity and maintainability in this JavaScript file.

@hyoban hyoban changed the title chore: enforce knip chore: update knip config and include in CI Dec 31, 2025
@hyoban hyoban marked this pull request as ready for review December 31, 2025 05:13
Copilot AI review requested due to automatic review settings December 31, 2025 05:13
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 31, 2025
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 updates the knip configuration and integrates it into the CI pipeline as part of issue #30407. The changes remove unused dependencies and simplify the knip configuration while adding automated dead code detection to the CI workflow.

  • Removed unused devDependencies: babel-loader and istanbul-lib-coverage
  • Updated knip from version 5.66.1 to 5.78.0
  • Simplified knip configuration by removing redundant patterns and excessive JSDoc comments
  • Added knip dead code check and build step to the CI workflow

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/package.json Removed unused dependencies (babel-loader, istanbul-lib-coverage) and updated knip to version 5.78.0
web/pnpm-lock.yaml Updated lockfile to reflect package.json dependency changes
web/knip.config.ts Simplified configuration by removing redundant entry patterns, explicit Next.js patterns, store/provider patterns, and changing rule severities from error to warn
web/eslint-rules/rules/*.js Removed JSDoc comments from internal helper functions in three ESLint rule files
.github/workflows/style.yml Added "Web dead code check" and "Web build" steps to the CI workflow
Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

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

@hyoban hyoban marked this pull request as draft December 31, 2025 05:41
@hyoban hyoban marked this pull request as ready for review December 31, 2025 05:51
@hyoban hyoban requested a review from zxhlyh as a code owner December 31, 2025 07:29
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 31, 2025
@lyzno1 lyzno1 merged commit e856287 into main Dec 31, 2025
16 checks passed
@lyzno1 lyzno1 deleted the 12-31-knip branch December 31, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

3 participants