-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-ssr-friendly #209
Comments
👋 @cyberhck, great idea! But: this repository is just for core rules that aren't tied to particular frameworks. You'll want to file a request in tslint-react, or failing that, eslint-plugin-react. You could also publish this as a standalone package on npm if you don't want to be tied into their release cycles. |
can we move this issue to maybe tslint-react? since it's same organization, I think there's a feature to do that now in gh |
Sounds like a good idea, but I would suggest making this an ESLint ruleset instead. See #210 |
Rule Suggestion
Is your rule for a general problem or is it specific to your development style?
This is a general purpose rule which actually should be enabled by default IMO (but that can be discussed later)
What does your suggested rule do?
It should check few methods in react projects, constructor, getDerivedStateFromProps, componentWillMount (deprecated), render (maybe more? We can list them later), and see if the code will be able to run in node env, it won't be perfect, but can we blacklist few things to be used there.
Example would include: document, window, localStorage (other types of browser storage etc)
List several examples where your rule could be used
I could enable this rule and later if project decides to use server side rendering, thanks to this rule, we'd have avoided those refactoring awkwardness.
Additional context
Not sure entirely, I've not written a lot of rules (just maybe around 3-4), let's discuss and see if we can proceed, if I get some time, I could also send a PR.
The text was updated successfully, but these errors were encountered: