Skip to content

no-memo-children

Reports memo(...) calls when the component props type includes a children property.

The rule checks imported memo calls from react or @rbxts/react, based on the configured environment. If the memoized component’s props type has a children property, it reports the call.

It resolves children through direct props, inherited interfaces, intersections, and unions. You can also allow specific component names with allowedComponents.

Incorrect
import { memo, ReactNode } from "@rbxts/react";
interface CardProps {
readonly title: string;
readonly children?: ReactNode;
}
const Card = memo<CardProps>((props) => {
return <frame>{props.children}</frame>;
});
Correct
import { memo } from "@rbxts/react";
interface ButtonProps {
readonly label: string;
}
const Button = memo<ButtonProps>((props) => {
return <textbutton Text={props.label} />;
});
OptionTypeDefaultNotes
allowedComponentsstring[][]Component names the rule should skip.
environment"roblox-ts" | "standard""roblox-ts"Picks @rbxts/react or react imports.
import ceaseNonsense from "eslint-plugin-cease-nonsense";
export default [
{
plugins: {
"cease-nonsense": ceaseNonsense,
},
rules: {
"cease-nonsense/no-memo-children": [
"error",
{
allowedComponents: ["PortalHost"],
environment: "standard",
},
],
},
},
];