Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/cli/src/utils/lintProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,19 @@ describe("multiple_root_compositions", () => {
expect(finding).toBeUndefined();
});

it("ignores macOS AppleDouble HTML metadata files", async () => {
const project = makeProject(validHtml());
writeFileSync(join(project, "._index.html"), validHtml());
mkdirSync(join(project, "compositions"), { recursive: true });
writeFileSync(join(project, "compositions", "._scene.html"), validHtml("scene"));
const { results } = await lintProject(project);
const finding = results[0]?.result.findings.find(
(f) => f.code === "multiple_root_compositions",
);
expect(finding).toBeUndefined();
expect(results.some((result) => result.file.includes("._"))).toBe(false);
});

it("ignores HTML files without data-composition-id", async () => {
const project = makeProject(validHtml());
writeFileSync(join(project, "readme.html"), "<html><body>Not a composition</body></html>");
Expand Down
8 changes: 6 additions & 2 deletions packages/lint/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ export async function lintProject(projectDir: string): Promise<ProjectLintResult
for (const entry of readdirSync(dir, { withFileTypes: true })) {
const relPath = rel ? `${rel}/${entry.name}` : entry.name;
if (entry.isDirectory()) out.push(...collectHtmlFiles(join(dir, entry.name), relPath));
else if (entry.isFile() && entry.name.endsWith(".html")) out.push(relPath);
else if (entry.isFile() && entry.name.endsWith(".html") && !entry.name.startsWith("._")) {
out.push(relPath);
}
}
return out;
};
Expand Down Expand Up @@ -442,7 +444,9 @@ function lintTextureMaskAssetNotFound(
function lintMultipleRootCompositions(projectDir: string): HyperframeLintFinding[] {
const findings: HyperframeLintFinding[] = [];
try {
const rootHtmlFiles = readdirSync(projectDir).filter((f) => f.endsWith(".html"));
const rootHtmlFiles = readdirSync(projectDir).filter(
(file) => file.endsWith(".html") && !file.startsWith("._"),
);
const rootCompositions: string[] = [];
for (const file of rootHtmlFiles) {
if (file === "caption-skin.html") continue;
Expand Down
Loading