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(drawer-nav): match Flutter CupertinoIcons.bars and line_horizontal_3 (#353)

Shreeyassh7c781fec0c10
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index e1233a6..31a0bbf 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1196,7 +1196,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)?|bars)["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\b(?:Modal|Dismissible)NavigationDrawer\s*\(|\b(?:drawer|endDrawer):\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|<IonMenu(?:Button|Toggle)?\b|<(?:q-drawer|QDrawer)(?![\w-])|<(?:mat-sidenav|mat-drawer)(?![\w-])|<(?:v-navigation-drawer|VNavigationDrawer)(?![\w-])|\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|\bCupertinoIcons\.(?:bars|line_horizontal_3)\b|\b(?:name|icon)=["'](?:menu(?:-outline|-sharp)?|bars)["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\b(?:Modal|Dismissible)NavigationDrawer\s*\(|\b(?:drawer|endDrawer):\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|<IonMenu(?:Button|Toggle)?\b|<(?:q-drawer|QDrawer)(?![\w-])|<(?:mat-sidenav|mat-drawer)(?![\w-])|<(?:v-navigation-drawer|VNavigationDrawer)(?![\w-])|\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 bf39c32..281f5d6 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -3494,6 +3494,26 @@ test("drawer-nav catches Compose DismissibleNavigationDrawer and ModalNavigation
assert.deepStrictEqual(drawerLines(unusedImport), []);
});
+test("drawer-nav catches Flutter CupertinoIcons.bars and line_horizontal_3 (issue #338)", () => {
+ const drawerLines = (src, file = "home.dart") =>
+ scanSource(src, file, { kind: "mobile" }).filter((f) => f.rule === "drawer-nav").map((f) => f.line);
+
+ for (const icon of [
+ "CupertinoIcons.bars",
+ "CupertinoIcons.line_horizontal_3",
+ "Icons.menu",
+ ]) {
+ assert.deepStrictEqual(drawerLines(`Icon(${icon})\n`), [1], icon);
+ }
+
+ for (const quiet of [
+ "CupertinoIcons.line_horizontal_3_decrease",
+ "CupertinoIcons.line_horizontal_3_decrease_circle",
+ ]) {
+ assert.deepStrictEqual(drawerLines(`Icon(${quiet})\n`), [], quiet);
+ }
+});
+
test("img-no-alt catches Vant van-image and VanImage without alt (issue #340)", () => {
const imgLines = (src, file = "Avatar.vue") =>
scanSource(src, file, { kind: "web" }).filter((f) => f.rule === "img-no-alt").map((f) => f.line);