Merge "Simplify installing / running polylint"
diff --git a/package.json b/package.json
index 8a18318f..6b9a38d 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
"eslint-config-google": "^0.13.0",
"eslint-plugin-html": "^5.0.5",
"fried-twinkie": "^0.2.2",
+ "polylint": "^2.10.4",
"typescript": "^2.x.x",
"web-component-tester": "^6.5.0"
},
@@ -15,7 +16,8 @@
"start": "polygerrit-ui/run-server.sh",
"test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh",
"eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0",
- "test-template": "./polygerrit-ui/app/run_template_test.sh"
+ "test-template": "./polygerrit-ui/app/run_template_test.sh",
+ "polylint": "bazel test polygerrit-ui/app:polylint_test"
},
"repository": {
"type": "git",
diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md
index 9ceda8c..a73f243 100644
--- a/polygerrit-ui/README.md
+++ b/polygerrit-ui/README.md
@@ -32,7 +32,6 @@
```sh
npm install
-sudo npm install -g polylint
```
It may complain about a missing `typescript@2.3.4` peer dependency, which is
@@ -175,6 +174,13 @@
```sh
bazel test //polygerrit-ui/app:polylint_test
```
+
+or
+
+```sh
+npm run polylint
+```
+
## Template Type Safety
Polymer elements are not type checked against the element definition, making it
trivial to break the display when refactoring or moving code. We now run
diff --git a/polygerrit-ui/app/polylint_test.sh b/polygerrit-ui/app/polylint_test.sh
index ee69ce2..f6880a1 100755
--- a/polygerrit-ui/app/polylint_test.sh
+++ b/polygerrit-ui/app/polylint_test.sh
@@ -8,13 +8,13 @@
exit 1
fi
-polylint_bin=$(which polylint)
-if [[ -z "$polylint_bin" ]]; then
- echo "You must install polylint and its dependencies from NPM."
- echo "> npm install -g polylint"
+npx_bin=$(which npx)
+if [[ -z "$npx_bin" ]]; then
+ echo "NPX must be on the path."
+ echo "> npm i -g npx"
exit 1
fi
unzip -o polygerrit-ui/polygerrit_components.bower_components.zip -d polygerrit-ui/app
-${polylint_bin} --root polygerrit-ui/app --input elements/gr-app.html --b 'bower_components'
\ No newline at end of file
+npx polylint --root polygerrit-ui/app --input elements/gr-app.html --b 'bower_components' --verbose