diff options
author | 2023-07-26 06:29:03 -0600 | |
---|---|---|
committer | 2023-07-26 17:59:03 +0530 | |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/gmail/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/gmail/webview.js')
-rw-r--r-- | recipes/gmail/webview.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/recipes/gmail/webview.js b/recipes/gmail/webview.js index fb8cf76..dead877 100644 --- a/recipes/gmail/webview.js +++ b/recipes/gmail/webview.js | |||
@@ -1,13 +1,13 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | 1 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | 2 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 3 | } |
6 | 4 | ||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
8 | // if the user is on gmail's landing page, go to the login page. | 8 | // if the user is on gmail's landing page, go to the login page. |
9 | if ( | 9 | if ( |
10 | location.hostname == 'www.google.com' && | 10 | location.hostname === 'www.google.com' && |
11 | location.href.includes('gmail/about/') | 11 | location.href.includes('gmail/about/') |
12 | ) { | 12 | ) { |
13 | location.href = | 13 | location.href = |
@@ -19,22 +19,22 @@ module.exports = Ferdium => { | |||
19 | let countNonImportant = 0; | 19 | let countNonImportant = 0; |
20 | const inboxLinks = document.querySelectorAll('.J-Ke.n0'); | 20 | const inboxLinks = document.querySelectorAll('.J-Ke.n0'); |
21 | if (inboxLinks.length > 0) { | 21 | if (inboxLinks.length > 0) { |
22 | let parentNode = inboxLinks[0].parentNode; | 22 | const { parentNode } = inboxLinks[0]; |
23 | if (parentNode) { | 23 | if (parentNode) { |
24 | let parentNodeOfParentNode = parentNode.parentNode; | 24 | const parentNodeOfParentNode = parentNode.parentNode; |
25 | if (parentNodeOfParentNode) { | 25 | if (parentNodeOfParentNode) { |
26 | const unreadCounts = parentNodeOfParentNode.querySelectorAll('.bsU'); | 26 | const unreadCounts = parentNodeOfParentNode.querySelectorAll('.bsU'); |
27 | if (unreadCounts.length > 0) { | 27 | if (unreadCounts.length > 0) { |
28 | let unreadCount = unreadCounts[0].textContent; | 28 | const unreadCount = unreadCounts[0].textContent; |
29 | if (unreadCount.includes(':')) { | 29 | if (unreadCount.includes(':')) { |
30 | let counts = unreadCount | 30 | const counts = unreadCount |
31 | .split(':') | 31 | .split(':') |
32 | .map(s => Ferdium.safeParseInt(s.replace(/[^\p{N}]/gu, ''))); | 32 | .map(s => Ferdium.safeParseInt(s.replaceAll(/[^\p{N}]/gu, ''))); |
33 | countImportant = counts[0]; | 33 | countImportant = counts[0]; |
34 | countNonImportant = counts[1] - counts[0]; | 34 | countNonImportant = counts[1] - counts[0]; |
35 | } else { | 35 | } else { |
36 | countImportant = Ferdium.safeParseInt( | 36 | countImportant = Ferdium.safeParseInt( |
37 | unreadCount.replace(/[^\p{N}]/gu, ''), | 37 | unreadCount.replaceAll(/[^\p{N}]/gu, ''), |
38 | ); | 38 | ); |
39 | } | 39 | } |
40 | } | 40 | } |