An ESLint rule which tells you when you are setting up a loader / action within a component rather than a route #9602
Closed
justinfarrelldev
started this conversation in
Proposals
Replies: 1 comment 1 reply
-
The team is working on a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I just wanted to propose an idea that I thought up a little while ago.
I often find myself accidentally creating a loader / action in a component rather than a route (especially if the route pretty much exclusively contains the component). This, naturally, leads to "server-only functionality used in client" errors.
Would it be possible to create an ESLint rule to warn if there is an action or a loader present in a client-only file (or files in the components folder)? A rule like this would be pretty useful to warn against this pretty silly mistake I seem to keep making (and I'm sure a lot of people have accidentally done at some point or another).
The only downside I can think of (outside of this maybe being difficult to implement in an ESLint rule) would be that the names "loader" and "action" would not be valid function names within client-side code.
Thank you for your awesome work!
Beta Was this translation helpful? Give feedback.
All reactions