Sharing PHP-CS-Fixer Rules Across Projects and Teams

Tim MacDonald shares a way to sharing PHP-CS-Fixer rules across your projects. It involves in setting up on repo/package that contains the rules and a little helper class that takes in a PhpCsFixer\Finder instance (along with optional extra rules). <?php namespace TiMacDonald; use PhpCsFixer\Config; use PhpCsFixer\Finder; function styles(Finder $finder, array $rules = []): Config { …

Run prettier or php-cs-fixer with GitHub Actions

Stefan Zweifel shares his GitHub Actions Workflows to run prettier and php-cs-fixer on his repos: Over the past few weeks I’ve added a handful of workflows to my projects. One workflow is really like, is to run prettier and php-cs-fixer to automatically format my code and commit the fixed files back to the repository. Here’s …

Tools to automatically format PHP, JavaScript and CSS files

Good writeup by Freek on how to get PHP-CS-Fixer and Prettier up and running. When working on a project with other people, it’s important to pick a coding standard. Agreeing on a coding standard makes the code more readable for all developers that need to touch the project. It’s easy to make mistakes against those …

lint-staged: Lint JS and CSS files staged by Git

Running a lint process on a whole project is slow and linting results can be irrelevant. Ultimately you want to lint only files that are staged/will be committed. This project contains a script that will run arbitary npm tasks against staged files, filtered by a spicified glob pattern. lint-staged introductory blogpost: Make Linting Great Again …