From f6da45f17bab4375478222f869c3c400666c1200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Salomv=C3=A1ry?= Date: Tue, 30 Apr 2019 09:46:38 +0200 Subject: [PATCH] Format code using Prettier --- .eslintrc | 8 +-- .prettierrc.json | 5 ++ .travis.yml | 11 ++-- CHANGELOG.md | 35 +++++++++++- CONTRIBUTING.md | 6 +- DEVELOPMENT.md | 9 ++- MAINTENANCE.md | 5 +- README.markdown | 4 +- app/about.html | 71 +++++++++++++++--------- app/auto-updater.js | 12 +++- app/error-handlers.js | 4 +- app/error.html | 8 +-- app/is-soundcloud-url.js | 5 +- app/macos-swipe-navigation.js | 16 ++++-- app/main.js | 64 +++++++++++++--------- app/menu.js | 21 ++++--- app/options.js | 3 +- app/package-lock.json | 51 +++++------------ app/preload.js | 13 +++-- app/soundcloud.js | 10 ++-- app/window-open-policy.js | 6 +- appveyor.yml | 1 - gulpfile.js | 100 ++++++++++++++++++---------------- package-lock.json | 64 ++++++++++++---------- package.json | 8 ++- test/application-helper.js | 14 +++-- test/login-test.js | 21 ++++--- test/options.js | 11 ++-- test/test.js | 4 +- test/window-open-test.js | 58 ++++++++++---------- test/window-open.html | 32 ++++++++--- 31 files changed, 392 insertions(+), 288 deletions(-) create mode 100644 .prettierrc.json diff --git a/.eslintrc b/.eslintrc index 3ceb96a..cea3b41 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": "airbnb-base", + "extends": ["airbnb-base", "prettier"], "parserOptions": { "sourceType": "scripts" }, @@ -9,17 +9,13 @@ "es6": true }, "rules": { - "comma-dangle": ["error", "never"], "consistent-return": "off", "eqeqeq": "off", "import/order": "off", - "indent": [2, 2], "no-console": 0, "no-use-before-define": ["error", "nofunc"], "prefer-template": "off", - "semi": [2, "never"], - "strict": [2, "global"], - "curly": [2, "all"] + "strict": [2, "global"] }, "settings": { "import/core-modules": [ "electron" ] diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..ee136f3 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "semi": false, + "singleQuote": true, + "arrowParens": "always" +} diff --git a/.travis.yml b/.travis.yml index b438980..10be97f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ os: -- osx + - osx language: node_js node_js: -- '8' + - '8' script: -- npm run eslint -- npm test -- npm run release + - npm run eslint + - npm run prettier + - npm test + - npm run release env: secure: pTXmdkvqiBTO66GlnMkz8m2WSkXQ3mp3s5JB/0mnP17eMUbd17P0TomKT5yIoBp3CcXGuFmVYzNV/rqZQwgDgEiwNFotIsCEPjd/eLrsLeBt0IYic0qqKhi7+hDFhFzPfMvpkiDl3pNlzH0ehpubZ029uGn1J2id0jmicwcvLsuIHukyuWUhuNIRjounJBuiaLd5CuZc2JnSoGY5Mz5f9rkqu/lYFKIa/8xSLXlor5ABzZVQEQQHY06dc/2cFW5frV4QH0BOkFl84lNFXBkrUoVG/IR3/E3obQOpnrhebdTQBACbyn7DRqYdXCERDEFdsrCyTowsWj8xAGE0vZZ80eu2jDdLeWhY4Wpw/58IhRh4O/zHXn/gWMCN1Dya6P/2reuNqn3jhN3xYkU9su9fZLMTeD4/X/Ru5J5hUx+mv+TCX2t2mkL60cquv7kYg3oiWL17RtJKmA5J/Na2qLPsNzNzmhhu4lvSFCSwAjOdAQ0YorvK2rdd+smWRQTkW2t7oWngrwZS5T0I1RzLlpQpiiXOQCHjfwKKuPtu01XyKH9up7uzwFxvZx8JURy9I0BHHSn4ojz7aIARpcVk3ioMtoaOBruMKwkCaWpqn1RBo96q4BJ1lIKAVSY5XeH7IR6DQ83Z9CsQAizPtihY0WgKrnvgmcnPo8N5cSmhbwiflXI= diff --git a/CHANGELOG.md b/CHANGELOG.md index 69dd8ef..f79d3a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,72 +1,89 @@ ## 1.4.0 (August 31, 2018) + - Allow launching with a SoundCloud URL from the command line - Security updates ## 1.3.4 (March 23, 2018) + - Fix broken history navigation shortcuts ## 1.3.3 (February 26, 2018) + - Fix reposting and liking tracks while searching #163 #165 - Fix Bluetooth headphone Play/Pause #159 - Fix "window is not defined" on network errors #149 ## 1.3.2 (November 28, 2017) + - Fix notification spam when seeking or restarting play - Adds a "repost" option to all of the menus - Bring in latest security fixes from Electron (see https://electron.atom.io/releases/) ## 1.3.1 (October 17, 2017) (revoked release due to broken signatures) + - Fix notification spam when seeking or restarting play - Adds a "repost" option to all of the menus - Bring in latest security fixes from Electron (see https://electron.atom.io/releases/) ## 1.3.0 (April 20, 2017) + - Support Windows back/forward/home keys - Add MacBook Touch Bar support ## 1.2.0 (March 14, 2017) + - Fix full screen closing/quitting on macOS - Add like/unlike to the main and dock menus - Show album art on desktop notification -## 1.1.9 (March 3, 2017) +## 1.1.9 (March 3, 2017) + - Fix black screen when closing fullscreen app ## 1.1.8 (January 17, 2017) + - Fix accidental back navigation when scrolling ## 1.1.7 (January 14, 2017) + - Add experimental swipe back/forward navigation - Fix media key flakyness under some circumstances - Fix crash on startup #130 ## 1.1.6 (November 23, 2016) + - Release SoundCleod for Windows - Yet another fix for Facebook login ## 1.1.5 (November 16, 2016) + - Allow hiding main window with Cmd+1 - Prevent quitting with Cmd+W on macOS ## 1.1.4 (November 14, 2016) + - Fix broken play/pause/prev/next menu items - Prevent exception on right clicking certain elements - Download updates from https://updates.soundcleod.com -## 1.1.3 (November 4, 2016) +## 1.1.3 (November 4, 2016) + - Fix Google login (again) - Improve how window position is saved ## 1.1.2 (October 18, 2016) + - Log detailed errors for easier debugging ## 1.1.1 (October 18, 2016) + - Improve when the error screen is shown - Show error code on the error screen - Open share windows within SoundCleod (again) - Fix Facebook login (again) -## 1.1.0 (October 7, 2016) +## 1.1.0 (October 7, 2016) + - Fix Facebook login - Open external links in system browser - Add standard actions to the context menu @@ -104,50 +121,62 @@ happen quickly. They will hopefully added back some time in the near future: - Space bar play/pause control only works if SoundCleod is in foreground ## 0.20 (June 17, 2016) + - Fix startup with blank screen (upgrade Sparkle to latest) - Update the list of applications for media keys compatibility ## 0.19 (May 26, 2016) + - Fix broken media keys ## 0.18 (May 15, 2015) + - Added "History" and "Controls" menu - Removed the "Install Flash" dialog - Added DockMenu support for pause/play, previous and next ## 0.17 (December 19, 2014) + - detect and prompt when Flash Plugin is blocked by Safari ## 0.16 (December 7, 2014) + - Prompt for installing the plugin when no Flash for Safari is detected - Show current URL in the "open location" dialog (Cmd+L) - Fixed spacebar for keyboard navigation and play/pause when hidden ## 0.15 (November 13, 2014) + - Another attempt to fix scrolling issues with Yosemite ## 0.14 (November 5, 2014) + - Fix scrolling issues with Yosemite - Removed swipe back-forward navigation - Added microphone start/stop button support ## 0.13 (October 14, 2014) + - Fix broken media keys - Fix broken "open SoundCloud url" dialog - Support custom cleod:// url scheme ## 0.12 (November 8, 2013) + - Automatic updates yay! ## 0.11 (October 10, 2013) + - fixed closing window stops music in certain cases - notifications support ## 0.10 (September 13, 2013) + - added reload menu item and Cmd+R shortcut - added main window menu item and Cmd+1 shortcut ## 0.9.1 (August 1, 2013) + - distributed as .dmg package instead of Mac Installer - compatible with OSX 10.7 Lion diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cd731f3..1aa84d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ docs](DEVELOPMENT.md). ## Submitting bug reports Please **do not report issues with soundcloud.com** here. If you found a bug or have some other problem using SoundCloud's website or mobile apps please [contact - SoundCloud through one of their support channels directly](https://soundcloud.com/pages/contact). +SoundCloud through one of their support channels directly](https://soundcloud.com/pages/contact). Besides a clear explanation of what problem you are facing please provide the following details: @@ -23,7 +23,7 @@ following details: ## Requesting or adding new features -SoundCleod is meant to be a *lightweight* desktop application for +SoundCleod is meant to be a _lightweight_ desktop application for soundcloud.com. Although there are thousands of ways to extend the functionality of both the application and the website please be very considerate when coming up with new ideas. @@ -49,7 +49,7 @@ There are a few conventions to follow: - Indent with two spaces - No semicolons in JavaScript - Change one thing only in a pull request -- Make sure there are no failing tests or linting errors (`npm test` and `npm run eslint` must pass) +- Make sure there are no failing tests, code quality and styling errors (`npm run verify` must pass) - Keep commit messages short - Use the present tense in commit messages ("Add feature" not "Added feature") - Use the imperative mood in commit messages ("Move cursor to..." not "Moves cursor to...") diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 08d1f82..607b454 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -16,7 +16,10 @@ SoundCleod comes with a small test suite: npm test -- test/options.js # run a single test file The JavaScript code is verified with ESLint. It is strongly recommended to [install a plugin -for your editor](https://eslint.org/docs/user-guide/integrations#editors) or simply run `npm run eslint` from the command line. +for your editor](https://eslint.org/docs/user-guide/integrations#editors) or simply run `npm run eslint` from the command line. Some problems can automatically be fixed using `npm run eslint:fix`. + +Consistent code formatting is enforced with Prettier. It is strongly recommended to [install a plugin +for your editor](https://prettier.io/docs/en/editors.html). To verify correct formatting run `npm run prettier` from the command line, to reformat files use `npm run prettier:fix`. Now that you are all set start making changes and check out the [Electron documentation](https://electronjs.org/docs) for more! @@ -43,8 +46,8 @@ Distributable installers can be built with the npm `dist` script: Start SoundCleod with `npm start` or the installed application with `--developer-tools`: /Applications/SoundCleod.app/Contents/MacOS/SoundCleod --developer-tools - -Use Cmd+Option+I to toggle Developer Tools or use View > Toggle Developer Tools from the menu. + +Use Cmd+Option+I to toggle Developer Tools or use View > Toggle Developer Tools from the menu. ## Tricks and tips diff --git a/MAINTENANCE.md b/MAINTENANCE.md index 2c94784..6825da0 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -71,7 +71,7 @@ Exporting a macOS certificate for signing a Windows application: This is required for automatically publishing releases to GitHub. - Create a [new personal access token on GitHub](https://github.com/settings/tokens) - - Only enable `public_repo` permission + - Only enable `public_repo` permission - [Encrypt the token for AppVeyor here](https://ci.appveyor.com/tools/encrypt) - Update `environment.GH_TOKEN.secure` with the token in `appveyor.yml` - Update the token in `.travis.yml` with `travis encrypt --add env GH_TOKEN=` (install the Travis Gem first with `gem install travis`) @@ -80,8 +80,7 @@ This is required for automatically publishing releases to GitHub. ## Set up code signing certificates on Travis CI and AppVeyor - Export the certificate as `codesign-certificate.p12` -- Encode file to base64 (macOS: `base64 -i codesign-certificate.p12 | pbcopy`, Linux: `base64 codesign-certificate.p12 > - codesign-certificate.txt`). +- Encode file to base64 (macOS: `base64 -i codesign-certificate.p12 | pbcopy`, Linux: `base64 codesign-certificate.p12 > codesign-certificate.txt`). - Set `CSC_LINK` and `CSC_KEY_PASSWORD` environment variables. The base64 encoded value goes into `CSC_LINK` without change. - [Travis CI Settings](https://travis-ci.org/salomvary/soundcleod/settings) - [AppVeyor Settings](https://ci.appveyor.com/project/salomvary/soundcleod/settings/environment) diff --git a/README.markdown b/README.markdown index 25376fe..c444046 100644 --- a/README.markdown +++ b/README.markdown @@ -19,7 +19,7 @@ Current version is 1.4.0 (August 31, 2018) [see changes](https://github.com/salo ### For macOS - [Download macOS installer from - here](https://github.com/salomvary/soundcleod/releases/download/v1.4.0/soundcleod-1.4.0.dmg) + here](https://github.com/salomvary/soundcleod/releases/download/v1.4.0/soundcleod-1.4.0.dmg) - Locate the installer (.dmg) file in the Finder - Right click (or control-click) on the installer file - If prompted **"SoundCleod-1.4.0.dmg" is from an unidentified developer. Are you sure you want to open it?**, @@ -43,7 +43,7 @@ To use media keys on macOS Mojave (10.14) or newer: ### For Windows - [Download Windows installer from - here](https://github.com/salomvary/soundcleod/releases/download/v1.4.0/soundcleod-Setup-1.4.0.exe) + here](https://github.com/salomvary/soundcleod/releases/download/v1.4.0/soundcleod-Setup-1.4.0.exe) - Save the file when prompted - Run the downloaded installer diff --git a/app/about.html b/app/about.html index e3d6d29..99fde2d 100644 --- a/app/about.html +++ b/app/about.html @@ -1,7 +1,7 @@ - + About SoundCleod - +