Make Sure You’re Not Committing Bad JavaScript by Using a Git Hook

As a follow on to my post about using a Git hook with PHP Code Sniffer to make sure that you’re committing good PHP code, this post is going to cover doing the same thing to make sure that your JavaScript passing a JSLint check.

The only pre-requisite to get this to work is to install JSLint using npm. Install npm and then run  npm install jslint in your project root folder.

A now the .git/hook/pre-commit code

You will want to make sure that the path to JSLink is correct on line 7. If you want to change what files get checked, you can change the extensions in line 9.

Code source:

Code automation with git hooks

Improve your code quality with git hooks, composer, and PHP Code Sniffer

First, let’s cover what all of these terms mean Git Hooks If you’re doing any sort of development you need to make sure that you’re using version control, and Git happens to be my preferred solution. Git offers these cool little tools called Git hooks. Hooks run bash scripts at a number of different points […]


The Best Way To Vertically Center with CSS

If there is one thing that’s truly annoying in CSS, it’s trying to vertically center an element inside a parent. You’d think vertical-align:center would work, but normally it doesn’t. display:table-cell often has other issues that need working out. So where does that leave us? Enter transform. Most people only think to use transform to rotate […]