diff options
author | 2023-07-26 06:29:03 -0600 | |
---|---|---|
committer | 2023-07-26 17:59:03 +0530 | |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/freshrss/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/freshrss/webview.js')
-rw-r--r-- | recipes/freshrss/webview.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/recipes/freshrss/webview.js b/recipes/freshrss/webview.js index cdc6e55..9740b08 100644 --- a/recipes/freshrss/webview.js +++ b/recipes/freshrss/webview.js | |||
@@ -1,18 +1,22 @@ | |||
1 | "use strict"; | 1 | function _interopRequireDefault(obj) { |
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
2 | 6 | ||
3 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
4 | const getMessages = function getMessages() { | 8 | const getMessages = function getMessages() { |
5 | // Initialize empty vars | 9 | // Initialize empty vars |
6 | var unread = 0; | 10 | let unread = 0; |
7 | var match = []; | 11 | let match = []; |
8 | // Define RegExp to replace occasionally   | 12 | // Define RegExp to replace occasionally   |
9 | var re = new RegExp(String.fromCodePoint(160), "g"); | 13 | const re = new RegExp(String.fromCodePoint(160), 'g'); |
10 | // Get value of <title> tag where in case of new feed elements the number of elements appear | 14 | // Get value of <title> tag where in case of new feed elements the number of elements appear |
11 | const titleValue = document.querySelector('title').text.replace(re, ""); | 15 | const titleValue = document.querySelector('title').text.replaceAll(re, ''); |
12 | // Extract the number from the tag | 16 | // Extract the number from the tag |
13 | match = titleValue.match(/[\d\s]+/); | 17 | match = titleValue.match(/[\d\s]+/); |
14 | // Some logic to handle the match groups | 18 | // Some logic to handle the match groups |
15 | unread = match != null && match.length > 0 ? match[0] : 0; | 19 | unread = match !== null && match.length > 0 ? match[0] : 0; |
16 | // Set unread msgs badge | 20 | // Set unread msgs badge |
17 | Ferdium.setBadge(Number.parseInt(unread, 10)); | 21 | Ferdium.setBadge(Number.parseInt(unread, 10)); |
18 | }; | 22 | }; |
@@ -22,4 +26,6 @@ module.exports = Ferdium => { | |||
22 | }; | 26 | }; |
23 | 27 | ||
24 | Ferdium.loop(loopFunc); | 28 | Ferdium.loop(loopFunc); |
29 | |||
30 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
25 | }; | 31 | }; |