Remove unused files and dependencies with Knip#1494
Merged
Merged
Conversation
The project seems to run fine without them
It looks like many of these are in editor-standalone so may have been copied when the project was split
This is done in the webcomponent js
Note that this is already a dependency of code-mirror so we don't need to include it here
Note that sentry/react sentry still has this as a depedency so it will remain installed
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
Co-authored-by: Chris Zetter <zetter-rpf@users.noreply.github.com>
We could keep knip and include it as a build in the future, but for now we've got value from it by running it for the first time.
Contributor
There was a problem hiding this comment.
Pull request overview
Cleans up the editor-ui codebase by removing unused source files, styles, build helpers, and dependencies identified via Knip (primarily legacy CRA/ejected-Cra artifacts and unused code carried over from editor-standalone).
Changes:
- Removed unused runtime/dev dependencies and updated
yarn.lockaccordingly. - Deleted unused application/util/redux files and unused SCSS stylesheets.
- Simplified some module exports (Redux slices, components, Cypress helpers) to reflect actual usage.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Lockfile updated to reflect dependency removals/additions. |
| package.json | Removed unused deps/devDeps; added TypeScript-related dev tooling deps. |
| src/utils/sentry.js | Removed unused Sentry initialization module. |
| src/utils/reportWebVitals.js | Removed unused web-vitals reporting helper. |
| src/utils/defaultProjects.js | Removed unused HTML default project helpers/exports; retained Python defaults. |
| src/redux/WebComponentSlice.js | Removed unused Redux slice. |
| src/redux/WebComponentAuthSlice.js | Adjusted slice visibility/exports to only expose used actions. |
| src/redux/InstructionsSlice.js | Adjusted slice visibility/export style without changing reducer behavior. |
| src/redux/EditorSlice.js | Adjusted slice visibility and pruned exported actions list to those in use. |
| src/hooks/useUserFont.js | Removed unused hook. |
| src/hooks/useRequiresUser.js | Removed unused hook. |
| src/components/Menus/Sidebar/DownloadPanel/DownloadPanel.jsx | Switched to internal const component while keeping default export. |
| src/components/Editor/NewInputPanelButton/NewInputPanelButton.jsx | Removed unused component. |
| src/assets/stylesheets/rpf_design_system/typography.scss | Removed unused stylesheet. |
| src/assets/stylesheets/ProjectListTable.scss | Removed unused stylesheet. |
| src/assets/stylesheets/ProjectListItem.scss | Removed unused stylesheet. |
| src/assets/stylesheets/ProjectIndexPagination.scss | Removed unused stylesheet. |
| src/assets/stylesheets/ProjectIndexHeader.scss | Removed unused stylesheet. |
| src/assets/stylesheets/LoginMenu.scss | Removed unused stylesheet. |
| src/assets/stylesheets/LandingPage.scss | Removed unused stylesheet. |
| cypress/helpers/scratch.js | Reduced exported helper surface to what’s used. |
| cypress/helpers/editor.js | Reduced exported helper surface and removed unused HTML-runner helper functions. |
| config/webpackDevServer.config.js | Removed unused CRA-derived dev-server config helper. |
| config/svgo.config.js | Removed unused SVGO config file. |
| config/pnpTs.js | Removed unused PnP TypeScript resolver helper. |
| config/modules.js | Removed unused CRA module-resolution helper. |
| config/getHttpsConfig.js | Removed unused CRA HTTPS config helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This uses the Knip tool to remove unused code and dependencies, similar to https://github.com/RaspberryPiFoundation/editor-standalone/pull/770.
It seems that most removals are due to:
I've tested the build locally from classroom and editor and all project types are working as expected.
This takes us from around 2540 dependencies (170 direct) to 2264 (132 direct), although doesn't change the build size that much as the dependencies were unused.