Add knip linter#36442
Conversation
There was a problem hiding this comment.
Pull request overview
Adds knip to the frontend toolchain to detect unused exports and incorporates cleanup changes found by the tool.
Changes:
- Add
knipas a dev dependency and commit the updated lockfile. - Introduce
knip.config.tsand run knip as part ofmake lint-js/make lint-js-fix. - Remove unused exports and adjust global typings accordingly.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| web_src/js/types.ts | Removes an exported type and a config type; intended cleanup after knip findings. |
| web_src/js/markup/render-iframe.ts | Makes an internal helper no longer exported. |
| web_src/js/markup/refissue.ts | Makes an internal helper no longer exported. |
| web_src/js/globals.d.ts | Inlines window.config typing instead of referencing types.ts. |
| package.json | Adds knip to devDependencies. |
| pnpm-lock.yaml | Updates lockfile for knip and transitive dependencies. |
| knip.config.ts | Adds knip configuration (entry points, project globs, excludes). |
| Makefile | Runs knip during JS lint and lint-fix targets. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 13 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I just noticed that the Those are for me at least in package.json |
|
Odd, it shouldn't do that because I've disabled the dependency modules (too many exclusions would be needed). Will test it. |
|
Fixed this by enabling the dependency modules. A couple of exclusions were needed because knip currently can not detect usage in Makefile or when reading data directly out of Opened webpro-nl/knip#1486 for the |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 13 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ChristopherHX
left a comment
There was a problem hiding this comment.
Works now correctly on my end
* giteaofficial/main: Normalize guessed languages for code highlighting (go-gitea#36450) Add `knip` linter (go-gitea#36442) Fix various bugs (go-gitea#36446) Update tool dependencies (go-gitea#36445) Update JS dependencies, adjust webpack config, misc fixes (go-gitea#36431) fix: Improve image captcha contrast for dark mode (go-gitea#36265) Refactor template render (go-gitea#36438) Add documentation for markdown anchor post-processing (go-gitea#36443) Fix markup heading parsing, fix emphasis parsing (go-gitea#36284) Front port changelog for 1.25.4 (go-gitea#36432) Bugfix: Potential incorrect runID in run status update (go-gitea#36437) Restrict branch naming when new change matches with protection rules (go-gitea#36405)
This adds knip, a tool to find unused files, dependencies and exports in JS. Fixed all discovered issues.
d.tsto.tsso I worked around it by moving the two affected types to where they are used.modules/fomantic/dropdown.tshad a new typescript error, but I fixed it.EsbuildPlugin, I think this was added recently.