Stylelint Rules: How To Write Your Own Rules
I sat down and read through the stylelint guide on writing plugins and rules and came up with a basic example that other developers can build upon.
The custom stylelint rule will detect whether the “visibility” property is being used. In most codebases it isn’t used, so I thought it would be a safe enough example that anyone can run.
The instructions for writing your own plugins and rules are in the Stylelint Developer Guide:
It didn’t take very long to write a few more rules for stylelint and the linter immediately found a lot of coding standard violations that made our CSS inconsistent. After fixing the rules, the code was cleaner and more consistent and developers could worry about higher-level concerns.
I really enjoyed using stylelint and will be using it for future projects whenever possible.