From d3841b766f9d37d557646003899f67525c5f755f Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 5 Oct 2021 17:04:09 +0200 Subject: chore: add eslint-plugin-unicorn (#733) --- recipes/infomaniak-mail/index.js | 3 +-- recipes/infomaniak-mail/webview.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'recipes/infomaniak-mail') diff --git a/recipes/infomaniak-mail/index.js b/recipes/infomaniak-mail/index.js index 93f2dcf..24184f8 100644 --- a/recipes/infomaniak-mail/index.js +++ b/recipes/infomaniak-mail/index.js @@ -1,2 +1 @@ -module.exports = Ferdi => class infomaniakmail extends Ferdi { -}; +module.exports = Ferdi => class infomaniakmail extends Ferdi {}; diff --git a/recipes/infomaniak-mail/webview.js b/recipes/infomaniak-mail/webview.js index 04ac42d..f4e39dc 100644 --- a/recipes/infomaniak-mail/webview.js +++ b/recipes/infomaniak-mail/webview.js @@ -1,8 +1,16 @@ module.exports = Ferdi => { const getMessages = () => { - const count = document.querySelector('.ws-tree-node-badge').innerText; - Ferdi.setBadge(count ? Number(count.substring(1, count.length - 1)) : 0); - } + const count = document.querySelector('.ws-tree-node-badge'); + if (count) { + const countText = count.textContent; + if (countText) { + Ferdi.setBadge( + // eslint-disable-next-line unicorn/prefer-string-slice + count ? Number(countText.substring(1, countText.length - 1)) : 0, + ); + } + } + }; Ferdi.loop(getMessages); }; -- cgit v1.2.3-70-g09d2