fix: exclude ios/android directories only at mobile app root in collectSources
The excludedDirectories set included 'ios' and 'android', causing collectSources to skip these directory names at any nesting depth. This meant nested directories like modules/t3-terminal/ios/ were also excluded, so no Swift/Kotlin source files were ever discovered and linters never ran. Split into rootOnlyExcludedDirectories (ios, android) that are only skipped at the top-level mobile app root, allowing nested module source directories to be traversed correctly.
This commit is contained in:
1 file changed
+10
-4
@@ -40,15 +40,16 @@ const sourceExtensions = new Set([".swift", ".kt", ".kts"]);
|
||||
const excludedDirectories = new Set([
|
||||
".expo",
|
||||
".git",
|
||||
"android",
|
||||
"build",
|
||||
"DerivedData",
|
||||
"ios",
|
||||
"node_modules",
|
||||
"Pods",
|
||||
"Vendor",
|
||||
]);
|
||||
|
||||
/** Expo prebuild output directories — only excluded at the mobile app root. */
|
||||
const rootOnlyExcludedDirectories = new Set(["android", "ios"]);
|
||||
|
||||
const appRoot = Effect.service(Path.Path).pipe(
|
||||
Effect.flatMap((path) => path.fromFileUrl(new URL("../apps/mobile", import.meta.url))),
|
||||
);
|
||||
@@ -108,6 +109,7 @@ const runCommand = Effect.fn("runCommand")(function* (
|
||||
|
||||
function collectSources(
|
||||
directory: string,
|
||||
isRoot: boolean,
|
||||
): Effect.Effect<
|
||||
ReadonlyArray<string>,
|
||||
PlatformError.PlatformError,
|
||||
@@ -124,11 +126,15 @@ function collectSources(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isRoot && rootOnlyExcludedDirectories.has(entry)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const entryPath = path.join(directory, entry);
|
||||
const stat = yield* fs.stat(entryPath);
|
||||
|
||||
if (stat.type === "Directory") {
|
||||
sources.push(...(yield* collectSources(entryPath)));
|
||||
sources.push(...(yield* collectSources(entryPath, false)));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -144,7 +150,7 @@ function collectSources(
|
||||
const runNativeStaticChecks = Effect.fn("runNativeStaticChecks")(function* () {
|
||||
const path = yield* Path.Path;
|
||||
const root = yield* appRoot;
|
||||
const sources = yield* collectSources(root);
|
||||
const sources = yield* collectSources(root, true);
|
||||
const swiftSources = sources.filter((source) => path.extname(source) === ".swift");
|
||||
const kotlinSources = sources.filter((source) => {
|
||||
const extension = path.extname(source);
|
||||
|
||||
Reference in new issue
Block a user