Degordian js coding standard
Procedure for adding new rules to the repository after code reviewing:
- Check if the error is recurring or critical (important for everybody)
- Create a pull request
- Write a rule to correct the mistake
- Write a short code snippet (https://help.github.com/articles/creating-and-highlighting-code-blocks/)
- Keep it generic
- Minimal code possible
- Avoid copy/pasting from private projects
- Create a pull request
- If the rule can be automated, write a rule for ESlint
Using the config in your project: https://prettier.io/docs/en/configuration.html#sharing-configurations
- add prettier as a project dependency (yarn add prettier | npm install prettier)
- add prettier config key to package.json, e.g.:
{ "name": "my-awesome-project", "version": "0.1.0", "prettier": "@degordian/standards/standards/prettier/.prettierrc.json" }
- Configure your IDE for formatting
- If you want to format the whole codebase recursively, run this command (or add it to npm scripts)
- *you may need to change the source directory and extensions based on your criteria
prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,scss}\"
- Success, you may now enjoy meaningful code reviews that focus on logic and features, and not the formatting. 🎉