Currently, we have added an ESLint tool for support code formatter and Prettier tool to find and fix problems in this project.
This is an opinionated selection, but which helps to make your project more clean and quality.
Guideline for CLI and extension
CLI for ESLint and Prettier for checking rule and format code
Analyzes your code to quickly find problems
npm run eslint
Fix problems automatically
npm run eslint:fix
Find issue for code formatter (This is optional because this rule have config in ESLint)
npm run prettier
Fix code formatter (This is optional because this rule have config in ESLint)
npm run prettier:fix
Install extension for checking and format code in Visual Studio Code
Open Visual Studio Code editor & Install these extensions below
Extension for checking rule
ESLint (https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
Extension for format code
- EditorConfig for VS Code (https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
- Prettier – Code formatter (https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
We have config default some condition for auto format code when saving, you can edit in the file
- .vscode/settings.json
- .editorconfig
Add husky and lint-staged for checking code when commit
We have config husky and lint-staged for auto to checking rule and format code for both Expo Go (source-expo) and React Native CLI (source), you only need:
- Push Mazi source code to your repo (Github, Bitbucket …)
- When you commit code, which auto checking code with config ESLint (Step 1) and Prettier (Step 2)