Add PolyLint Bazel rule
To install the linter: npm install -g polylint To run the linter: bazel test //polygerrit-ui/app:polylint_test Change-Id: I552f6eedce0e4e90d394acfc516940a8c26e948f
This commit is contained in:
parent
41aa6b7085
commit
744045d542
@ -148,3 +148,17 @@ Some useful commands:
|
||||
`eslint --ext .html,.js polygerrit-ui/app/$YOUR_DIR_HERE`
|
||||
* To run the linter on all of your local changes:
|
||||
`git diff --name-only master | xargs eslint --ext .html,.js`
|
||||
|
||||
We also use the polylint tool to lint use of Polymer. To install polylint,
|
||||
execute the following command.
|
||||
|
||||
```sh
|
||||
npm install -g polylint
|
||||
```
|
||||
|
||||
To run polylint, execute the following command.
|
||||
|
||||
```sh
|
||||
bazel test //polygerrit-ui/app:polylint_test
|
||||
```
|
||||
|
||||
|
@ -129,6 +129,16 @@ filegroup(
|
||||
),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "bower_components",
|
||||
srcs = glob(
|
||||
[
|
||||
"bower_components/**/*.html",
|
||||
"bower_components/**/*.js",
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
genrule2(
|
||||
name = "pg_code_zip",
|
||||
srcs = [":pg_code"],
|
||||
@ -172,3 +182,18 @@ sh_test(
|
||||
"manual",
|
||||
],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "polylint_test",
|
||||
size = "large",
|
||||
srcs = ["polylint_test.sh"],
|
||||
data = [
|
||||
":pg_code",
|
||||
":bower_components",
|
||||
],
|
||||
# Should not run sandboxed.
|
||||
tags = [
|
||||
"local",
|
||||
"manual",
|
||||
],
|
||||
)
|
||||
|
18
polygerrit-ui/app/polylint_test.sh
Executable file
18
polygerrit-ui/app/polylint_test.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
npm_bin=$(which npm)
|
||||
if [[ -z "$npm_bin" ]]; then
|
||||
echo "NPM must be on the path."
|
||||
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"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${polylint_bin} --root polygerrit-ui/app --input elements/gr-app.html
|
Loading…
Reference in New Issue
Block a user