# Contributing to unslop-anything Thanks for helping. Most contributions fix a detector rule that missed something, or add a new rule. This guide covers the steps every such change follows. ## Setup You need Node 26 (the version in `.github/workflows/test.yml`). ```bash npm test ``` That runs the detector tests from the repo root. If you touch the research pipeline, run its tests too (see `.github/workflows/test.yml`). ## Running the detector on a scratch file ```bash node skills/unslop-anything/scripts/detect.js path/ --json ``` For a one-off check of a single snippet, call `scanSource` from a quick `node -e`: ```bash node -e 'const { scanSource } = require("./skills/unslop-anything/scripts/detect.js"); console.log(scanSource("
Oops
\n", "a.tsx", { kind: "web" }))' ``` ## Anatomy of a rule Rules live in `skills/unslop-anything/scripts/detect.js`. A rule has an `id`, a `family`, a `severity`, the `stacks` and `platforms` it applies to, a `message`, a `fix`, and a `find()` that returns the indexes of the matches. Helpers in the same file do the recurring work: `matches`, `tagEnd`, `closeOf`, `stringLiterals`, `hexColors`. Reuse them instead of writing your own scanning. ## Fixing a miss or a false positive 1. Add a failing test first, in `test/detect.test.js`, named after the issue, for example `... (issue #123)`. 2. Put at least one quiet case next to the flagged one: something the rule must leave alone. 3. Keep the regex change small. 4. Add a one-line comment with the issue number, as the existing code does. ## Adding a new rule Follow the steps above, and also: - Add the rule id to `skills/unslop-anything/reference/tells.md` (or `web.md` for a web-only rule). - Bump the "N detector rules" count in the README (a test checks it, so the number must match the rules in `detect.js`), and the number written out in words at the start of "The detector" section. ## Writing style for messages and fix text Plain words, a verb, no marketing. Say what is wrong and what to do instead, the way the existing messages do. ## Ignore comments and config When the user decides a tell stays, it is not re-flagged. Project-wide, add the rule id to `ignoreRules` in `.unslop-anything/config.json`. For one line, add an inline `unslop-anything-ignore