The Portals repository should contain a pre-commit hook that runs npm run test command before every commit. This will prevent common linting errors from being submitted to Gerrit.
In other Wikimedia repositories, such as:
Use the pre-commit package for this purpose.
In order to add the pre-commit hook, we need to do the following:
- Install the pre-commit package with npm install --save-dev pre-commit
- pin the version of pre-commit (remove the ^ before the version number).
- Add the pre-commit key with the value test to the package.json file "pre-commit" : [ "test"]
- Submit the new package.json and package-lock.json to Gerrit. (When you commit the patch, the pre-commit hook should invoke Gulp.js and pass).