Use with husky and lint-staged
Ensuring that changes to your code are properly formatted is an important part of your development workflow. Use husky and lint-staged for your continuous integration process.
husky v8.x
sh
npx lint-stagedlint-staged v15.x
Check
TIP
If
example1.cppandexample2.care staged, thennpx clang-format -Werror -n example1.cpp example2.cwill be excuted.json{ // ... "lint-staged": { "*.{c,cpp,h}": "npx clang-format -Werror -n", } // ... }Fix
json{ // ... "lint-staged": { "*.{c,cpp,h}": "npx clang-format -i", } // ... }