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): require a name after the comma in welcome-back, end on backtick (#52)
Nguyễn Tuấn Anh15ef480e7285
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex df35f40..cf49b67 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -786,10 +786,14 @@ const rules = [fix: "Use that space for what a returning user came to do.",find({ code }) {// Flag the greeting with or without "!": "Welcome back", "Welcome back,- // Sarah", "Welcome back!". The lookahead is the guard against prose:- // the greeting must end at punctuation, a string/JSX boundary, or the- // end of the line, so "Welcome back to the team page" stays quiet.- return [...matches(/welcome back\s*(?:,[^"'<\n]*)?(?=[!?.]|["'}]|\s*<|$)/i, code)].map((m) => m.index);+ // Sarah", "Welcome back, {name}", "Welcome back!". The comma branch only+ // accepts a name (one or two words, or a {expression} or ${expression}), so prose after+ // the comma ("Welcome back, we have updated the team page.") stays+ // quiet. The lookahead is the guard against prose: the greeting must end+ // at punctuation, a string/JSX boundary (including a closing+ // backtick), or the end of the line, so "Welcome back to the team page"+ // stays quiet.+ return [...matches(/welcome back\s*(?:,\s*(?:\$?\{[^}\n]*\}|[A-Za-z][A-Za-z'’\-]*(?:\s+[A-Za-z][A-Za-z'’\-]*)?))?(?=[!?.]|["'`}]|\s*<|$)/i, code)].map((m) => m.index);},},{diff --git a/test/detect.test.js b/test/detect.test.jsindex 6689139..a24f9b2 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -259,6 +259,14 @@ test("welcome-back fires with or without '!'", () => {assert.deepStrictEqual(scanSource("<Text>Welcome back, Sarah</Text>\n", "a.tsx").map((f) => f.rule), ["welcome-back"]);// Prose that only contains the words stays quiet.assert.deepStrictEqual(scanSource("<p>Welcome back to the team page</p>\n", "a.tsx"), []);+ // A sentence after the comma is prose, not a name.+ assert.deepStrictEqual(scanSource("<p>Welcome back, we have updated the team page.</p>\n", "a.tsx"), []);+ // A closing backtick ends the greeting.+ assert.deepStrictEqual(scanSource("const title = `Welcome back`;\n", "a.ts").map((f) => f.rule), ["welcome-back"]);+ // A template literal with the name interpolated still counts.+ assert.deepStrictEqual(scanSource("const title = `Welcome back, ${name}`;\n", "a.ts").map((f) => f.rule), ["welcome-back"]);+ // A two-word name after the comma still counts.+ assert.deepStrictEqual(scanSource("<Text>Welcome back, Mary Jane</Text>\n", "a.tsx").map((f) => f.rule), ["welcome-back"]);});test("XML ignore comments work", () => {