ci: guard extension wildcard reexports

This commit is contained in:
Peter Steinberger
2026-04-27 20:34:21 +01:00
parent f7d67b8ea8
commit 31e529f000
6 changed files with 156 additions and 0 deletions

View File

@@ -259,6 +259,7 @@ describe("scripts/changed-lanes", () => {
expect(plan.commands.map((command) => command.name)).toEqual([
"conflict markers",
"changelog attributions",
"guarded extension wildcard re-exports",
"plugin-sdk wildcard re-exports",
"typecheck core tests",
"lint core",
@@ -547,6 +548,7 @@ describe("scripts/changed-lanes", () => {
expect(plan.commands.map((command) => command.args[0])).toEqual([
"check:no-conflict-markers",
"check:changelog-attributions",
"lint:extensions:no-guarded-wildcard-reexports",
"lint:extensions:no-plugin-sdk-wildcard-reexports",
"release-metadata:check",
"ios:version:check",
@@ -679,6 +681,10 @@ describe("scripts/changed-lanes", () => {
expect(plan.commands).toEqual([
{ name: "conflict markers", args: ["check:no-conflict-markers"] },
{ name: "changelog attributions", args: ["check:changelog-attributions"] },
{
name: "guarded extension wildcard re-exports",
args: ["lint:extensions:no-guarded-wildcard-reexports"],
},
{
name: "plugin-sdk wildcard re-exports",
args: ["lint:extensions:no-plugin-sdk-wildcard-reexports"],
@@ -694,6 +700,10 @@ describe("scripts/changed-lanes", () => {
expect(plan.commands).toEqual([
{ name: "conflict markers", args: ["check:no-conflict-markers"] },
{ name: "changelog attributions", args: ["check:changelog-attributions"] },
{
name: "guarded extension wildcard re-exports",
args: ["lint:extensions:no-guarded-wildcard-reexports"],
},
{
name: "plugin-sdk wildcard re-exports",
args: ["lint:extensions:no-plugin-sdk-wildcard-reexports"],

View File

@@ -0,0 +1,31 @@
import { describe, expect, it } from "vitest";
import { findLocalWildcardReexports } from "../../scripts/check-extension-wildcard-reexports.mjs";
describe("check-extension-wildcard-reexports", () => {
it("flags local wildcard re-exports", () => {
expect(
findLocalWildcardReexports(
[
'export * from "./src/runtime-api.js";',
'export type * from "../api.js";',
'export { named } from "./src/runtime-api.js";',
].join("\n"),
),
).toEqual([
{ line: 1, text: 'export * from "./src/runtime-api.js";' },
{ line: 2, text: 'export type * from "../api.js";' },
]);
});
it("allows explicit local exports and external wildcard barrels", () => {
expect(
findLocalWildcardReexports(
[
'export { named } from "./src/runtime-api.js";',
'export type { Named } from "../api.js";',
'export * from "external-package";',
].join("\n"),
),
).toEqual([]);
});
});