TypeScript
refactor(mobile): remove unused file tree walkers (#10003)
Julius Marminge8d48a3134f4d
diff --git a/apps/mobile/src/features/files/fileTree.test.ts b/apps/mobile/src/features/files/fileTree.test.tsindex 7345a7f366c..edab2ba687b 100644--- a/apps/mobile/src/features/files/fileTree.test.ts+++ b/apps/mobile/src/features/files/fileTree.test.ts@@ -1,13 +1,7 @@import { describe, expect, it } from "vite-plus/test";import type { ProjectEntry } from "@t3tools/contracts";-import {- buildFileTree,- countFileNodes,- defaultExpandedTreePaths,- firstFilePath,- flattenFileTree,-} from "./fileTree";+import { buildFileTree, defaultExpandedTreePaths, flattenFileTree } from "./fileTree";const entries = [{ kind: "file", path: "README.md" },@@ -30,8 +24,6 @@ describe("mobile file tree helpers", () => {"directory:src/components","file:src/index.ts",]);- expect(countFileNodes(tree)).toBe(4);- expect(firstFilePath(tree)).toBe("src/components/App.tsx");});it("flattens expanded directories and hides collapsed descendants", () => {diff --git a/apps/mobile/src/features/files/fileTree.ts b/apps/mobile/src/features/files/fileTree.tsindex 28b5822aaa0..2e0b8140329 100644--- a/apps/mobile/src/features/files/fileTree.ts+++ b/apps/mobile/src/features/files/fileTree.ts@@ -117,18 +117,6 @@ export function buildFileTree(entries: ReadonlyArray<ProjectEntry>): ReadonlyArrreturn [...root.children.values()].sort(compareNodes).map(freezeNode);}-export function countFileNodes(nodes: ReadonlyArray<FileTreeNode>): number {- let count = 0;- for (const node of nodes) {- if (node.kind === "file") {- count += 1;- } else {- count += countFileNodes(node.children);- }- }- return count;-}-export function defaultExpandedTreePaths(nodes: ReadonlyArray<FileTreeNode>): ReadonlySet<string> {const expanded = new Set<string>();for (const node of nodes) {@@ -205,16 +193,3 @@ export function flattenFileTree(input: {}return output;}--export function firstFilePath(nodes: ReadonlyArray<FileTreeNode>): string | null {- for (const node of nodes) {- if (node.kind === "file") {- return node.path;- }- const child = firstFilePath(node.children);- if (child !== null) {- return child;- }- }- return null;-}