From f07b75b05604b84b0239929e77fbb8cb49318d4f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 30 Oct 2020 14:20:26 +0100 Subject: [PATCH] js/mobile: fix eslint and enable linting on build lint the build file, as else eslint does not has the full picture. Add a prelude to define globals once at the top Signed-off-by: Thomas Lamprecht --- Makefile | 2 +- js/mobile/Makefile | 4 ++++ js/mobile/app.js | 6 +++--- js/mobile/mailview.js | 3 ++- js/mobile/prelude.js | 4 ++++ js/mobile/quarantineview.js | 17 +++++++++-------- js/mobile/utils.js | 4 ++-- 7 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 js/mobile/prelude.js diff --git a/Makefile b/Makefile index 1f54c32..382b18b 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ distclean: clean .PHONY: lint lint: $(MAKE) -C js/ lint - #$(MAKE) -C js/mobile lint + $(MAKE) -C js/mobile lint clean: make -C js clean diff --git a/js/mobile/Makefile b/js/mobile/Makefile index 862dffe..eb39408 100644 --- a/js/mobile/Makefile +++ b/js/mobile/Makefile @@ -1,6 +1,7 @@ # caution: order is important MOBILESRC= \ + prelude.js \ component.js \ loginscreen.js \ mailview.js \ @@ -8,6 +9,9 @@ MOBILESRC= \ utils.js \ app.js \ +lint: pmgmanagerlib-mobile.js + eslint $^ + pmgmanagerlib-mobile.js: ${MOBILESRC} cat $^ >$@.tmp mv $@.tmp $@ diff --git a/js/mobile/app.js b/js/mobile/app.js index e2e13e4..4d00c12 100644 --- a/js/mobile/app.js +++ b/js/mobile/app.js @@ -1,5 +1,5 @@ -var $$ = Dom7; -var app = new Framework7({ +$$ = Dom7; +app = new Framework7({ root: '#app', init: false, name: 'Proxmox Mail Gateway', @@ -73,6 +73,6 @@ var app = new Framework7({ ], }); -let quarlist = new QuarantineView(); +let _quarantine_view = new QuarantineView(); app.init(); diff --git a/js/mobile/mailview.js b/js/mobile/mailview.js index 3645b81..bc2b035 100644 --- a/js/mobile/mailview.js +++ b/js/mobile/mailview.js @@ -52,7 +52,8 @@ class MailView extends Component {
- +
`; diff --git a/js/mobile/prelude.js b/js/mobile/prelude.js new file mode 100644 index 0000000..4420f58 --- /dev/null +++ b/js/mobile/prelude.js @@ -0,0 +1,4 @@ +/* global Framework7, Template7, Dom7 */ + +var $$ = Dom7; +var app, PMG; // set in app.js diff --git a/js/mobile/quarantineview.js b/js/mobile/quarantineview.js index 721c28b..4a3ad54 100644 --- a/js/mobile/quarantineview.js +++ b/js/mobile/quarantineview.js @@ -6,7 +6,8 @@ class QuarantineView extends Component {