From 7fa9c291cb79fbe89e7f54e4be0f27afac403d7e Mon Sep 17 00:00:00 2001 From: ViPuL Date: Wed, 24 Apr 2019 00:44:01 +0530 Subject: [PATCH] lint: Implement HTML Linting with htmlhint and fix indent. * lint: Implement HTML Linting with htmlhint and fix indent. Implements HTML linting using htmlhint and uses indentation rules of zulip webapp - 4 spaces. Creates a separate file .htmlhintrc for the rules, most of which are defaults. Also, fixes indentation in html files and adds a missing title in about.html. * deps: Change versioning of various dependencies to exact versions. As we prefer to use exact working version for dependencies, changed the versions to exact versions. Fixes #676. --- .htmlhintrc | 25 +++++++++ app/renderer/about.html | 79 +++++++++++++++-------------- app/renderer/main.html | 98 ++++++++++++++++++------------------ app/renderer/network.html | 38 +++++++------- app/renderer/preference.html | 28 +++++------ package.json | 20 ++++---- 6 files changed, 158 insertions(+), 130 deletions(-) create mode 100644 .htmlhintrc diff --git a/.htmlhintrc b/.htmlhintrc new file mode 100644 index 00000000..ca33f380 --- /dev/null +++ b/.htmlhintrc @@ -0,0 +1,25 @@ +{ + "tagname-lowercase": true, + "attr-lowercase": true, + "attr-value-double-quotes": true, + "attr-value-not-empty": false, + "attr-no-duplication": true, + "doctype-first": true, + "tag-pair": true, + "empty-tag-not-self-closed": true, + "spec-char-escape": true, + "id-unique": true, + "src-not-empty": true, + "title-require": true, + "alt-require": false, + "doctype-html5": true, + "id-class-value": "dash", + "style-disabled": false, + "inline-style-disabled": false, + "inline-script-disabled": false, + "space-tab-mixed-disabled": "space4", + "id-class-ad-disabled": false, + "href-abs-or-rel": false, + "attr-unsafe-chars": true, + "head-script-disabled": true +} \ No newline at end of file diff --git a/app/renderer/about.html b/app/renderer/about.html index 88ab8b69..54af9140 100644 --- a/app/renderer/about.html +++ b/app/renderer/about.html @@ -1,46 +1,47 @@ - - - - + + + + Zulip - About + - -
- -

v?.?.?

-
-

- Maintained by - Zulip -

-

- Available under the - Apache 2.0 License -

-
-
- - - + function linkInBrowser(type) { + let url; + switch (type) { + case 'website': + url = "https://zulipchat.com"; + break; + case 'license': + url = "https://github.com/zulip/zulip-electron/blob/master/LICENSE"; + break; + } + shell.openExternal(url); + } + + + diff --git a/app/renderer/main.html b/app/renderer/main.html index 2a1fd18b..0a7d1487 100644 --- a/app/renderer/main.html +++ b/app/renderer/main.html @@ -1,56 +1,56 @@ - - - - Zulip - - + + + + Zulip + + - -
- - -
- -
- - - +
+ +
+ + + diff --git a/app/renderer/network.html b/app/renderer/network.html index b61fadce..f21c923c 100644 --- a/app/renderer/network.html +++ b/app/renderer/network.html @@ -1,22 +1,22 @@ - - - - Zulip - Network Troubleshooting - - - -
-
-
Zulip can't connect
-
-
Your computer seems to be offline.
-
We will keep trying to reconnect, or you can try now.
-
-
Try now
-
- - - + + + + Zulip - Network Troubleshooting + + + +
+
+
Zulip can't connect
+
+
Your computer seems to be offline.
+
We will keep trying to reconnect, or you can try now.
+
+
Try now
+
+ + + diff --git a/app/renderer/preference.html b/app/renderer/preference.html index c01b246d..d5040026 100644 --- a/app/renderer/preference.html +++ b/app/renderer/preference.html @@ -1,17 +1,17 @@ - - - - Zulip - Settings - - - -
- -
-
- - - + + + + Zulip - Settings + + + +
+ +
+
+ + + diff --git a/package.json b/package.json index abc98325..5c29327e 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,9 @@ "reinstall": "node ./tools/reinstall-node-modules.js", "postinstall": "electron-builder install-app-deps", "lint-css": "stylelint app/renderer/css/*.css", + "lint-html": "./node_modules/.bin/htmlhint \"app/renderer/*.html\" ", "lint-js": "xo", - "test": "npm run lint-css && npm run lint-js", + "test": "npm run lint-html && npm run lint-css && npm run lint-js", "test-e2e": "gulp test-e2e", "dev": "gulp dev & nodemon --watch app/main --watch app/renderer --exec 'npm test' -e html,css,js", "pack": "electron-builder --dir", @@ -121,22 +122,23 @@ ], "devDependencies": { "assert": "1.4.1", - "cp-file": "^5.0.0", + "cp-file": "5.0.0", "devtron": "1.4.0", "electron": "3.0.10", "electron-builder": "20.38.4", "electron-connect": "0.6.2", "electron-debug": "1.4.0", "google-translate-api": "2.3.0", - "gulp": "^4.0.0", + "gulp": "4.0.0", "gulp-tape": "0.0.9", - "is-ci": "^1.0.10", - "nodemon": "^1.14.11", + "htmlhint": "0.11.0", + "is-ci": "1.0.10", + "nodemon": "1.14.11", "pre-commit": "1.2.2", - "spectron": "^5.0.0", - "stylelint": "^9.10.1", - "tap-colorize": "^1.2.0", - "tape": "^4.8.0", + "spectron": "5.0.0", + "stylelint": "9.10.1", + "tap-colorize": "1.2.0", + "tape": "4.8.0", "xo": "0.18.2" }, "xo": {