From 673a5d2e4489ff9db27c3eccaeeeaa2928bdf615 Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Fri, 18 Sep 2020 20:08:08 -0700 Subject: [PATCH] decaffeinate: fix + remove suggestions --- app/assets/javascripts/_initialization.js | 9 ++------- app/assets/javascripts/collaboration.js | 11 ++--------- app/assets/javascripts/document_editor.js | 9 +-------- app/assets/javascripts/generators.js.js | 13 ++++--------- app/assets/javascripts/image_uploads.js | 9 ++------- app/assets/javascripts/pickers.js.js | 7 +------ app/assets/javascripts/stripe.js | 7 +------ 7 files changed, 13 insertions(+), 52 deletions(-) diff --git a/app/assets/javascripts/_initialization.js b/app/assets/javascripts/_initialization.js index fae41656..b0c617aa 100644 --- a/app/assets/javascripts/_initialization.js +++ b/app/assets/javascripts/_initialization.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ //# This file is prepended with an underscore to ensure it comes alphabetically-first //# when application.js includes all JS files in the directory with require_tree. //# Here be dragons. @@ -26,9 +21,9 @@ Notebook.init = function() { $('.dropdown-trigger').dropdown({ coverTrigger: false }); $('.tooltipped').tooltip({ enterDelay: 50 }); $('.with-character-counter').characterCounter(); - return $('.materialboxed').materialbox(); + $('.materialboxed').materialbox(); }; // We're using $ -> here for document readiness, but if we ever use Turbolinks we'd want: // $(document).on "turbolinks:load", -> -$(() => Notebook.init()); \ No newline at end of file +$(() => Notebook.init()); diff --git a/app/assets/javascripts/collaboration.js b/app/assets/javascripts/collaboration.js index 615be883..8183bf3e 100644 --- a/app/assets/javascripts/collaboration.js +++ b/app/assets/javascripts/collaboration.js @@ -1,12 +1,5 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ -$(() => // When a user clicks to remove a collaborator, we should remove them from the list of collaborators after the remote request finishes +// When a user clicks to remove a collaborator, we should remove them from the list of collaborators after the remote request finishes $('a.js-remove-contributor[data-remote]').on('ajax:success', function(e, data, status, xhr) { - // Remove the image from the UI $(this).closest('.collection-item').fadeOut().remove(); // todo use animate.css for something more fun - -})); \ No newline at end of file +}); diff --git a/app/assets/javascripts/document_editor.js b/app/assets/javascripts/document_editor.js index 15300ad8..8e4e2a2b 100644 --- a/app/assets/javascripts/document_editor.js +++ b/app/assets/javascripts/document_editor.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ Notebook.DocumentEditor = class DocumentEditor { constructor(el) { this.el = el; @@ -113,7 +108,6 @@ Notebook.DocumentEditor = class DocumentEditor { } else { console.log('Waiting for existing autosave'); } - }; editor.subscribe('editableInput', autosave); @@ -127,9 +121,8 @@ Notebook.DocumentEditor = class DocumentEditor { if (keyCode === 9) { e.preventDefault(); } - }); } }; -$(() => new Notebook.DocumentEditor($("body.documents.edit"))); \ No newline at end of file +$(() => new Notebook.DocumentEditor($("body.documents.edit"))); diff --git a/app/assets/javascripts/generators.js.js b/app/assets/javascripts/generators.js.js index 119214c8..2fe9da4c 100644 --- a/app/assets/javascripts/generators.js.js +++ b/app/assets/javascripts/generators.js.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ $(document).ready(function() { // Character name generator @@ -12,7 +7,7 @@ $(document).ready(function() { dataType: 'text', url: '/generate/character/name', success(data) { - return target.val(data); + target.val(data); } }); return 0; @@ -25,20 +20,20 @@ $(document).ready(function() { dataType: 'text', url: '/generate/character/age', success(data) { - return target.val(data); + target.val(data); } }); return 0; }); // Location name generator - return $('.location_name_generator').click(function() { + $('.location_name_generator').click(function() { const target = $(this).closest('.row').find('input[type=text]'); $.ajax({ dataType: 'text', url: '/generate/location/name', success(data) { - return target.val(data); + target.val(data); } }); return 0; diff --git a/app/assets/javascripts/image_uploads.js b/app/assets/javascripts/image_uploads.js index b68546fd..7fb373f0 100644 --- a/app/assets/javascripts/image_uploads.js +++ b/app/assets/javascripts/image_uploads.js @@ -1,10 +1,5 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ -$(() => // When a user clicks to delete an image, we should remove it from the list of images after the remote request finishes +// When a user clicks to delete an image, we should remove it from the list of images after the remote request finishes $('a.js-remove-image[data-remote]').on('ajax:success', function(e, data, status, xhr) { // Remove the image from the UI $(this).closest('.row').fadeOut().remove(); // todo use animate.css for something more fun -})); +}); diff --git a/app/assets/javascripts/pickers.js.js b/app/assets/javascripts/pickers.js.js index be280ad7..d96602f1 100644 --- a/app/assets/javascripts/pickers.js.js +++ b/app/assets/javascripts/pickers.js.js @@ -1,9 +1,4 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ $(document).ready(() => $('.dropdown-picker li a').click(function() { const val = $(this).text(); - return $(this).closest('.row').find('input[type=text]').val(val); + $(this).closest('.row').find('input[type=text]').val(val); })); diff --git a/app/assets/javascripts/stripe.js b/app/assets/javascripts/stripe.js index 8f2556ff..ed844853 100644 --- a/app/assets/javascripts/stripe.js +++ b/app/assets/javascripts/stripe.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ Notebook.StripeHandler = class StripeHandler { constructor(el) { this.el = el; @@ -41,4 +36,4 @@ Notebook.StripeHandler = class StripeHandler { } }; -$(() => new Notebook.StripeHandler($("body.subscriptions.information"))); \ No newline at end of file +$(() => new Notebook.StripeHandler($("body.subscriptions.information")));