From 9b8f01716774a960073e944823ab727cc867a8f6 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Wed, 26 Jul 2023 06:29:03 -0600 Subject: chore: improve lint setup (#397) - update eslint config to closely mirror the ones from ferdium-app - add .eslintignore - opt in to eslint `reportUnusedDisableDirectives` config option - remove `trailingComma: all` from `prettier` config which is default in `prettier` v3 - autofix or disable a lot of lint issues throughout codebase - add `volta` configuration to `package.json` to autoload correct `node` and `pnpm` versions - upgrade all `eslint` and `prettier` related dependencies to latest - update lint:fix npm script - reformat touched files with prettier - bumped up minor version for all recipes that have changes - introduced injection of 'service.css' where it was missing in many recipes --------- Co-authored-by: Vijay A --- recipes/zulip/index.js | 42 +++++++++++++++++++++++------------------- recipes/zulip/package.json | 2 +- recipes/zulip/webview.js | 18 ++++++++++++++---- 3 files changed, 38 insertions(+), 24 deletions(-) (limited to 'recipes/zulip') diff --git a/recipes/zulip/index.js b/recipes/zulip/index.js index 13c94b7..ea3944f 100644 --- a/recipes/zulip/index.js +++ b/recipes/zulip/index.js @@ -1,21 +1,25 @@ -module.exports = Ferdium => class Zulip extends Ferdium { - async validateUrl(url) { - const baseUrl = new window.URL(url); - const apiVersion = 'api/v1'; - try { - const resp = await window.fetch(`${baseUrl.origin}/${apiVersion}/server_settings`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - }); - const data = await resp.json(); +module.exports = Ferdium => + class Zulip extends Ferdium { + async validateUrl(url) { + const baseUrl = new window.URL(url); + const apiVersion = 'api/v1'; + try { + const resp = await window.fetch( + `${baseUrl.origin}/${apiVersion}/server_settings`, + { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }, + ); + const data = await resp.json(); - return Object.hasOwnProperty.call(data, 'realm_uri'); - } catch (error) { - console.error(error); - } + return Object.hasOwnProperty.call(data, 'realm_uri'); + } catch (error) { + console.error(error); + } - return false; - } -}; + return false; + } + }; diff --git a/recipes/zulip/package.json b/recipes/zulip/package.json index cbe516b..dce1826 100644 --- a/recipes/zulip/package.json +++ b/recipes/zulip/package.json @@ -1,7 +1,7 @@ { "id": "zulip", "name": "Zulip", - "version": "1.2.1", + "version": "1.3.0", "license": "MIT", "config": { "hasNotificationSound": true, diff --git a/recipes/zulip/webview.js b/recipes/zulip/webview.js index 1989809..707b723 100644 --- a/recipes/zulip/webview.js +++ b/recipes/zulip/webview.js @@ -1,4 +1,17 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + module.exports = Ferdium => { + function getUnreadCount(eltClassName) { + const elt = document.querySelectorAll( + `#global_filters .${eltClassName} .unread_count`, + )[0]; + return elt === null ? 0 : Ferdium.safeParseInt(elt.textContent); + } + const getMessages = () => { // All unread messages const unreadAll = getUnreadCount('top_left_all_messages'); @@ -17,8 +30,5 @@ module.exports = Ferdium => { Ferdium.loop(getMessages); - function getUnreadCount(eltClassName) { - const elt = document.querySelectorAll(`#global_filters .${eltClassName} .unread_count`)[0]; - return elt == null ? 0 : Ferdium.safeParseInt(elt.textContent); - } + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-54-g00ecf