From f0355091db69455b201ca5262e275a185186958d Mon Sep 17 00:00:00 2001 From: Dmitrii Filippov Date: Tue, 12 Nov 2019 18:08:00 +0100 Subject: [PATCH] Replace deprecated polylint polylint was depreacted and replecaed by polymer linter from the polymer-cli package. Change-Id: I251ff7a59484c54b2215dd84a6a09b8ed825b01e --- package.json | 2 +- polygerrit-ui/app/BUILD | 19 ++++++++++++++++++- polygerrit-ui/app/polylint_test.sh | 18 +++++++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8fb3d3d8cc..5ed4671d44 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "eslint-config-google": "^0.13.0", "eslint-plugin-html": "^6.0.0", "fried-twinkie": "^0.2.2", - "polylint": "^2.10.4", + "polymer-cli": "^1.9.11", "typescript": "^2.x.x", "web-component-tester": "^6.5.0" }, diff --git a/polygerrit-ui/app/BUILD b/polygerrit-ui/app/BUILD index 6d30a144ad..1bf0f2a2aa 100644 --- a/polygerrit-ui/app/BUILD +++ b/polygerrit-ui/app/BUILD @@ -45,6 +45,23 @@ filegroup( ), ) +filegroup( + name = "pg_code_without_test", + srcs = glob( + [ + "**/*.html", + "**/*.js", + ], + exclude = [ + "bower_components/**", + "**/*_test.html", + "embed/test.html", + "test/**", + "samples/**", + ], + ), +) + filegroup( name = "bower_components", srcs = glob( @@ -108,7 +125,7 @@ sh_test( size = "large", srcs = ["polylint_test.sh"], data = [ - ":pg_code", + ":pg_code_without_test", "//polygerrit-ui:polygerrit_components.bower_components.zip", ], # Should not run sandboxed. diff --git a/polygerrit-ui/app/polylint_test.sh b/polygerrit-ui/app/polylint_test.sh index f6880a125a..54b31d35af 100755 --- a/polygerrit-ui/app/polylint_test.sh +++ b/polygerrit-ui/app/polylint_test.sh @@ -8,13 +8,21 @@ if [[ -z "$npm_bin" ]]; then exit 1 fi -npx_bin=$(which npx) -if [[ -z "$npx_bin" ]]; then - echo "NPX must be on the path." - echo "> npm i -g npx" +node_bin=$(which node) +if [[ -z "$node_bin" ]]; then + echo "node must be on the path." + exit 1 +fi + +polymer_bin=$(which polymer) +if [[ -z "$polymer_bin" ]]; then + polymer_bin=$(abs_path ./node_modules/polymer-cli/bin/polymer.js); +fi +if [[ -z "$polymer_bin" ]]; then + echo "polymer must be set or polymer-cli locally installed (npm install polymer-cli)." exit 1 fi unzip -o polygerrit-ui/polygerrit_components.bower_components.zip -d polygerrit-ui/app -npx polylint --root polygerrit-ui/app --input elements/gr-app.html --b 'bower_components' --verbose +$polymer_bin lint --root polygerrit-ui/app --entrypoint polygerrit-ui/app/elements/gr-app.html --component-dir 'polygerrit-ui/app/bower_components' --verbose --rules polymer-2-hybrid --sources "polygerrit-ui/app/**/*"