no-memo-children
Reports memo(...) calls when the component props type includes a children property.
Rule details Suggestion
Section titled “Rule details ”SuggestionThe 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.
Examples
Section titled “Examples” Incorrect
Memoized component with children
Section titled “Memoized component with children”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
Component without children
Section titled “Component without children”import { memo } from "@rbxts/react";
interface ButtonProps { readonly label: string;}
const Button = memo<ButtonProps>((props) => { return <textbutton Text={props.label} />;});Options
Section titled “Options”| Option | Type | Default | Notes |
|---|---|---|---|
allowedComponents | string[] | [] | 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", }, ], }, },];Related rules
Section titled “Related rules” no-new-instance-in-use-memo Keeps useMemo callbacks free of object construction
require-react-display-names Requires display names for React components