


As Tighten mentions on its blog
Duster is an opinionated linter and fixer for Laravel code, that takes the best of Laravel’s Pint, together with the power of PHP_CodeSniffer and PHP-CS-Fixer
Duster works on the command line, with Husky or use it's premade GitHub Action to run it in your CI pipeline
During installation & setup process I found a little issue related to Husky so here I share the solutions
composer require tightenco/duster --devIf not you can initialize it with
git initnpm i -D huskynpm i -D lint-stagednpx husky-initnpx husky add ./.husky/pre-commit 'npx --no-install lint-staged'npm test command from pre-commit file#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install lint-staged
npm run test # this line should be removedphp files in package.json file ...
"lint-staged": {
"**/*.php*": [
"vendor/bin/duster lint"
]
}
...Instead of just lint your codebase, you can use the Duster fix command in order to fix the code base automatically.
Just execute
./vendor/bin/duster github-actionsIt will publish a github action workflow for Duster, you can configure it and read more about Duster in the docs
Thanks for reading!
Sign up & get tips and tricks
You'll get monthly updates regarding my most recent articles and products.