- Write comments to explain why the code is here, not what it is doing.
- Prioritize readability over cleverness. It's generally better to write code that's easy to understand than code that's unnecessarily complex or "smart".
- Leverage Vue's reactivity system by understanding its dependencies tracking mechanism. Avoid directly mutating a prop inside a child component.
- Do not use "watch" unless absolutely necessary. Use computed properties or methods instead.
- Use the "key" attribute with "v-for" whenever possible.
- Use props and events (emits) for parent-child component communication.
- Keep your templates clean and readable. Avoid putting complex logic in your templates - instead, move it to methods or computed properties.
- Use environment variables for sensitive data like API keys and do not expose them in your Vue application's codebase.
- Always clean up your side effects (like timers or event listeners) in the beforeUnmount lifecycle hook to avoid memory leaks.
- Always handle errors and exceptions properly. Use try-catch blocks to catch errors (or catch() block for axios) and handle them gracefully.
- In every repository, include a README which tells exactly how to run the project. Eg. copy .env.example to .env
- If you're building a new feature and this features make another one deprecated, label the old feature deprecated and check for its usage
- Delete files which certailnly will no longer be used
- Don't use != and == in JavaScript, always use !== and === to be type safe.