diff options
author | 2023-07-26 06:29:03 -0600 | |
---|---|---|
committer | 2023-07-26 17:59:03 +0530 | |
commit | 9b8f01716774a960073e944823ab727cc867a8f6 (patch) | |
tree | 732b83770baa78f5cf12776aaa33ce65bebfa418 /recipes/hipchat/index.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/hipchat/index.js')
-rw-r--r-- | recipes/hipchat/index.js | 76 |
1 files changed, 53 insertions, 23 deletions
diff --git a/recipes/hipchat/index.js b/recipes/hipchat/index.js index ce3256b..e786bcb 100644 --- a/recipes/hipchat/index.js +++ b/recipes/hipchat/index.js | |||
@@ -1,27 +1,57 @@ | |||
1 | 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'); }); }; } | 1 | function _asyncToGenerator(fn) { |
2 | return function () { | ||
3 | const gen = Reflect.apply(fn, this, arguments); | ||
4 | return new Promise((resolve, reject) => { | ||
5 | function step(key, arg) { | ||
6 | try { | ||
7 | var info = gen[key](arg); | ||
8 | var value = info.value; | ||
9 | } catch (error) { | ||
10 | reject(error); | ||
11 | return; | ||
12 | } | ||
13 | if (info.done) { | ||
14 | resolve(value); | ||
15 | } else { | ||
16 | // eslint-disable-next-line consistent-return | ||
17 | return Promise.resolve(value).then( | ||
18 | value => { | ||
19 | step('next', value); | ||
20 | }, | ||
21 | error => { | ||
22 | step('throw', error); | ||
23 | }, | ||
24 | ); | ||
25 | } | ||
26 | } | ||
27 | return step('next'); | ||
28 | }); | ||
29 | }; | ||
30 | } | ||
2 | 31 | ||
3 | module.exports = Ferdium => class HipChat extends Ferdium { | 32 | module.exports = Ferdium => |
4 | validateUrl(url) { | 33 | class HipChat extends Ferdium { |
5 | return _asyncToGenerator(function* () { | 34 | validateUrl(url) { |
6 | try { | 35 | return _asyncToGenerator(function* () { |
7 | const resp = yield window.fetch(`${url}/api/features`, { | 36 | try { |
8 | method: 'GET', | 37 | const resp = yield window.fetch(`${url}/api/features`, { |
9 | headers: { | 38 | method: 'GET', |
10 | 'Content-Type': 'application/json', | 39 | headers: { |
11 | }, | 40 | 'Content-Type': 'application/json', |
12 | }); | 41 | }, |
13 | const data = yield resp.json(); | 42 | }); |
43 | const data = yield resp.json(); | ||
14 | 44 | ||
15 | return Object.hasOwnProperty.call(data, 'features'); | 45 | return Object.hasOwnProperty.call(data, 'features'); |
16 | } catch (error) { | 46 | } catch (error) { |
17 | console.error(error); | 47 | console.error(error); |
18 | } | 48 | } |
19 | 49 | ||
20 | return false; | 50 | return false; |
21 | })(); | 51 | })(); |
22 | } | 52 | } |
23 | 53 | ||
24 | buildUrl(url) { | 54 | buildUrl(url) { |
25 | return `${url}/chat`; | 55 | return `${url}/chat`; |
26 | } | 56 | } |
27 | }; | 57 | }; |