Eslint Prettier Husky Lint Staged

Commands for making consistant code style

This project is configured to use ESLint and Prettier along with Husky and Lint Staged to make code consistant and allow committing good quality code.

You can run these commands to maintain good quality code:

  • npm run lint - To run eslint. This will run our code against the defined eslint rules and return us errors in our code if any. It will also suggest the issue with a brief message.

  • npm run prettier - To run prettier. This will return us the error in formatting the code. Like line spacing, wrong indentation etc.

  • npm run type-check - Quickly detect and fix all linting and formatting related issues (That are fixable by eslint and prettier). For more advance issues you might need to read the error message and fix yourself.

  • npm run lint-staged - This is the same command that will be executed when you commit your code to a branch. Use this command to check the issues in advance about files in staging area looks good and commit can be successful or not. If this command fails, you will get a list of errors to fix. The errors returned by this command will be the same when you try to commit.