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.
JavaScript accessibilityagent-skillsagent-skills-toolsagentsagentskillsai-slopclaudeclaude-codeclaude-skillsexpoflutterfrontendionicjetpack-composemobilereact-nativeswiftuiuiuxvibe-coding
fix(detect): flag .ignoresSafeArea(.all) in safe-area-off (#55)
Nguyễn Tuấn Anh37e0d271288a
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex cf49b67..e2a43af 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -565,7 +565,7 @@ const rules = [fix: "Ignore the safe area for backgrounds only, e.g. .background(Color.surface.ignoresSafeArea()).",find({ code }) {const hits = [];- for (const m of matches(/\.ignoresSafeArea\(\s*\)|\.edgesIgnoringSafeArea\(\s*\.all\s*\)/, code)) {+ for (const m of matches(/\.ignoresSafeArea\(\s*(?:\.(?:all|container)\s*)?(?:,?\s*edges:\s*\.all\s*)?\)|\.edgesIgnoringSafeArea\(\s*\.all\s*\)/, code)) {const lineStart = code.lastIndexOf("\n", m.index) + 1;if (/background|Color\(|Color\.|Image\(|Gradient|Rectangle\(\)|Divider\(\)/.test(code.slice(lineStart, m.index))) continue;hits.push(m.index);diff --git a/test/detect.test.js b/test/detect.test.jsindex a24f9b2..ccb3c23 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -57,6 +57,25 @@ test("every rule has a fixture that triggers it", () => {for (const rule of rules) assert.ok(all.has(rule.id), `no fixture for ${rule.id}`);});+test("safe-area-off flags .ignoresSafeArea(.all) forms, not backgrounds", () => {+ const flagged = [+ "VStack { }.ignoresSafeArea(.all)",+ "VStack { }.ignoresSafeArea(.container, edges: .all)",+ "VStack { }.ignoresSafeArea(edges: .all)",+ ];+ for (const src of flagged) {+ assert.deepStrictEqual(scanSource(src, "a.swift").map((f) => f.rule), ["safe-area-off"]);+ }+ // .container with no edges means all edges, the same as (.container, edges: .all).+ assert.deepStrictEqual(scanSource("VStack { }.ignoresSafeArea(.container)", "a.swift").map((f) => f.rule), ["safe-area-off"]);+ assert.deepStrictEqual(scanSource("Color.red.ignoresSafeArea(.all)", "a.swift"), []);+ // Keyboard-only and single-edge uses are legitimate.+ assert.deepStrictEqual(scanSource("VStack { }.ignoresSafeArea(.keyboard, edges: .all)", "a.swift"), []);+ assert.deepStrictEqual(scanSource("VStack { }.ignoresSafeArea(.keyboard)", "a.swift"), []);+ assert.deepStrictEqual(scanSource("VStack { }.ignoresSafeArea(.all, edges: .bottom)", "a.swift"), []);+ assert.deepStrictEqual(scanSource("VStack { }.ignoresSafeArea(edges: .top)", "a.swift"), []);+});+test("commented-out code is ignored", () => {const src = '// <LinearGradient colors={["#7C3AED", "#EC4899"]} />\n/* Oops! Something went wrong */\n';assert.deepStrictEqual(scanSource(src, "a.tsx"), []);diff --git a/test/fixtures/slop/Dashboard.swift b/test/fixtures/slop/Dashboard.swiftindex c4deb82..63df911 100644--- a/test/fixtures/slop/Dashboard.swift+++ b/test/fixtures/slop/Dashboard.swift@@ -19,6 +19,8 @@ struct Dashboard: View {.navigationBarBackButtonHidden(true).toolbar { Image(systemName: "line.3.horizontal") }.ignoresSafeArea()+ .ignoresSafeArea(.all)+ .ignoresSafeArea(.container, edges: .all).overlay { Text("A").background(.ultraThinMaterial) }.safeAreaInset(edge: .top) { Text("B").background(.thinMaterial) }.toolbarBackground(.regularMaterial)