From fe11ae73db6034d16be4f7ba7b54c166794746a2 Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Fri, 12 Oct 2018 19:34:05 -0500 Subject: [PATCH] Run lintwithexclusions on travis builds Signed-off-by: Aaron Raimist --- .eslintignore.errorfiles | 7 +++++++ .travis.yml | 3 +++ package.json | 1 + scripts/generate-eslint-error-ignore-file | 21 +++++++++++++++++++++ src/vector/platform/VectorBasePlatform.js | 4 ++-- 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .eslintignore.errorfiles create mode 100755 scripts/generate-eslint-error-ignore-file diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles new file mode 100644 index 0000000000..1dfa42054e --- /dev/null +++ b/.eslintignore.errorfiles @@ -0,0 +1,7 @@ +# autogenerated file: run scripts/generate-eslint-error-ignore-file to update. + +src/components/structures/VectorHomePage.js +src/vector/index.js +src/vector/modernizr.js +test/app-tests/joining.js +test/app-tests/loading.js diff --git a/.travis.yml b/.travis.yml index 0099fcd0c2..6778aef66f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,3 +22,6 @@ install: # clone the deps with depth 1: we know we will only ever need that one # commit. - scripts/fetch-develop.deps.sh --depth 1 && npm install +script: + - npm run test + - npm run lintwithexclusions diff --git a/package.json b/package.json index 4c33970518..f5e7201536 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "start:prod": "npm run build:js-sdk && npm run build:react-sdk && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n js-sdk,react-sdk,reskindex,res,riot-js \"npm run start:js-sdk:prod\" \"npm run start:react-sdk:prod\" \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js:prod\"", "lint": "eslint src/", "lintall": "eslint src/ test/", + "lintwithexclusions": "eslint --max-warnings 20 --ignore-path .eslintignore.errorfiles src test", "clean": "rimraf lib webapp electron_app/dist", "prepublish": "npm run clean && npm run build:compile", "test": "karma start --single-run=true --autoWatch=false --browsers ChromeHeadless", diff --git a/scripts/generate-eslint-error-ignore-file b/scripts/generate-eslint-error-ignore-file new file mode 100755 index 0000000000..ac3d4ae469 --- /dev/null +++ b/scripts/generate-eslint-error-ignore-file @@ -0,0 +1,21 @@ +#!/bin/sh +# +# generates .eslintignore.errorfiles to list the files which have errors in, +# so that they can be ignored in future automated linting. + +out=.eslintignore.errorfiles + +cd `dirname $0`/.. + +echo "generating $out" + +{ + cat < 0) | .filePath' | + sed -e 's/.*riot-web\///'; +} > "$out" diff --git a/src/vector/platform/VectorBasePlatform.js b/src/vector/platform/VectorBasePlatform.js index 746b5aaf21..16b9d17801 100644 --- a/src/vector/platform/VectorBasePlatform.js +++ b/src/vector/platform/VectorBasePlatform.js @@ -60,8 +60,8 @@ export default class VectorBasePlatform extends BasePlatform { // This needs to be in in a try block as it will throw // if there are more than 100 badge count changes in // its internal queue - let bgColor = "#d00", - notif = this.notificationCount; + let bgColor = "#d00"; + let notif = this.notificationCount; if (this.errorDidOccur) { notif = notif || "×";