From 9354a09d1ca5dfb16325ebd3b30ecc28b16ab7e1 Mon Sep 17 00:00:00 2001 From: Harsh Zalavadiya Date: Tue, 16 Nov 2021 07:56:11 +0000 Subject: [PATCH] refactor: :recycle: lint --- .prettierrc | 5 +++++ README.md | 22 +++++++++++----------- package-lock.json | 5 +++++ package.json | 6 +++--- www/chooser.js | 13 ++++++++----- 5 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 .prettierrc create mode 100644 package-lock.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..413dd59 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "singleQuote": true +} diff --git a/README.md b/README.md index 269b9fd..5eb1e33 100755 --- a/README.md +++ b/README.md @@ -19,16 +19,16 @@ cordova plugin add cordova-plugin-simple-file-chooser ```js /** - * Displays native prompt for user to select one or more files. - * - * @param accept Optional MIME type filter (e.g. 'image/gif,video/*'). - * - * @returns Promise containing selected files' information, - * MIME type, display name, and original URI. - * - * If user cancels, promise will be resolved as undefined. - * If error occurs, promise will be rejected. - */ + * Displays native prompt for user to select one or more files. + * + * @param accept Optional MIME type filter (e.g. 'image/gif,video/*'). + * + * @returns Promise containing selected files' information, + * MIME type, display name, and original URI. + * + * If user cancels, promise will be resolved as undefined. + * If error occurs, promise will be rejected. + */ chooser.getFiles(accept?: string) : Promise (https://github.com/cyph)", "license": "Apache-2.0", "bugs": { - "url": "https://github.com/harshzalavadiya/cordova-plugin-simple-file-chooser/issues" + "url": "https://github.com/hc-oss/cordova-plugin-simple-file-chooser/issues" }, "cordova": { "id": "cordova-plugin-simple-file-chooser", @@ -30,4 +30,4 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" } -} \ No newline at end of file +} diff --git a/www/chooser.js b/www/chooser.js index 41d3979..4b7eb5f 100755 --- a/www/chooser.js +++ b/www/chooser.js @@ -5,15 +5,18 @@ module.exports = { function (json) { try { resolve(JSON.parse(json)); - } - catch (err) { + } catch (err) { reject(err); } }, reject, 'Chooser', 'getFiles', - [(typeof accept === 'string' ? accept.replace(/\s/g, '') : undefined) || '*/*'] + [ + (typeof accept === 'string' + ? accept.replace(/\s/g, '') + : undefined) || '*/*', + ] ); }); @@ -25,5 +28,5 @@ module.exports = { } return result; - } -}; \ No newline at end of file + }, +};