Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(scripts): check:changed lints Astro components and runs knip for them #29573

Mergedsaphid(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/29573/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 13 additions and 1 deletion.

x
0 of 2 viewed, 2 left
11 additions and 0 deletionsscripts/check-changed.test.tsModified
View file
@@ -407,6 +407,17 @@
expect(result.stdout).toContain("fixture stderr: lint");
});
​
+it("lints an Astro component and runs knip when only it changed", () => {
+ using project = launcherFixture();
+ const page = "packages/example/Page.astro";
+ project.write(page, "---\nconst title = 1;\n---\n<h1>{title}</h1>\n");
+ const result = project.run();
+ expect(result.status, result.stdout + result.stderr).toBe(0);
+ const calls = project.calls();
+ expect(calls.find(({ args }) => args[0] === "lint")?.args).toEqual(["lint", page]);
+ expect(calls.some(({ args }) => args[0] === "exec" && args[1] === "knip")).toBe(true);
+});
+​
it.each(["install", "lint"])("reports a failing %s step with its output", (step) => {
using project = launcherFixture();
project.write(project.source, "export const value = 2;\n");
2 additions and 1 deletionscripts/check-changed.tsModified
View file
@@ -172,7 +172,8 @@
return closest;
});
​
-const CODE = /\.[cm]?[jt]sx?$/;
+// CI's lint and knip also read Astro components' frontmatter.
+const CODE = /\.(?:[cm]?[jt]sx?|astro)$/;
const TEST = /\.test\.[cm]?[jt]sx?$/;