Skip to content

Commit b692e5e

Browse files
committed
rename for clarity
1 parent d3638a1 commit b692e5e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/src/utils.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, it, expect, beforeAll, afterAll } from "vitest";
22
import fs from "node:fs/promises";
33
import path from "node:path";
44
import os from "node:os";
5-
import { collectFiles } from "./utils";
5+
import { listMatchingFiles } from "./utils";
66

77
const conflictContent = `
88
{
@@ -43,7 +43,7 @@ describe("collectFiles", () => {
4343
});
4444

4545
it("collects only conflicted files by default", async () => {
46-
const files = await collectFiles({
46+
const files = await listMatchingFiles({
4747
root: tmpDir,
4848
fileFilter: file => file.endsWith(".json"),
4949
});
@@ -60,7 +60,7 @@ describe("collectFiles", () => {
6060
});
6161

6262
it("collects conflicted + clean files when includeNonConflicted is true", async () => {
63-
const files = await collectFiles({
63+
const files = await listMatchingFiles({
6464
root: tmpDir,
6565
fileFilter: file => file.endsWith(".json"),
6666
includeNonConflicted: true,
@@ -77,7 +77,7 @@ describe("collectFiles", () => {
7777
});
7878

7979
it("skips files that do not match fileFilter", async () => {
80-
const files = await collectFiles({
80+
const files = await listMatchingFiles({
8181
root: tmpDir,
8282
fileFilter: file => file.endsWith(".json"),
8383
});

lib/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ export interface CollectFilesOptions {
3939
* @param options - Collection options, including `fileFilter` and traversal root.
4040
* @returns A promise that resolves with an array of `{ filePath, content }`.
4141
*/
42-
export const collectFiles = async (options: CollectFilesOptions): Promise<FileEntry[]> => {
42+
export const listMatchingFiles = async (options: CollectFilesOptions): Promise<FileEntry[]> => {
4343
const { root = process.cwd(), fileFilter, includeNonConflicted = false } = options;
4444

45-
const collected: FileEntry[] = [];
45+
const fileEntries: FileEntry[] = [];
4646

4747
/**
4848
* Recursively traverses a directory, checking each file against
@@ -64,7 +64,7 @@ export const collectFiles = async (options: CollectFilesOptions): Promise<FileEn
6464
const content = await fs.readFile(fullPath, "utf8");
6565

6666
if (includeNonConflicted || hasConflict(content)) {
67-
collected.push({ filePath: fullPath, content });
67+
fileEntries.push({ filePath: fullPath, content });
6868
} else {
6969
console.info(`Skipped (no conflicts): ${fullPath}`);
7070
}
@@ -76,5 +76,5 @@ export const collectFiles = async (options: CollectFilesOptions): Promise<FileEn
7676
};
7777

7878
await walk(root);
79-
return collected;
79+
return fileEntries;
8080
};

0 commit comments

Comments
 (0)