-
-
Notifications
You must be signed in to change notification settings - Fork 846
Coding Best Practices
Koustov edited this page Jun 7, 2022
·
5 revisions
- Every check-in must be validated against responsiveness
- No console error
- Avoid unnecessary comments however add proper comments
- Write DRY
- No sensitive information disclosure
- CSS class name:
kebab-case
- Javascript variable name:
pascal-case
- Constant:
upper-case
- React Component:
camel-case
- File Name:
kebab-case
- A new line after every CSS block
- A new line after
- Play related CSS should not use any element selector
- Use ES6 scripts
- Try avoiding console log
- No use of
eval
- Appropriate variable name
- Declaration at top
- Avoid creating variables inside a loop
- For string concatenation and replacement, use string template literals
- Reduce globals
- Use arrow functions
- Avoid
var
, uselet
andconst
- Use inline object instead of
new Object()
- Use
[]
instead ofnew Array()
- Spread operator, use it as much as possible
- Try non-blocker code, use
async
- Easy to access properties using destructuring
- Try to use CSS per component-based
- Decompose into smaller components
- Use
functional
component - Appropriate naming and destructuring Props
- Member name in camel case
- Constants in upper case
- CSS class name in
hyphen-case
- Use
propTypes
as much as possible - Avoid many props
- Use map rendering for an array
- Use ternary operator and
&&
- Avoid inline-style
- Simple CSS block structure
- Use Block-Element-Modifier
- Separation of structure
- Separation of container and content
- Make use of variables
- Add vendor prefix rule: (will use auto prefixer)
- Use shorthand properties
- Find and eliminate overwritten and redundant properties
- Make style responsive
- Add appropriate comments
- Try creating top-down structure
- Try using CSS properties instead of HTML encoder for special characters.
- Linter Config: --link to linter config--
- Prettier Config: --Link to prettier config--
ReactPlay - The MIT License (MIT) Copyright ©2023 is an open-source project made with ❤️ by Tapas Adhikary and friends.