Repository navigation
Remove dead code and fix undeclared dependencies - #1025
Akshay-2007-1 wants to merge 1 commit into
Conversation
Remove unused code (no references anywhere in the repository): - lib/modules-lib/src/specialErrors.ts: interrupt() is never imported - lib/lintplugin: unused resolveAliasedSymbol helper in rules/typed/utils.ts - lib/typedoc-plugin: unused ParserSuccess and ParserError interfaces in json.ts - tabs/Csg: drop the unused Color and Numbers3 re-exports from jscad/types.ts Remove dependencies that are declared but never imported: - bundles/robot_simulation: js-slang (only mentioned in comments) - bundles/csg: js-slang (devDependency) - bundles/repeat: @sourceacademy/modules-lib and js-slang (devDependency) - tabs/RobotSimulation: @sourceacademy/modules-lib - tabs/Plotly: @blueprintjs/core (only @blueprintjs/icons is used) - tabs/Rune: es-toolkit and gl-matrix - tabs/Repeat: react-dom Declare dependencies that are imported but were missing: - lib/lintplugin: @typescript-eslint/type-utils (imported by the throw-runtime-error rule) and @types/estree (used by regionComment.ts) - lib/vitest-reporter: @types/istanbul-lib-coverage (used by the coverage reporter) The lockfile only changes the affected workspace entries; the new descriptors resolve to versions that were already locked. Built bundle and tab outputs are byte-identical to master. Part of source-academy/docs#42
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Shrey5132
left a comment
There was a problem hiding this comment.
Checked the removed helpers/types and workspace dependencies against their imports, package exports, build configuration and lockfile; the newly declared type dependencies match actual imports. No blocking findings.
Validation: static source/reference and entry-point review plus the existing GitHub checks; I did not rerun this repository's build/test suite locally.
AaravMalani
left a comment
There was a problem hiding this comment.
LGTM! Would it be possible to add the knip configuration to the repository as well and/or add it as a Yarn script for future reference?
Part of source-academy/docs#42.
A dead-code pass with knip (configured for this monorepo's workspaces), each finding checked by hand and against the rest of the organisation.
src/archive,src/java,devserverand the bundles that open pull requests change (repl, sound, torch, maze) are left alone.Removed
lib/modules-lib/src/specialErrors.ts:interrupt()throwing'source_academy_interrupt'. Nothing imports it, and a code search of the organisation finds the string only in this file. (It was reachable through modules-lib's./*export and appeared in the generated docs.)resolveAliasedSymbolinlib/lintplugin/src/rules/typed/utils.ts: no caller sincethrowRuntimeErrorstopped using it.ParserSuccessandParserErrorinlib/typedoc-plugin/src/json.ts: declared, never used.ColorandNumbers3from the type re-export insrc/tabs/Csg/src/jscad/types.ts: nothing imports them through the tab.Unused dependencies (only comments mention them, or nothing at all):
js-slangfrom bundlesrobot_simulation,csgandrepeat;@sourceacademy/modules-libfrom bundlerepeatand tabRobotSimulation;@blueprintjs/corefrom tabPlotly;es-toolkitandgl-matrixfrom tabRune;react-domfrom tabRepeat. Bundles and tabs mark js-slang, react and Blueprint as external by name, so their builds do not depend on these entries.Added (used but not declared)
lib/lintplugin:@typescript-eslint/type-utils(imported bythrowRuntimeError.ts) and@types/estree(type import inregionComment.ts).lib/vitest-reporter:@types/istanbul-lib-coverage(type import incoverage-reporter.cts).The lockfile reuses the versions already installed.
Checks
yarn constraintsandyarn install --immutablepass. Typecheck, build and tests pass for every affected workspace (modules-lib, lint plugin, typedoc plugin, vitest reporter, bundles csg/repeat/robot_simulation, tabs Csg/Plotly/Rune/Repeat/RobotSimulation), and the 8 affected bundles and tabs build to the same output as on master. Three checks fail the same way on master and are not touched here: docstsc(3 errors in.vitepress/config.ts), one lint error inlib/repotools/src/testing/__tests__/testing.test.ts, and the lint ofbundles/robot_simulation.Not included: unused exports of
modules-lib(its exports are the documented API for bundle authors) and the unusedexportkeywords on internal helpers.