Fix trailing whitespace check in pre-commit

Double brackets ([[ ]]) are not supported by sh, they require bash.
Also, move whitespace check before jshint, it's faster.

Change-Id: I7ee7ba4764c2f12fd12d1a0a580c89d5ccf0565f
Merge "Fix trailing whitespace check in pre-commit"