Next.js Discord

Discord Forum

Server & Client Component Optimizer/Linter

Unanswered
Blackpoll Warbler posted this in #help-forum
Open in Discord
Blackpoll WarblerOP
The below eslint plugin (acknowledging that it's an 'experiment') claims to warn if components marked 'use client' have done so unnecessarily. After testing on a component that needed no client functionality, though, it doesn't actually do this - it didn't warn or change anything when I marked the component as either 'use server' or 'use client'. It did work partially in its other claim - it added 'use client' to a few files that needed it - so I know that it was running correctly.

That said, is there a linter (and ideally one with --fix/--write capability) that does this - audits which 'client' components don't need to be? I am working in a large and complex codebase that makes liberal use of 'use client', and am also beginning to build another NextJS site, and it would be very helpful if a tool could allow me to effectively audit this, and it seems like a very general use case for linting and optimizing any NextJS app

https://www.npmjs.com/package/eslint-plugin-react-server-components

0 Replies