mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 11:25:50 -06:00
feat(lint): enforce no-chained-type-assertions (#124119)
This commit is contained in:
committed by
GitHub
parent
4a6f99c2fc
commit
fe5fa802fa
@@ -0,0 +1,8 @@
|
||||
declare const input: unknown;
|
||||
|
||||
input as unknown as { readonly id: string };
|
||||
input as object as Record<string, unknown> as { readonly id: string };
|
||||
<{ readonly id: string }>(input as object);
|
||||
|
||||
input as { readonly id: string };
|
||||
({ id: "fixture" }) as const as const;
|
||||
@@ -18,6 +18,11 @@ const cases = [
|
||||
violation: `${FIXTURES}/widen-then-assert-violation.test.ts`,
|
||||
violations: 3,
|
||||
},
|
||||
{
|
||||
rule: "openclaw-boundaries/no-chained-type-assertions",
|
||||
violation: `${FIXTURES}/chained-type-assertions-violation.ts`,
|
||||
violations: 3,
|
||||
},
|
||||
];
|
||||
|
||||
function runGuard(target: string) {
|
||||
|
||||
@@ -254,6 +254,14 @@ describe("run-additional-boundary-checks", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps chained-type-assertions lint in CI boundary checks", () => {
|
||||
expect(BOUNDARY_CHECKS).toContainEqual({
|
||||
label: "lint:no-chained-type-assertions",
|
||||
command: "pnpm",
|
||||
args: ["run", "lint:no-chained-type-assertions"],
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the Telegram grammY type import guard in source boundary checks", () => {
|
||||
expect(BOUNDARY_CHECKS).toContainEqual({
|
||||
label: "lint:extensions:telegram-grammy-types",
|
||||
|
||||
Reference in New Issue
Block a user