Open iwuvjhdva opened 6 years ago
VERY EARLY DRAFT of the code style guidelines, just for it to be somewhere:
• NO CODE DUPLICATES!!!
◦ Read about DRY principles, take a course on PluralSight.
◦ If you copy and paste anything in the code - that is an alarm that you’re doing something wrong!
◦ (After the PoC) Write tests. If the task doesn’t have tests that are fully covering it then it’s not considered as complete
• if → switch
• force curly braces for if statements
• lowercase names for files
• use Redux store only for cross-component actions and state sharing, use component’s state in the rest of the cases
• Simple is better than complex - avoid using complex logic like actions chaining and spaghetti observers streams when possible
• create a service only if it’s really neaded, logger-service, clipboard-service, dialog-service are the bad examples
• remove eventConfirm() and dispatchAction() from everywhere, please
• separate view from controller, for example, the display message “confirmed” = “Yes” or “No” should be created in overview.js, not in rpc-service!!!
• error handling:
◦ display toastr messages only in the epics or views, services only return clean errors messages
◦ create only clean error messages: “The wallet is warming up” instead of “Error occurred: The wallet is warming up” - “Error occurred” should be added in the view on toastr call
• use batch RPC transactions whereever possible, the node supports only 4 simultaneous connections by default!
• split a function into a smaller functions:
◦ if a function is more than one screen long - THAT’S NOT OKAY, having a
◦ having a function 3 lines long IS OKAY
• use ES6’s private methods with this::<methodName>()
• don’t use strings (like ‘ok’) for checking if a function result is good, use Booleans or enums
• don’t leave garbage comments:
◦ large (>1 line) code blocks commented out, those can be recovered from the SCM if needed
◦ personal notes that you made at the implementation phase
• consider switching to TypeScript, it helps keeping the codebase cleaner
+Move Tool Bar Buttons actions from NaviBar
Estimation from #113:
Refactoring estimation