Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

fix(detect): catch Ionic's IonMenuToggle in drawer-nav (#274)

Papito084289013cd103b
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index e209f43..1add90f 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1175,7 +1175,7 @@ const rules = [
message: "Hamburger menu or navigation drawer. It hides the top destinations behind a tap.",
fix: "Ask first. Use tabs for three to five peer destinations; keep a drawer only for many destinations or a large-screen rail.",
find({ code }) {
- const re = /["']line\.(?:3\.horizontal|horizontal\.3)["']|\bIcons\.(?:Default\.|Filled\.|Outlined\.|Rounded\.|Sharp\.)?Menu\b|\bIcons\.menu(?:_rounded|_outlined|_sharp)?\b|\b(?:name|icon)=["']menu(?:-outline|-sharp)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\bModalNavigationDrawer\b|\bdrawer:\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|<IonMenu(?:Button)?\b|\bBars3(?:BottomLeft|BottomRight|CenterLeft)?Icon\b|\bIconMenu2\b/;
+ const re = /["']line\.(?:3\.horizontal|horizontal\.3)["']|\bIcons\.(?:Default\.|Filled\.|Outlined\.|Rounded\.|Sharp\.)?Menu\b|\bIcons\.menu(?:_rounded|_outlined|_sharp)?\b|\b(?:name|icon)=["']menu(?:-outline|-sharp)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\bModalNavigationDrawer\b|\bdrawer:\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|<IonMenu(?:Button|Toggle)?\b|\bBars3(?:BottomLeft|BottomRight|CenterLeft)?Icon\b|\bIconMenu2\b/;
const first = matches(re, code).next();
return first.done ? [] : [first.value.index];
},
diff --git a/test/detect.test.js b/test/detect.test.js
index d6c8810..a235465 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -2190,6 +2190,31 @@ test("drawer-nav catches React Native Paper's icon=\"menu\" (issue #226)", () =>
assert.deepStrictEqual(lines('<Appbar.Action icon="dots-vertical" />\n'), []);
});
+test("drawer-nav catches Ionic's IonMenuToggle (issue #265)", () => {
+ const lines = (src, file = "Header.tsx") => scanSource(src, file, { platform: "mobile" }).filter((f) => f.rule === "drawer-nav").map((f) => [f.line, f.severity]);
+ // Issue #265 repro:
+ const repro = [
+ 'import { IonMenuToggle, IonButton } from "@ionic/react";',
+ "",
+ "export function Header() {",
+ " return (",
+ " <IonMenuToggle>",
+ " <IonButton>Menu</IonButton>",
+ " </IonMenuToggle>",
+ " );",
+ "}",
+ ].join("\n");
+ assert.deepStrictEqual(lines(repro), [[5, "noticeable"]]);
+
+ // Tag variants
+ for (const tag of ["IonMenu", "IonMenuButton", "IonMenuToggle", "ion-menu", "ion-menu-button", "ion-menu-toggle"]) {
+ assert.deepStrictEqual(lines(`<${tag} />\n`), [[1, "noticeable"]], tag);
+ }
+
+ // Quiet cases: IonTabs and IonTabBar
+ assert.deepStrictEqual(lines("<IonTabs>\n <IonTabBar slot=\"bottom\" />\n</IonTabs>\n"), []);
+});
+
test("keyboard-cover flags a bare TextInput on a screen file, not in a reusable input", () => {
const rulesFor = (src, file) => scanSource(src, file).filter((f) => f.rule === "keyboard-cover").map((f) => f.line);
const bare = 'import { TextInput, View } from "react-native";\n\nexport default function Login() {\n return (\n <View>\n <TextInput placeholder="Email" />\n </View>\n );\n}\n';