Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces `lint-staged` to automate code formatting before committing changes. Previously, the `.husky/pre-commit` hook relied on `npm run prettier:check`, which only performed a check for code style violations but did not automatically fix them. This meant that developers had to manually run `prettier` to format their code before committing. Most notably, using Husky to achieve this automatically formats only the files that are to be committed, saving developers bot time and sanity. The changes implement the following: - **Update `.husky/pre-commit`:** The hook is now configured to run `npm run pre-commit` which executes `lint-staged` to automatically format code changes. - **Add `pre-commit` script to `package.json`:** This script runs `lint-staged` with the `--concurrent false` flag, ensuring that formatting happens sequentially for improved compatibility with eslint and reliability. - **Modify `lint-staged` configuration in `package.json`:** The configuration now targets specific file types (`*.{css,html,js,json,md,twig,yml}`) for formatting. This clarifies the scope of automatic formatting. This change simplifies the development workflow by automating the code formatting process, ensuring all commits adhere to the project's style guidelines without manual intervention. This improves code consistency and reduces the possibility of style-related issues in the codebase.
- Loading branch information