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): let a JSX comment on the line above silence the next line (#95)
Manuel Gasparini6c8591c7d81a
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex 52b19cb..23cdd19 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -1070,7 +1070,7 @@ function walk(target, opts, out = []) {// silences the next line.function ignoredByComment(lines, line, ruleId) {const previous = lines[line - 2];- const own = previous && /^\s*(?:\/\/|\/\*|\*|<!--|#)/.test(previous) ? previous : null;+ const own = previous && /^\s*(?:\/\/|\/\*|\{\s*\/\*|\*|<!--|#)/.test(previous) ? previous : null;for (const l of [lines[line - 1], own]) {if (!l) continue;const m = /(?:unslop-anything|unslopovich)-ignore(?:\s+([\w-]+(?:\s*,\s*[\w-]+)*))?/.exec(l);diff --git a/test/detect.test.js b/test/detect.test.jsindex 2ff86a7..e97a02b 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -98,6 +98,13 @@ test("a CSS block comment silences a line, since // is not a CSS comment", () =>assert.deepStrictEqual(scanSource(`.a:focus { outline: none; } /* unslop-anything-ignore focus-removed */\n`, "a.css"), []);});+test("a JSX ignore comment on its own line silences the next line", () => {+ const src = "<View>\n {/* unslop-anything-ignore clickable-div */}\n <div onClick={go}>x</div>\n <div onClick={go}>y</div>\n</View>\n";+ assert.deepStrictEqual(scanSource(src, "a.tsx").map((f) => `${f.rule}:${f.line}`), ["clickable-div:4"]);+ const spaced = "<View>\n { /* unslop-anything-ignore */ }\n <div onClick={go}>x</div>\n</View>\n";+ assert.deepStrictEqual(scanSource(spaced, "a.tsx"), []);+});+test("ignore comments from before the rename still work", () => {const src = '// unslopovich-ignore oops-error\nconst a = "Oops";\nconst b = "Oops"; // unslopovich-ignore\nconst c = "Oops";\n';assert.deepStrictEqual(scanSource(src, "a.ts").map((f) => f.line), [4]);