You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2fbd431
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: oxlint-plugin-t3code/rules/no-manual-memo.ts
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,21 @@ export default defineRule({
24
24
type: "suggestion",
25
25
docs: {
26
26
description:
27
-
"Disallow useCallbackand useMemo in files the React Compiler must compile; it memoizes them.",
27
+
'Disallow useCallback, useMemo and "use memo" directives in files the React Compiler must compile; it memoizes them.',
28
28
},
29
29
},
30
30
create(context){
31
31
return{
32
+
// A "use memo" helper only exists to force a cache scope the compiler withheld,
33
+
// which hides the ordering or structure problem that withheld it.
34
+
ExpressionStatement(node){
35
+
if(node.directive!=="use memo")return;
36
+
context.report({
37
+
node,
38
+
message:
39
+
'Drop "use memo": restructure so the compiler caches this on its own, e.g. move plain uses of a value before the hook call that splits its scope, or inline the helper.',
0 commit comments