TypeScript · performance
no-unnecessary-use-client
eslint:no-unnecessary-use-client Flag `'use client'` files with no hooks or event handlers — they could be RSC.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
An unnecessary client boundary sends the component and its transitive dependencies to the browser without using client-only behavior.
Fix
Remove the directive, or keep it only when the module uses a supported client-side API or boundary dependency.
Before / after
Executed by this rule’s unit tests.
Before
Remove the directive from static components
'use client'; export default function X() { return <div>hello</div>; } After
Keep the directive for interactive components
'use client'; import { useState } from 'react'; export default function X() { const [n] = useState(0); return <div>{n}</div>; } Limits
- Client need is inferred from recognized hooks, handlers, browser globals, exports, classes, and known client-only imports.
Message IDs
unnecessaryUseClient