gerrit/polygerrit-ui/app/lint_test.sh
Paladox none da64859ddd Fix polygerrit lint
Was failing with

/home/jenkins/.cache/bazel/_bazel_jenkins/3239551e333dc09ba2b5ef07ff4549b6/execroot/gerrit/bazel-out/local-fastbuild/bin/polygerrit-ui/app/lint_test.runfiles/gerrit/polygerrit-ui/app/lint_test: 14: /home/jenkins/.cache/bazel/_bazel_jenkins/3239551e333dc09ba2b5ef07ff4549b6/execroot/gerrit/bazel-out/local-fastbuild/bin/polygerrit-ui/app/lint_test.runfiles/gerrit/polygerrit-ui/app/lint_test: [[: not found
+ /usr/bin/eslint --ignore-pattern bower_components/ --ignore-pattern gr-linked-text --ignore-pattern scripts/vendor --ext .html,.js .

Change-Id: Ib4650dbacd4d29123f5f1d1021592a5a02377182
2017-05-22 18:09:35 +00:00

23 lines
793 B
Bash
Executable File

#!/bin/sh
set -ex
eslint_bin=$(which npm)
if [ -z "$eslint_bin" ]; then
echo "NPM must be on the path."
exit 1
fi
eslint_bin=$(which eslint)
eslint_config=$(npm list -g | grep -c eslint-config-google)
eslint_plugin=$(npm list -g | grep -c eslint-plugin-html)
if [ -z "$eslint_bin" ] || [ "$eslint_config" -eq "0" ] || [ "$eslint_plugin" -eq "0" ]; then
echo "You must install ESLint and its dependencies from NPM."
echo "> npm install -g eslint eslint-config-google eslint-plugin-html"
echo "For more information, view the README:"
echo "https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/#Style-guide"
exit 1
fi
${eslint_bin} --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js .