ESLint and Prettier
Prettier is a code formatter to make our code looks good.
Both ESLint and Prettier can run independently.
Both ESLint and Prettier ship with format rules/options. However, some of them defined by the two parties conflict with each other. For instance, ESLint requires parentheses around arguments in all cases, while Prettier prefer to avoid them.
Hence, the first step of integrating is disabling any existing formatting rules in ESLint. It can be done by using
eslint-config-prettier. Then, we can add format rules from Perttier by using
eslint-plugin-prettier. The detailed steps can be found here.
eslint-config-airbnb into our
package.json. The detailed instructions can be found here.
- Use ESLint to analyze codes for potential errors.
- Use Prettier to format codes.
- Use Airbnb style guide to avoid duplication of work.