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/grape/index.js | 62 ++++++++++++++++++++++++++++++++++------------ recipes/grape/package.json | 2 +- recipes/grape/webview.js | 8 ++++++ 3 files changed, 55 insertions(+), 17 deletions(-) (limited to 'recipes/grape') diff --git a/recipes/grape/index.js b/recipes/grape/index.js index 593f026..1e2a187 100644 --- a/recipes/grape/index.js +++ b/recipes/grape/index.js @@ -1,18 +1,48 @@ -function _asyncToGenerator(fn) { return function () { const gen = Reflect.apply(fn, this, arguments); return new Promise((resolve, reject) => { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then((value) => { step('next', value); }, (error) => { step('throw', error); }); } } return step('next'); }); }; } - -module.exports = Ferdium => class Grape extends Ferdium { - validateUrl(url) { - return _asyncToGenerator(function* () { - try { - const resp = yield window.fetch(url, { - method: 'GET', - }); - return resp.status === 200; - } catch (error) { - console.error(error); +function _asyncToGenerator(fn) { + return function () { + const gen = Reflect.apply(fn, this, arguments); + return new Promise((resolve, reject) => { + function step(key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + // eslint-disable-next-line consistent-return + return Promise.resolve(value).then( + value => { + step('next', value); + }, + error => { + step('throw', error); + }, + ); + } } + return step('next'); + }); + }; +} + +module.exports = Ferdium => + class Grape extends Ferdium { + validateUrl(url) { + return _asyncToGenerator(function* () { + try { + const resp = yield window.fetch(url, { + method: 'GET', + }); + return resp.status === 200; + } catch (error) { + console.error(error); + } - return false; - })(); - } -}; + return false; + })(); + } + }; diff --git a/recipes/grape/package.json b/recipes/grape/package.json index 9fe40ab..6b09778 100644 --- a/recipes/grape/package.json +++ b/recipes/grape/package.json @@ -1,7 +1,7 @@ { "id": "grape", "name": "Grape", - "version": "1.2.0", + "version": "1.3.0", "license": "MIT", "config": { "serviceURL": "https://{teamId}.chatgrape.com/chat", diff --git a/recipes/grape/webview.js b/recipes/grape/webview.js index 6349bd0..0115205 100644 --- a/recipes/grape/webview.js +++ b/recipes/grape/webview.js @@ -1,3 +1,9 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + module.exports = Ferdium => { const getMessages = () => { const directMessages = document.querySelectorAll('.c0120').length; @@ -7,4 +13,6 @@ module.exports = Ferdium => { }; Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-70-g09d2