diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2023-07-26 06:29:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 17:59:03 +0530 |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/github/webview.js | |
parent | Add Excalidraw recipe (#393) (diff) | |
download | ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.gz ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.tar.zst ferdium-recipes-9b8f01716774a960073e944823ab727cc867a8f6.zip |
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 <vraravam@users.noreply.github.com>
Diffstat (limited to 'recipes/github/webview.js')
-rw-r--r-- | recipes/github/webview.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/recipes/github/webview.js b/recipes/github/webview.js index b73e96e..3068b80 100644 --- a/recipes/github/webview.js +++ b/recipes/github/webview.js | |||
@@ -1,5 +1,11 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
1 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
2 | const _parseNewCount = (text) => { | 8 | const _parseNewCount = text => { |
3 | const match = text.match(/\d+/); | 9 | const match = text.match(/\d+/); |
4 | return match ? Ferdium.safeParseInt(match[0]) : 0; | 10 | return match ? Ferdium.safeParseInt(match[0]) : 0; |
5 | }; | 11 | }; |
@@ -11,17 +17,24 @@ module.exports = Ferdium => { | |||
11 | let directCount = directCountElement | 17 | let directCount = directCountElement |
12 | ? Ferdium.safeParseInt(directCountElement.textContent) | 18 | ? Ferdium.safeParseInt(directCountElement.textContent) |
13 | : 0; | 19 | : 0; |
14 | 20 | ||
15 | const newCountElement = document.querySelector('a.h6[href="/notifications?query="]'); | 21 | const newCountElement = document.querySelector( |
16 | const newCount = newCountElement ? | 22 | 'a.h6[href="/notifications?query="]', |
17 | _parseNewCount(newCountElement.textContent) : 0; | 23 | ); |
24 | const newCount = newCountElement | ||
25 | ? _parseNewCount(newCountElement.textContent) | ||
26 | : 0; | ||
18 | directCount += newCount; | 27 | directCount += newCount; |
19 | 28 | ||
20 | const indirectCount = document.querySelector( | 29 | const indirectCount = document.querySelector( |
21 | '[class*="mail-status unread"]:not([hidden])', | 30 | '[class*="mail-status unread"]:not([hidden])', |
22 | ) ? 1 : 0; | 31 | ) |
32 | ? 1 | ||
33 | : 0; | ||
23 | Ferdium.setBadge(directCount, indirectCount); | 34 | Ferdium.setBadge(directCount, indirectCount); |
24 | }; | 35 | }; |
25 | 36 | ||
26 | Ferdium.loop(getMessages); | 37 | Ferdium.loop(getMessages); |
38 | |||
39 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
27 | }; | 40 | }; |