Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unused exports #164935

Closed
joyceerhl opened this issue Oct 28, 2022 · 3 comments
Closed

Reduce unused exports #164935

joyceerhl opened this issue Oct 28, 2022 · 3 comments
Labels
debt Code quality issues

Comments

@joyceerhl
Copy link
Contributor

joyceerhl commented Oct 28, 2022

@rebornix and I were wondering if there is any dead code in the VS Code codebase, and one idea was to detect unused exports across the codebase, since unused variables are flagged by the compiler but unused exports are not.

I ran ts-unused-exports on our sources and generated the following list. I've already done a pass to remove some false positives but apologies if several remain.

NB: The primary purpose of this issue is to identify unused functions and classes which aren't being picked up by the compiler because they're exported and which can be safely deleted from our sources to reduce our bundle size. A secondary benefit is to remove unused types and interfaces, e.g. anything which was exported at one point and then ceased to be referenced from other files (which more impacts compile time for dev workflows and pipeline runs, and maybe TS server analysis time, but has no direct impact on bundle size since types are erased).

If you export a type or interface that is not currently actively imported, but is used in the public API of a class that you expose, then it's quite likely that you want to keep that type/interface exported and need not un-export it as part of this issue.

Please feel free to remove your assignment if you find that this isn't valuable.

Git blame Function File
@andreamah notebookEditorBackground src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
@andreamah IWorkerFileSystemFileHandle src/vs/workbench/services/search/common/localFileSearchWorkerTypes.ts
@andreamah create src/vs/workbench/services/search/worker/localFileSearch.ts
@andreamah LocalFileSearchSimpleWorker src/vs/workbench/services/search/worker/localFileSearch.ts
@chrmarti IQuickInputWidgetStyles src/vs/base/parts/quickinput/browser/quickInput.ts
@chrmarti IChangeEOLEntry src/vs/workbench/browser/parts/editor/editorStatus.ts
@chrmarti WalkThroughModel src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughInput.ts
@connor4312 IObjectTreeViewState src/vs/base/browser/ui/tree/objectTree.ts
@connor4312 INotebookRendererContribution src/vs/platform/extensions/common/extensions.ts
@connor4312 MirroredTestCollection src/vs/workbench/api/common/extHostTesting.ts
@connor4312 ICustomWebviewViewDescriptor src/vs/workbench/common/views.ts
@connor4312 ISuggestEnabledHistoryOptions src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts
@connor4312 IMemoryRange src/vs/workbench/contrib/debug/common/debug.ts
@connor4312 IValidMemoryRange src/vs/workbench/contrib/debug/common/debug.ts
@connor4312 IUnreadableMemoryRange src/vs/workbench/contrib/debug/common/debug.ts
@connor4312 IErrorMemoryRange src/vs/workbench/contrib/debug/common/debug.ts
@connor4312 Enablement src/vs/workbench/contrib/debug/common/debugModel.ts
@connor4312 BaseBreakpoint src/vs/workbench/contrib/debug/common/debugModel.ts
@connor4312 Memory src/vs/workbench/contrib/debug/common/debugModel.ts
@connor4312 INotebookRendererContribution src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.ts
@connor4312 isTenativeCharacterPrediction src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts
@connor4312 PredictionTimeline src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts
@connor4312 terminalsExtPoint src/vs/workbench/contrib/terminal/common/terminalExtensionPoints.ts
@connor4312 HideTestAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 UnhideTestAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RunUsingProfileAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RunAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 SelectDefaultTestProfiles src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 ConfigureTestProfilesAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RunSelectedAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugSelectedAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RunAllAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugAllAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 CancelTestRunAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 TestingViewAsListAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 TestingViewAsTreeAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 TestingSortByStatusAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 TestingSortByLocationAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 TestingSortByDurationAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 ShowMostRecentOutputAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 CollapseAllAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 ClearTestResultsAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 GoToTest src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RunAtCursor src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugAtCursor src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RunCurrentFile src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugCurrentFile src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 ReRunFailedTests src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugFailedTests src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 ReRunLastRun src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 DebugLastRun src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 SearchForTestExtension src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 OpenOutputPeek src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 ToggleInlineTestOutput src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 RefreshTestsAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 CancelTestRefreshAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@connor4312 TestingExplorerViewModel src/vs/workbench/contrib/testing/browser/testingExplorerView.ts
@connor4312 TestResultElement src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts
@connor4312 TestCaseElement src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts
@connor4312 testingColorIconFailed src/vs/workbench/contrib/testing/browser/theme.ts
@connor4312 testingColorIconErrored src/vs/workbench/contrib/testing/browser/theme.ts
@connor4312 testingColorIconPassed src/vs/workbench/contrib/testing/browser/theme.ts
@connor4312 testingColorIconQueued src/vs/workbench/contrib/testing/browser/theme.ts
@connor4312 testingColorIconUnset src/vs/workbench/contrib/testing/browser/theme.ts
@connor4312 testingColorIconSkipped src/vs/workbench/contrib/testing/browser/theme.ts
@connor4312 ListElementType src/vs/workbench/contrib/testing/browser/explorerProjections/hierarchalByName.ts
@connor4312 testIdentityProvider src/vs/workbench/contrib/testing/browser/explorerProjections/nodeHelper.ts
@connor4312 pruneNodesWithParentsNotInTree src/vs/workbench/contrib/testing/browser/explorerProjections/nodeHelper.ts
@connor4312 AutoRunMode src/vs/workbench/contrib/testing/common/configuration.ts
@connor4312 ITestingConfiguration src/vs/workbench/contrib/testing/common/configuration.ts
@connor4312 TestExplorerStateFilter src/vs/workbench/contrib/testing/common/constants.ts
@connor4312 testStateNames src/vs/workbench/contrib/testing/common/constants.ts
@connor4312 isDurationAccessor src/vs/workbench/contrib/testing/common/getComputedState.ts
@connor4312 getComputedState src/vs/workbench/contrib/testing/common/getComputedState.ts
@connor4312 getComputedDuration src/vs/workbench/contrib/testing/common/getComputedState.ts
@connor4312 IStoredValueSerialization src/vs/workbench/contrib/testing/common/storedValue.ts
@connor4312 ICoverageAccessor src/vs/workbench/contrib/testing/common/testCoverage.ts
@connor4312 FileCoverage src/vs/workbench/contrib/testing/common/testCoverage.ts
@connor4312 allTestFilterTerms src/vs/workbench/contrib/testing/common/testExplorerFilterState.ts
@connor4312 ITestItemUpsertChild src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemUpdateCanResolveChildren src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemSetTags src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemRemoveChild src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemSetProp src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemBulkReplace src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemDocumentSynced src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestItemCollectionOptions src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 DuplicateTestItemError src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 MixedTestItemController src/vs/workbench/contrib/testing/common/testItemCollection.ts
@connor4312 ITestRunTaskResults src/vs/workbench/contrib/testing/common/testResult.ts
@connor4312 sumCounts src/vs/workbench/contrib/testing/common/testResult.ts
@connor4312 allChangedResults src/vs/workbench/contrib/testing/common/testResultService.ts
@connor4312 isRunningTests src/vs/workbench/contrib/testing/common/testResultService.ts
@connor4312 BaseTestResultStorage src/vs/workbench/contrib/testing/common/testResultStorage.ts
@connor4312 TestDiffListener src/vs/workbench/contrib/testing/common/testService.ts
@connor4312 getCollectionItemParents src/vs/workbench/contrib/testing/common/testService.ts
@connor4312 getAllTestsInHierarchy src/vs/workbench/contrib/testing/common/testService.ts
@connor4312 waitForTestToBeIdle src/vs/workbench/contrib/testing/common/testService.ts
@connor4312 ITestTagDisplayInfo src/vs/workbench/contrib/testing/common/testTypes.ts
@connor4312 ITestCoverage src/vs/workbench/contrib/testing/common/testTypes.ts
@connor4312 IBranchCoverage src/vs/workbench/contrib/testing/common/testTypes.ts
@connor4312 IFunctionCoverage src/vs/workbench/contrib/testing/common/testTypes.ts
@connor4312 IStatementCoverage src/vs/workbench/contrib/testing/common/testTypes.ts
@connor4312 TreeStateNode src/vs/workbench/contrib/testing/common/testingStates.ts
@connor4312 stateNodes src/vs/workbench/contrib/testing/common/testingStates.ts
@connor4312 isRunningState src/vs/workbench/contrib/testing/common/testingStates.ts
@connor4312 TestObjectTree src/vs/workbench/contrib/testing/test/browser/testObjectTree.ts
@connor4312 UnhideAllTestsAction src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
@andreamah
Copy link
Contributor

