aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/github
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-26 06:29:03 -0600
committerLibravatar GitHub <noreply@github.com>2023-07-26 17:59:03 +0530
commit9b8f01716774a960073e944823ab727cc867a8f6 (patch)
tree732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/github
parentAdd Excalidraw recipe (#393) (diff)
downloadferdium-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')
-rw-r--r--recipes/github/package.json2
-rw-r--r--recipes/github/webview.js25
2 files changed, 20 insertions, 7 deletions
diff --git a/recipes/github/package.json b/recipes/github/package.json
index fa734c7..8788aad 100644
--- a/recipes/github/package.json
+++ b/recipes/github/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "github", 2 "id": "github",
3 "name": "GitHub", 3 "name": "GitHub",
4 "version": "2.5.3", 4 "version": "2.6.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://github.com/notifications", 7 "serviceURL": "https://github.com/notifications",
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 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
6
1module.exports = Ferdium => { 7module.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};