From 9b8f01716774a960073e944823ab727cc867a8f6 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Wed, 26 Jul 2023 06:29:03 -0600 Subject: 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 --- recipes/skype/index.js | 13 +++++++---- recipes/skype/package.json | 2 +- recipes/skype/webview-unsafe.js | 5 +++- recipes/skype/webview.js | 51 +++++++++++++++++++++++++---------------- 4 files changed, 44 insertions(+), 27 deletions(-) (limited to 'recipes/skype') diff --git a/recipes/skype/index.js b/recipes/skype/index.js index 425683a..0f18b4f 100644 --- a/recipes/skype/index.js +++ b/recipes/skype/index.js @@ -1,5 +1,8 @@ -module.exports = (Ferdium) => class Messenger extends Ferdium { - overrideUserAgent() { - return window.navigator.userAgent.replace(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '').trim(); - } -}; +module.exports = Ferdium => + class Messenger extends Ferdium { + overrideUserAgent() { + return window.navigator.userAgent + .replaceAll(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '') + .trim(); + } + }; diff --git a/recipes/skype/package.json b/recipes/skype/package.json index 18d5b37..32fcef9 100644 --- a/recipes/skype/package.json +++ b/recipes/skype/package.json @@ -1,7 +1,7 @@ { "id": "skype", "name": "Skype", - "version": "3.5.4", + "version": "3.6.0", "license": "MIT", "config": { "serviceURL": "https://web.skype.com/", diff --git a/recipes/skype/webview-unsafe.js b/recipes/skype/webview-unsafe.js index 28f5e0e..a782464 100644 --- a/recipes/skype/webview-unsafe.js +++ b/recipes/skype/webview-unsafe.js @@ -1,4 +1,7 @@ -const nameDescriptor = Object.getOwnPropertyDescriptor(Plugin.prototype, 'name'); +const nameDescriptor = Object.getOwnPropertyDescriptor( + Plugin.prototype, + 'name', +); const getName = nameDescriptor.get; Object.defineProperty(Plugin.prototype, 'name', { ...nameDescriptor, diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js index db97d98..45bc005 100644 --- a/recipes/skype/webview.js +++ b/recipes/skype/webview.js @@ -1,6 +1,8 @@ -const _path = _interopRequireDefault(require('path')); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const _path = _interopRequireDefault(require('path')); module.exports = (Ferdium, settings) => { const getMessages = () => { @@ -8,13 +10,16 @@ module.exports = (Ferdium, settings) => { const container = document.querySelector('[role="tablist"] > button > div'); if (container) { - const children = container.children; + const { children } = container; if (children.length === 3) { + // eslint-disable-next-line unicorn/prefer-at const elementContainer = children[children.length - 1]; if (elementContainer) { - const element = elementContainer.querySelector('[data-text-as-pseudo-element]'); + const element = elementContainer.querySelector( + '[data-text-as-pseudo-element]', + ); if (element && element.dataset) { count = Ferdium.safeParseInt(element.dataset.textAsPseudoElement); } @@ -31,21 +36,27 @@ module.exports = (Ferdium, settings) => { Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); // TODO: See how this can be moved into the main ferdium app and sent as an ipc message for opening with a new window or same Ferdium recipe's webview based on user's preferences - document.addEventListener('click', event => { - const link = event.target.closest('a[href^="http"]'); - const button = event.target.closest('button[title^="http"]'); - - if (link || button) { - const url = link ? link.getAttribute('href') : button.getAttribute('title'); - - event.preventDefault(); - event.stopPropagation(); - - if (settings.trapLinkClicks === true) { - window.location.href = url; - } else { - Ferdium.openNewWindow(url); + document.addEventListener( + 'click', + event => { + const link = event.target.closest('a[href^="http"]'); + const button = event.target.closest('button[title^="http"]'); + + if (link || button) { + const url = link + ? link.getAttribute('href') + : button.getAttribute('title'); + + event.preventDefault(); + event.stopPropagation(); + + if (settings.trapLinkClicks === true) { + window.location.href = url; + } else { + Ferdium.openNewWindow(url); + } } - } - }, true); + }, + true, + ); }; -- cgit v1.2.3-54-g00ecf