Created #165070 for this. The other ones that are listed in search are actually used in some code for the web, so I'll keep them exported.

chrmarti added a commit that referenced this issue Nov 1, 2022
@chrmarti
Copy link
Contributor

chrmarti commented Nov 1, 2022

IQuickInputWidgetStyles is the type of a property that is used outside of src/vs/base/parts/quickinput/browser/quickInput.ts. Leaving that as-is and removing the others.

@chrmarti chrmarti removed their assignment Nov 1, 2022
chrmarti added a commit that referenced this issue Nov 1, 2022
@andreamah andreamah removed their assignment Nov 1, 2022
@connor4312 connor4312 added the debt Code quality issues label Nov 7, 2022
@connor4312
Copy link
Member

The lint rule does not seem to be good at identifying things that are transitively used. E.g. if I have something like this

type A = foo;
type B = bar;
type C = A | B

if type C is used, I want both A and B to be exported so consumers can refer to them if needed (even if no one is doing so at the moment). Anyhow, I'll clean up others...

@connor4312 connor4312 removed their assignment Dec 12, 2022
connor4312 added a commit that referenced this issue Dec 12, 2022
connor4312 added a commit that referenced this issue Jan 6, 2023
* testing: review implicit public fields

For #166603

* debt: reduce unused exports

For #164935
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues
Projects
None yet
Development

No branches or pull requests

4 participants