React Rules
Rules for React Luau components, hooks, and JSX patterns.Browse all 31 rules in this category.
Showing 31 rules
Ban React Fc
React Rulesban-react-fcBan React.FC and similar component type annotations. Use explicit function declarations instead.
- Problem
Memoized Effect Dependencies
React Rulesmemoized-effect-dependenciesFlags effect dependencies that are not memoized. Unmemoized dependencies can cause unnecessary re-renders or infinite loops.
- Problem
No Cascading Set State
React Rulesno-cascading-set-stateDisallow effect hooks with many cascading state updates.
- Problem
No Giant Component
React Rulesno-giant-componentReport React components whose bodies exceed 300 lines.
- Problem
No God Components
React Rulesno-god-componentsEnforce React component size and complexity limits inspired by the 'Refactor God Component' checklist.
- Problem
No Inline Property On Memo Component
React Rulesno-inline-property-on-memo-componentPrevent inline properties from being passed to memoized components.
- Problem
No New Instance In Use Memo
React Rulesno-new-instance-in-use-memoDisallow configured constructor calls (default: new Instance) inside React useMemo callbacks.
- Problem
No Render Helper Functions
React Rulesno-render-helper-functionsDisallow non-component functions that return JSX or React elements.
- Suggestion
No Static React Create Element
React Rulesno-static-react-create-elementRequire JSX for static React.createElement calls.
- Problem
No Underscore React Props
React Rulesno-underscore-react-propsBan React property names that begin with an underscore in JSX.
- Problem
No Unused Use Memo
React Rulesno-unused-use-memoDisallow standalone useMemo calls that ignore the memoized value.
- Problem
No Use Memo Simple Expression
React Rulesno-use-memo-simple-expressionDisallow useMemo for expressions that are already trivial to compute.
- Problem
No Useless Use Effect
React Rulesno-useless-use-effectDisallow empty effects, duplicate dependencies, effect chains, log-only effects, derived state, external-store state sync, state initialization, reset effects, parent notifications, parent ref callbacks, and event side effects routed through state.
- Suggestion
No Useless Use Memo
React Rulesno-useless-use-memoDisallow useMemo calls that only wrap values static enough to live at module scope.
- Suggestion
No Useless Use Spring
React Rulesno-useless-use-springDisallow useSpring hooks whose config and dependencies are entirely static
- Suggestion
Prefer Constant Dispatch
React Rulesprefer-constant-dispatchDisallow inline useReducer action objects that could be module-level constants.
- Suggestion
- Editor suggestions
Prefer Context Stack
React Rulesprefer-context-stackPrefer a local ContextStack component over directly nesting multiple context providers.
- Suggestion
- Automatic fix
Prefer Hoisted Jsx Elements
React Rulesprefer-hoisted-jsx-elementsPrefer extracting static Roblox JSX intrinsic elements to module-level constants.
- Suggestion
Prefer Hoisted Jsx Object Properties
React Rulesprefer-hoisted-jsx-object-propertiesPrefer extracting inline JSX object props to module-level constants when the entire object is statically hoistable.
- Suggestion
Prefer Local Portal Component
React Rulesprefer-local-portal-componentPrefer a local Portal component over direct createPortal calls when the project already defines one.
- Suggestion
- Automatic fix
Prefer Padding Components
React Rulesprefer-padding-componentsPrefer local EqualPadding and DirectionalPadding components over matching <uipadding /> declarations.
- Suggestion
- Automatic fix
Prefer Ternary Conditional Rendering
React Rulesprefer-ternary-conditional-renderingPrefer ternary expressions over complementary JSX && branches.
- Suggestion
- Automatic fix
Prefer Use Reducer
React Rulesprefer-use-reducerSuggest using useReducer for related state updates instead of multiple useState calls.
- Problem
React Hooks Strict Return
React Rulesreact-hooks-strict-returnRestrict React hooks to object returns or short tuples.
- Suggestion
Require Named Effect Functions
React Rulesrequire-named-effect-functionsEnforce named effect functions for better debuggability. Prevents inline arrow functions in useEffect and similar hooks.
- Problem
Require React Component Keys
React Rulesrequire-react-component-keysRequire keys on nested React JSX children, fragments, and configured iteration or memoization contexts.
- Problem
Require React Display Names
React Rulesrequire-react-display-namesRequire displayName on exported memo components and contexts.
- Problem
Rerender Memo With Default Value
React Rulesrerender-memo-with-default-valuePrevent inline empty object and array defaults in component prop destructuring.
- Problem
Strict Component Boundaries
React Rulesstrict-component-boundariesPrevent imports that reach into another component's nested modules.
- Problem
Use Exhaustive Dependencies
React Rulesuse-exhaustive-dependenciesEnforce exhaustive and correct dependency specification in React hooks to prevent stale closures and unnecessary re-renders
- Problem
- Automatic fix and editor suggestions
Use Hook At Top Level
React Rulesuse-hook-at-top-levelEnforce that React hooks are only called at the top level of components or custom hooks, never conditionally or in nested functions
- Problem