The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 14:30 UTC
chore(lint): the effect lint error walks the alternatives before the suppression (#26181)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 27, 2026 at 16:12 UTC
34ca6139083964b04a07909caa3e81f940d87a42
1 file changed
+18
-4
oxlint-plugin-t3code/rules/no-unreasoned-state-sync.ts
+18
-4
@@ -18,6 +18,23 @@ const isEffectHookCall = (node: ESTree.CallExpression): boolean => {
18
return false;
19
};
20
21
+// Agents read this message and act on it, so it walks the alternatives before it shows the way out.
22
+const MESSAGE =
23
+ "Stop and reconsider before keeping this effect. " +
24
+ "Is it computable from props or state? Compute it during render; the compiler memoizes it. " +
25
+ "Does it respond to a user action? Do it in that handler. " +
26
+ "Does it reset state when a prop changes? Key the component on that prop. " +
27
+ "Does it tell a parent or store that a value changed? Do it where the change happens. " +
28
+ "Does it load app data? Read it from an atom. " +
29
+ "Does it read a value from outside React? Use an atom or useSyncExternalStore. " +
30
+ "An effect that sets state another effect reads is one handler or one derivation. " +
31
+ "An effect is right only when it keeps something outside React in step with this component while mounted: " +
32
+ "a DOM node, listener, timer, native module, connection, router, imperative toast, " +
33
+ "or a registry entry or resource held until unmount. " +
34
+ "Moving the same logic into a ref or store to dodge this rule is not a fix. " +
35
+ "If the effect does that, name what it keeps in step on the line above: " +
36
+ "`// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- <what it syncs with and why>`.";
37
+
38
// Every kept effect carries its reason in the suppression above it; t3code/require-suppression-reason
39
// rejects a suppression that does not say why.
40
export default defineRule({
@@ -37,10 +54,7 @@ export default defineRule({
54
if (!isEffectHookCall(node)) return;
55
context.report({
56
node,
40
- message:
41
- "First ask whether this is synchronization that belongs in render or in the handler that causes it. " +
42
- "If an effect is the honest model, say why on the line above it: " +
43
- "`// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- <why>`.",
57
+ message: MESSAGE,
58
});
59
},
60
};