diff --git a/.rules b/.rules index d29198c0f..791aa03f8 100644 --- a/.rules +++ b/.rules @@ -1,238 +1,478 @@ -# Equicord Development Rules +# Equicord Rules ## Philosophy -- Solve the problem at hand. No refactors unless asked. -- Smallest diff that fixes it. Three similar lines beats a premature helper. -- Less code with the same behavior wins. -- Never add comments unless asked. Keep existing comments, they carry context. -- Delete dead code. Don't comment it out. -- Natural human text in errors, descriptions, toasts. No dashes, no robotic phrasing. Descriptions start capitalized and end with a period. +- Solve problem at hand. No refactors unless asked. +- Smallest diff wins. Three similar lines beat premature helper. +- Less code with same behavior always wins. Equivalent solutions: shorter one ships. Compression is intelligence. +- Don't over-guard. Check only conditions that can actually occur. `if (user)` on non-optional store return is wrong. `try/catch` on code that can't throw is wrong. `?.` on type-guaranteed values is wrong. Dead defensive code isn't safety. +- No comments unless asked. Keep existing ones, they carry context. +- Delete dead code. Don't comment out. +- Natural human text in errors, descriptions, toasts. No dashes, no robotic phrasing. Descriptions start capitalized, end with period. +- One-file plugin default. Split only past ~250 lines or when second file is genuinely reusable (`utils.ts`, `settings.ts`, `components/`). +- No abstraction for 1-2 call sites. Inline beats single-use hook. `createX` used once is just a function call. +- Don't reimplement what `@webpack/common` or `@utils/*` exports. Search first. +- Don't cache Discord data. Stores are source of truth, read on demand. Cache only what isn't in a store. +- Don't manage state Discord manages. `useStateFromStores` over `useState` + flux that mirrors a store. +- Don't recreate Discord components. Reuse `Button`, `TextInput`, `Tooltip`, `Menu.*`, etc. Hand-rolled `