refactor: optimize dependency tree and remove unused packages (#175)#206
Merged
refactor: optimize dependency tree and remove unused packages (#175)#206
Conversation
Completed comprehensive dependency audit and optimization for Issue #175. Changes: - Deduplicated dependencies with npm dedupe (removed 3 duplicates) - Removed unused ESLint plugins (eslint-plugin-import, eslint-plugin-prettier) - Analyzed all dependencies with depcheck and code verification - Documented optimization rationale and findings Results: - Total size: 264 MB → 263 MB (-1 MB, -0.4%) - Package count: 904 → 900 (-4 packages) - Dependency tree health improved - All tests passing (100%) - Build successful (bundle: 118.6kb) Analysis: - Verified all remaining dependencies as required - Documented false positives from depcheck - Identified constraints preventing further reduction (large required tooling) - Created comprehensive optimization report See DEPENDENCY_OPTIMIZATION_REPORT.md for full analysis. Closes #175
kitelev
added a commit
that referenced
this pull request
Dec 21, 2025
Closes #1096 Add js/unused-local-variable to CodeQL SARIF filtering for main.js to handle unused variables from bundled third-party code: - reflect-metadata polyfills (import_reflect_metadata) - RDF type constants (XSD_STRING3, XSD_INTEGER, XSD_DECIMAL) - Bundler artifacts (errorInfo, depEndTime, resultFpsPercentage, pad) These are valid bundler artifacts where not all exports from libraries are used, but esbuild includes them for module resolution compatibility. Also documents the filter in codeql-config.yml query-filters for consistency with other bundled code filters. Note: Test file alerts (#186, #206, #207) are stale - they reference code that was already fixed in PR #924 or are intentional side-effect imports. These will auto-dismiss on next CodeQL scan.
3 tasks
kitelev
added a commit
that referenced
this pull request
Dec 21, 2025
Closes #1096 Add js/unused-local-variable to CodeQL SARIF filtering for main.js to handle unused variables from bundled third-party code: - reflect-metadata polyfills (import_reflect_metadata) - RDF type constants (XSD_STRING3, XSD_INTEGER, XSD_DECIMAL) - Bundler artifacts (errorInfo, depEndTime, resultFpsPercentage, pad) These are valid bundler artifacts where not all exports from libraries are used, but esbuild includes them for module resolution compatibility. Also documents the filter in codeql-config.yml query-filters for consistency with other bundled code filters. Note: Test file alerts (#186, #206, #207) are stale - they reference code that was already fixed in PR #924 or are intentional side-effect imports. These will auto-dismiss on next CodeQL scan.
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.
Summary
Completed comprehensive dependency audit and optimization to address Issue #175 (Reduce node_modules size).
Changes
Optimizations Applied
Deduplication (
npm dedupe)Unused Package Removal
eslint-plugin-import(not used ineslint.config.mjs)eslint-plugin-prettier(not used ineslint.config.mjs)Results
Analysis Performed
False Positives (Verified as REQUIRED)
Depcheck incorrectly flagged these as unused:
builtin-modules- used inesbuild.config.mjs:3,138preact/@preact/compat- used inesbuild.config.mjs:147-149(React alias)ts-jest- used injest.ui.config.js:15jest-environment-obsidian- used injest.ui.config.js:9,12jest-environment-jsdom- used injest.config.js:3@typescript-eslint/*- used ineslint.config.mjsConstraints Preventing Further Reduction
Large Required Dependencies:
eslint-plugin-obsidianmd(34 MB) - Obsidian-specific lintingtypescript(23 MB) - build toolchain@babel(14 MB) - Jest ES module transformationplaywright-core(8.5 MB) - E2E testingTransitive Dependencies:
moment(5.1 MB) - required by Obsidian package (cannot remove)Essential Tooling:
Documentation
Created comprehensive
DEPENDENCY_OPTIMIZATION_REPORT.mdwith:Testing
All quality gates passed:
Why Target (<200 MB) Not Achieved
Initial issue estimated 367 MB, but actual size was already 264 MB (optimized by previous work).
The 1 MB savings represents maximum optimization within current npm + toolchain constraints.
To reach <200 MB would require:
Recommendations
Short Term
build-meta.json)Medium Term
Long Term
Value Delivered
While the 1 MB savings is modest, the primary value is:
Closes
Breaking Changes
None
Additional Notes
This PR represents pragmatic optimization within current constraints. Further size reduction requires infrastructure changes (pnpm migration) warranting separate evaluation.