Simplify installing / running polylint
Install it locally (to avoid version clashes) and then run it with npx (which finds the locally installed package even when it's not on the path). Change-Id: I65e35042ae49b9fb0bbe6fd6fba723f8edda8584
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
"eslint-config-google": "^0.13.0",
|
"eslint-config-google": "^0.13.0",
|
||||||
"eslint-plugin-html": "^5.0.5",
|
"eslint-plugin-html": "^5.0.5",
|
||||||
"fried-twinkie": "^0.2.2",
|
"fried-twinkie": "^0.2.2",
|
||||||
|
"polylint": "^2.10.4",
|
||||||
"typescript": "^2.x.x",
|
"typescript": "^2.x.x",
|
||||||
"web-component-tester": "^6.5.0"
|
"web-component-tester": "^6.5.0"
|
||||||
},
|
},
|
||||||
@@ -15,7 +16,8 @@
|
|||||||
"start": "polygerrit-ui/run-server.sh",
|
"start": "polygerrit-ui/run-server.sh",
|
||||||
"test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.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",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ dependencies can be installed with:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
sudo npm install -g polylint
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It may complain about a missing `typescript@2.3.4` peer dependency, which is
|
It may complain about a missing `typescript@2.3.4` peer dependency, which is
|
||||||
@@ -175,6 +174,13 @@ To run polylint, execute the following command.
|
|||||||
```sh
|
```sh
|
||||||
bazel test //polygerrit-ui/app:polylint_test
|
bazel test //polygerrit-ui/app:polylint_test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run polylint
|
||||||
|
```
|
||||||
|
|
||||||
## Template Type Safety
|
## Template Type Safety
|
||||||
Polymer elements are not type checked against the element definition, making it
|
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
|
trivial to break the display when refactoring or moving code. We now run
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ if [[ -z "$npm_bin" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
polylint_bin=$(which polylint)
|
npx_bin=$(which npx)
|
||||||
if [[ -z "$polylint_bin" ]]; then
|
if [[ -z "$npx_bin" ]]; then
|
||||||
echo "You must install polylint and its dependencies from NPM."
|
echo "NPX must be on the path."
|
||||||
echo "> npm install -g polylint"
|
echo "> npm i -g npx"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unzip -o polygerrit-ui/polygerrit_components.bower_components.zip -d polygerrit-ui/app
|
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'
|
npx polylint --root polygerrit-ui/app --input elements/gr-app.html --b 'bower_components' --verbose
|
||||||
|
|||||||
Reference in New Issue
Block a user