diff --git a/app/assets/javascripts/admin/components/screened_ip_address_form_component.js b/app/assets/javascripts/admin/components/screened_ip_address_form_component.js index dbae5a9aac9..f752031ff40 100644 --- a/app/assets/javascripts/admin/components/screened_ip_address_form_component.js +++ b/app/assets/javascripts/admin/components/screened_ip_address_form_component.js @@ -50,7 +50,7 @@ Discourse.ScreenedIpAddressFormComponent = Ember.Component.extend({ } }, - didInsertElement: function(e) { + didInsertElement: function() { var self = this; this._super(); Em.run.schedule('afterRender', function() { diff --git a/app/assets/javascripts/admin/controllers/admin_api_controller.js b/app/assets/javascripts/admin/controllers/admin_api_controller.js index 612d81d3e4c..8a0861c6ea4 100644 --- a/app/assets/javascripts/admin/controllers/admin_api_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_api_controller.js @@ -13,9 +13,8 @@ Discourse.AdminApiController = Ember.ArrayController.extend({ Generates a master api key @method generateMasterKey - @param {Discourse.ApiKey} the key to regenerate **/ - generateMasterKey: function(key) { + generateMasterKey: function() { var self = this; Discourse.ApiKey.generateMasterKey().then(function (key) { self.get('model').pushObject(key); diff --git a/app/assets/javascripts/admin/helpers/report_helpers.js b/app/assets/javascripts/admin/helpers/report_helpers.js index 8086a99ce7c..270adc2c11f 100644 --- a/app/assets/javascripts/admin/helpers/report_helpers.js +++ b/app/assets/javascripts/admin/helpers/report_helpers.js @@ -7,7 +7,7 @@ Handlebars.registerHelper('valueAtTrustLevel', function(property, trustLevel) { var data = Ember.Handlebars.get(this, property); if( data ) { - var item = data.find( function(d, i, arr) { return parseInt(d.x,10) === parseInt(trustLevel,10); } ); + var item = data.find( function(d) { return parseInt(d.x,10) === parseInt(trustLevel,10); } ); if( item ) { return item.y; } else { diff --git a/app/assets/javascripts/admin/models/admin_user.js b/app/assets/javascripts/admin/models/admin_user.js index 871deb1f864..911f4cc45ed 100644 --- a/app/assets/javascripts/admin/models/admin_user.js +++ b/app/assets/javascripts/admin/models/admin_user.js @@ -31,7 +31,7 @@ Discourse.AdminUser = Discourse.User.extend({ **/ revokeApiKey: function() { var self = this; - return Discourse.ajax("/admin/users/" + this.get('id') + "/revoke_api_key", {type: 'DELETE'}).then(function (result) { + return Discourse.ajax("/admin/users/" + this.get('id') + "/revoke_api_key", {type: 'DELETE'}).then(function () { self.set('api_key', null); }); }, @@ -51,7 +51,7 @@ Discourse.AdminUser = Discourse.User.extend({ "label": ' ' + I18n.t("admin.user.delete_all_posts"), "class": "btn btn-danger", "callback": function() { - Discourse.ajax("/admin/users/" + (user.get('id')) + "/delete_all_posts", {type: 'PUT'}).then(function(result){ + Discourse.ajax("/admin/users/" + (user.get('id')) + "/delete_all_posts", {type: 'PUT'}).then(function(){ user.set('post_count', 0); }); } @@ -274,7 +274,7 @@ Discourse.AdminUser = Discourse.User.extend({ user.mergeAttributes(data.user); } } - }, function(jqXHR, status, error) { + }, function() { Discourse.AdminUser.find( user.get('username') ).then(function(u){ user.mergeAttributes(u); }); bootbox.alert(I18n.t("admin.user.delete_failed")); }); @@ -325,7 +325,7 @@ Discourse.AdminUser = Discourse.User.extend({ } else { bootbox.alert(I18n.t("admin.user.delete_failed")); } - }, function(jqXHR, status, error) { + }, function() { bootbox.alert(I18n.t("admin.user.delete_failed")); }); } diff --git a/app/assets/javascripts/admin/models/api_key.js b/app/assets/javascripts/admin/models/api_key.js index 7f13ef49ee1..4c21df9a513 100644 --- a/app/assets/javascripts/admin/models/api_key.js +++ b/app/assets/javascripts/admin/models/api_key.js @@ -29,7 +29,6 @@ Discourse.ApiKey = Discourse.Model.extend({ @returns {Promise} a promise that resolves when the key has been revoked **/ revoke: function() { - var self = this; return Discourse.ajax('/admin/api/key', {type: 'DELETE', data: {id: this.get('id')}}); } diff --git a/app/assets/javascripts/admin/models/group.js b/app/assets/javascripts/admin/models/group.js index 3001fd7f924..ce556edd88f 100644 --- a/app/assets/javascripts/admin/models/group.js +++ b/app/assets/javascripts/admin/models/group.js @@ -44,7 +44,7 @@ Discourse.Group = Discourse.Model.extend({ return Discourse.ajax("/admin/groups/" + group.get('id'), {type: "DELETE"}) .then(function(){ return true; - }, function(error) { + }, function() { group.set('disableSave', false); bootbox.alert(I18n.t("admin.groups.delete_failed")); return false; @@ -108,15 +108,5 @@ Discourse.Group.reopenClass({ }); return list; - }, - - find: function(id) { - var promise = new Em.Deferred(); - - setTimeout(function(){ - promise.resolve(Discourse.Group.create({id: 1, name: "all mods", members: ["A","b","c"]})); - }, 1000); - - return promise; } }); diff --git a/app/assets/javascripts/admin/models/report.js b/app/assets/javascripts/admin/models/report.js index 1b79318852e..757fe6f80e6 100644 --- a/app/assets/javascripts/admin/models/report.js +++ b/app/assets/javascripts/admin/models/report.js @@ -6,7 +6,7 @@ Discourse.Report = Discourse.Model.extend({ valueAt: function(numDaysAgo) { if (this.data) { var wantedDate = moment().subtract('days', numDaysAgo).format('YYYY-MM-DD'); - var item = this.data.find( function(d, i, arr) { return d.x === wantedDate; } ); + var item = this.data.find( function(d) { return d.x === wantedDate; } ); if (item) { return item.y; } diff --git a/app/assets/javascripts/admin/models/screened_email.js b/app/assets/javascripts/admin/models/screened_email.js index d2f524414c1..c2a3065b24a 100644 --- a/app/assets/javascripts/admin/models/screened_email.js +++ b/app/assets/javascripts/admin/models/screened_email.js @@ -14,7 +14,7 @@ Discourse.ScreenedEmail = Discourse.Model.extend({ }); Discourse.ScreenedEmail.reopenClass({ - findAll: function(filter) { + findAll: function() { return Discourse.ajax("/admin/logs/screened_emails.json").then(function(screened_emails) { return screened_emails.map(function(b) { return Discourse.ScreenedEmail.create(b); diff --git a/app/assets/javascripts/admin/models/screened_ip_address.js b/app/assets/javascripts/admin/models/screened_ip_address.js index 16fc71382e6..985ee81c394 100644 --- a/app/assets/javascripts/admin/models/screened_ip_address.js +++ b/app/assets/javascripts/admin/models/screened_ip_address.js @@ -45,7 +45,7 @@ Discourse.ScreenedIpAddress = Discourse.Model.extend({ }); Discourse.ScreenedIpAddress.reopenClass({ - findAll: function(filter) { + findAll: function() { return Discourse.ajax("/admin/logs/screened_ip_addresses.json").then(function(screened_ips) { return screened_ips.map(function(b) { return Discourse.ScreenedIpAddress.create(b); diff --git a/app/assets/javascripts/admin/models/screened_url.js b/app/assets/javascripts/admin/models/screened_url.js index 592726f4840..60c4f984b4f 100644 --- a/app/assets/javascripts/admin/models/screened_url.js +++ b/app/assets/javascripts/admin/models/screened_url.js @@ -13,7 +13,7 @@ Discourse.ScreenedUrl = Discourse.Model.extend({ }); Discourse.ScreenedUrl.reopenClass({ - findAll: function(filter) { + findAll: function() { return Discourse.ajax("/admin/logs/screened_urls.json").then(function(screened_urls) { return screened_urls.map(function(b) { return Discourse.ScreenedUrl.create(b); diff --git a/app/assets/javascripts/admin/routes/admin_site_contents_route.js b/app/assets/javascripts/admin/routes/admin_site_contents_route.js index b5399eb830d..8a6d786ea8f 100644 --- a/app/assets/javascripts/admin/routes/admin_site_contents_route.js +++ b/app/assets/javascripts/admin/routes/admin_site_contents_route.js @@ -12,7 +12,7 @@ Discourse.AdminSiteContentsRoute = Discourse.Route.extend({ return Discourse.SiteContentType.findAll(); }, - renderTemplate: function(controller, model) { + renderTemplate: function() { this.render('admin/templates/site_contents', {into: 'admin/templates/admin'}); this.render('admin/templates/site_contents_empty', {into: 'admin/templates/site_contents'}); }, diff --git a/app/assets/javascripts/admin/views/ace_editor_view.js b/app/assets/javascripts/admin/views/ace_editor_view.js index 1fd1d707cf0..e25a49e421b 100644 --- a/app/assets/javascripts/admin/views/ace_editor_view.js +++ b/app/assets/javascripts/admin/views/ace_editor_view.js @@ -42,7 +42,7 @@ Discourse.AceEditorView = Discourse.View.extend({ aceEditorView.editor.setTheme("ace/theme/chrome"); aceEditorView.editor.setShowPrintMargin(false); aceEditorView.editor.getSession().setMode("ace/mode/" + (aceEditorView.get('mode'))); - aceEditorView.editor.on("change", function(e) { + aceEditorView.editor.on("change", function() { aceEditorView.skipContentChangeEvent = true; aceEditorView.set('content', aceEditorView.editor.getSession().getValue()); aceEditorView.skipContentChangeEvent = false; diff --git a/app/assets/javascripts/discourse/controllers/edit_topic_auto_close_controller.js b/app/assets/javascripts/discourse/controllers/edit_topic_auto_close_controller.js index 92391867fd6..4b5268b9dd5 100644 --- a/app/assets/javascripts/discourse/controllers/edit_topic_auto_close_controller.js +++ b/app/assets/javascripts/discourse/controllers/edit_topic_auto_close_controller.js @@ -48,7 +48,7 @@ Discourse.EditTopicAutoCloseController = Discourse.ObjectController.extend(Disco } else { bootbox.alert(I18n.t('composer.auto_close_error'), function() { self.send('showModal'); } ); } - }, function (error) { + }, function () { bootbox.alert(I18n.t('composer.auto_close_error'), function() { self.send('showModal'); } ); }); } diff --git a/app/assets/javascripts/discourse/controllers/list_topics_controller.js b/app/assets/javascripts/discourse/controllers/list_topics_controller.js index 732924018d4..8f5d9b96a57 100644 --- a/app/assets/javascripts/discourse/controllers/list_topics_controller.js +++ b/app/assets/javascripts/discourse/controllers/list_topics_controller.js @@ -55,7 +55,7 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({ }, // Show newly inserted topics - showInserted: function(e) { + showInserted: function() { var tracker = Discourse.TopicTrackingState.current(); // Move inserted into topics diff --git a/app/assets/javascripts/discourse/controllers/login_controller.js b/app/assets/javascripts/discourse/controllers/login_controller.js index f6e2f0dfc06..b64490f08fb 100644 --- a/app/assets/javascripts/discourse/controllers/login_controller.js +++ b/app/assets/javascripts/discourse/controllers/login_controller.js @@ -61,7 +61,7 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona $hidden_login_form.submit(); } - }, function(result) { + }, function() { // Failed to login loginController.flash(I18n.t('login.error'), 'error'); loginController.set('loggingIn', false); diff --git a/app/assets/javascripts/discourse/dialects/dialect.js b/app/assets/javascripts/discourse/dialects/dialect.js index f7c53f1a66a..0b877870ac6 100644 --- a/app/assets/javascripts/discourse/dialects/dialect.js +++ b/app/assets/javascripts/discourse/dialects/dialect.js @@ -183,7 +183,7 @@ Discourse.Dialect = { @param {Function} emitter A function that emits the JsonML for the replacement. **/ inlineReplace: function(token, emitter) { - this.registerInline(token, function(text, match, prev) { + this.registerInline(token, function() { return [token.length, emitter.call(this, token)]; }); }, diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js b/app/assets/javascripts/discourse/helpers/application_helpers.js index 9cb947fcfb6..90944c24397 100644 --- a/app/assets/javascripts/discourse/helpers/application_helpers.js +++ b/app/assets/javascripts/discourse/helpers/application_helpers.js @@ -5,8 +5,7 @@ @for Handlebars **/ Handlebars.registerHelper('breakUp', function(property, hint, options) { - var prop, result, tokens; - prop = Ember.Handlebars.get(this, property, options); + var prop = Ember.Handlebars.get(this, property, options); if (!prop) return ""; hint = Ember.Handlebars.get(this, hint, options); @@ -328,7 +327,7 @@ Handlebars.registerHelper('date', function(property, options) { @method customHTML @for Handlebars **/ -Handlebars.registerHelper('customHTML', function(property, options) { +Handlebars.registerHelper('customHTML', function(property) { var html = PreloadStore.get("customHTML"); if (html && html[property] && html[property].length) { diff --git a/app/assets/javascripts/discourse/initializers/live_development.js b/app/assets/javascripts/discourse/initializers/live_development.js index 6442597c2d6..c4f128c5850 100644 --- a/app/assets/javascripts/discourse/initializers/live_development.js +++ b/app/assets/javascripts/discourse/initializers/live_development.js @@ -31,7 +31,7 @@ Discourse.addInitializer(function() { // Observe file changes return Discourse.MessageBus.subscribe("/file-change", function(data) { Ember.TEMPLATES.empty = Handlebars.compile("
"); - _.each(data,function(me,idx) { + _.each(data,function(me) { if (me === "refresh") { // Refresh if necessary diff --git a/app/assets/javascripts/discourse/lib/autocomplete.js b/app/assets/javascripts/discourse/lib/autocomplete.js index cec4757d860..f8148d0918c 100644 --- a/app/assets/javascripts/discourse/lib/autocomplete.js +++ b/app/assets/javascripts/discourse/lib/autocomplete.js @@ -141,7 +141,6 @@ $.fn.autocomplete = function(options) { if (isInput) { var width = this.width(); - var height = this.height(); wrap = this.wrap("
").parent(); wrap.width(width); if(options.single) { diff --git a/app/assets/javascripts/discourse/lib/caret_position.js b/app/assets/javascripts/discourse/lib/caret_position.js index 4bdb9b316ab..8569d3b7660 100644 --- a/app/assets/javascripts/discourse/lib/caret_position.js +++ b/app/assets/javascripts/discourse/lib/caret_position.js @@ -32,7 +32,7 @@ $.fn.caretPosition = function(options) { span = $("#pos span"); textarea = $(this); - getStyles = function(el, prop) { + getStyles = function(el) { if (el.currentStyle) { return el.currentStyle; } else { diff --git a/app/assets/javascripts/discourse/lib/eyeline.js b/app/assets/javascripts/discourse/lib/eyeline.js index 74ffd125c37..17c97673d1f 100644 --- a/app/assets/javascripts/discourse/lib/eyeline.js +++ b/app/assets/javascripts/discourse/lib/eyeline.js @@ -19,7 +19,6 @@ Discourse.Eyeline.prototype.update = function() { var docViewTop = $(window).scrollTop(), windowHeight = $(window).height(), docViewBottom = docViewTop + windowHeight, - documentHeight = $(document).height(), $elements = $(this.selector), atBottom = false, foundElement = false, diff --git a/app/assets/javascripts/discourse/lib/formatter.js b/app/assets/javascripts/discourse/lib/formatter.js index 0b239aab071..996cefcf448 100644 --- a/app/assets/javascripts/discourse/lib/formatter.js +++ b/app/assets/javascripts/discourse/lib/formatter.js @@ -151,7 +151,7 @@ Discourse.Formatter = (function(){ }; - relativeAgeTiny = function(date, options){ + relativeAgeTiny = function(date){ var format = "tiny"; var distance = Math.round((new Date() - date) / 1000); var distanceInMinutes = Math.round(distance / 60.0); @@ -226,7 +226,7 @@ Discourse.Formatter = (function(){ }; relativeAgeMedium = function(date, options){ - var displayDate, fiveDaysAgo, oneMinuteAgo, fullReadable, leaveAgo, val; + var displayDate, fiveDaysAgo, oneMinuteAgo, fullReadable, leaveAgo; var wrapInSpan = options.wrapInSpan === false ? false : true; leaveAgo = options.leaveAgo; diff --git a/app/assets/javascripts/discourse/lib/key_value_store.js b/app/assets/javascripts/discourse/lib/key_value_store.js index f0bcfbb63f5..9808590a547 100644 --- a/app/assets/javascripts/discourse/lib/key_value_store.js +++ b/app/assets/javascripts/discourse/lib/key_value_store.js @@ -9,7 +9,7 @@ Discourse.KeyValueStore = { initialized: false, context: "", - init: function(ctx, messageBus) { + init: function(ctx) { this.initialized = true; this.context = ctx; }, diff --git a/app/assets/javascripts/discourse/lib/lightbox.js b/app/assets/javascripts/discourse/lib/lightbox.js index e6e574244d1..bdef16a111e 100644 --- a/app/assets/javascripts/discourse/lib/lightbox.js +++ b/app/assets/javascripts/discourse/lib/lightbox.js @@ -15,8 +15,7 @@ Discourse.Lightbox = { callbacks: { open: function() { - var self = this, - wrap = this.wrap, + var wrap = this.wrap, img = this.currItem.img, maxHeight = img.css("max-height"); diff --git a/app/assets/javascripts/discourse/lib/screen_track.js b/app/assets/javascripts/discourse/lib/screen_track.js index 1627092e3db..7d472fb650d 100644 --- a/app/assets/javascripts/discourse/lib/screen_track.js +++ b/app/assets/javascripts/discourse/lib/screen_track.js @@ -84,7 +84,7 @@ Discourse.ScreenTrack = Ember.Object.extend({ var newTimings = {}, totalTimings = this.get('totalTimings'); - _.each(this.get('timings'), function(timing,key) { + _.each(this.get('timings'), function(timing) { if (!totalTimings[timing.postNumber]) totalTimings[timing.postNumber] = 0; diff --git a/app/assets/javascripts/discourse/mixins/load_more.js b/app/assets/javascripts/discourse/mixins/load_more.js index 2839f0c89c8..6466fb715d5 100644 --- a/app/assets/javascripts/discourse/mixins/load_more.js +++ b/app/assets/javascripts/discourse/mixins/load_more.js @@ -10,7 +10,7 @@ **/ Discourse.LoadMore = Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Scrolling, { - scrolled: function(e) { + scrolled: function() { var eyeline = this.get('eyeline'); if (eyeline) { eyeline.update(); } }, diff --git a/app/assets/javascripts/discourse/mixins/scrolling.js b/app/assets/javascripts/discourse/mixins/scrolling.js index def3220df78..ff3f1b65620 100644 --- a/app/assets/javascripts/discourse/mixins/scrolling.js +++ b/app/assets/javascripts/discourse/mixins/scrolling.js @@ -20,7 +20,7 @@ Discourse.Scrolling = Em.Mixin.create({ opts = opts || {debounce: 100}; var self = this, - onScrollMethod = function(e) { + onScrollMethod = function() { return Em.run.scheduleOnce('afterRender', self, 'scrolled'); }; diff --git a/app/assets/javascripts/discourse/models/category.js b/app/assets/javascripts/discourse/models/category.js index fd517a64ece..fa289e3f514 100644 --- a/app/assets/javascripts/discourse/models/category.js +++ b/app/assets/javascripts/discourse/models/category.js @@ -51,7 +51,7 @@ Discourse.Category = Discourse.Model.extend({ return this.get('topic_count') > Discourse.SiteSettings.category_featured_topics; }.property('topic_count'), - save: function(args) { + save: function() { var url = "/categories"; if (this.get('id')) { url = "/categories/" + (this.get('id')); @@ -81,7 +81,7 @@ Discourse.Category = Discourse.Model.extend({ return rval; }.property("permissions"), - destroy: function(callback) { + destroy: function() { return Discourse.ajax("/categories/" + (this.get('slug') || this.get('id')), { type: 'DELETE' }); }, diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js index e660ebf8bb3..b5f002501e2 100644 --- a/app/assets/javascripts/discourse/models/composer.js +++ b/app/assets/javascripts/discourse/models/composer.js @@ -420,7 +420,7 @@ Discourse.Composer = Discourse.Model.extend({ this.set('composeState', CLOSED); return Ember.Deferred.promise(function(promise) { - post.save(function(savedPost) { + post.save(function() { composer.clearState(); }, function(error) { var response = $.parseJSON(error.responseText); @@ -486,8 +486,7 @@ Discourse.Composer = Discourse.Model.extend({ composer.set('composeState', SAVING); createdPost.save(function(result) { - var addedPost = false, - saving = true; + var saving = true; createdPost.updateFromJson(result); diff --git a/app/assets/javascripts/discourse/models/post.js b/app/assets/javascripts/discourse/models/post.js index 521b076f850..948b088f610 100644 --- a/app/assets/javascripts/discourse/models/post.js +++ b/app/assets/javascripts/discourse/models/post.js @@ -91,8 +91,7 @@ Discourse.Post = Discourse.Model.extend({ }.property('read', 'topic.last_read_post_number', 'bookmarked'), bookmarkedChanged: function() { - var post = this; - Discourse.ajax("/posts/" + (this.get('id')) + "/bookmark", { + Discourse.ajax("/posts/" + this.get('id') + "/bookmark", { type: 'PUT', data: { bookmarked: this.get('bookmarked') ? true : false diff --git a/app/assets/javascripts/discourse/models/post_stream.js b/app/assets/javascripts/discourse/models/post_stream.js index 1d5fd5fb5fa..b7fcc5cbd1e 100644 --- a/app/assets/javascripts/discourse/models/post_stream.js +++ b/app/assets/javascripts/discourse/models/post_stream.js @@ -306,9 +306,7 @@ Discourse.PostStream = Em.Object.extend({ fillGapAfter: function(post, gap) { var postId = post.get('id'), stream = this.get('stream'), - idx = stream.indexOf(postId), - currentPosts = this.get('posts'), - self = this; + idx = stream.indexOf(postId); if (idx !== -1) { stream.pushObjects(gap); @@ -674,8 +672,7 @@ Discourse.PostStream = Em.Object.extend({ var url = "/t/" + this.get('topic.id') + "/posts.json", data = { post_ids: postIds }, - postStream = this, - result = Em.A(); + postStream = this; return Discourse.ajax(url, {data: data}).then(function(result) { var posts = Em.get(result, "post_stream.posts"); diff --git a/app/assets/javascripts/discourse/models/topic.js b/app/assets/javascripts/discourse/models/topic.js index c34bfaee2a0..75994b92575 100644 --- a/app/assets/javascripts/discourse/models/topic.js +++ b/app/assets/javascripts/discourse/models/topic.js @@ -24,7 +24,7 @@ Discourse.Topic = Discourse.Model.extend({ return a !== 'regular' && a !== 'private_message'; }.property('archetype'), - convertArchetype: function(archetype) { + convertArchetype: function() { var a = this.get('archetype'); if (a !== 'regular' && a !== 'private_message') { this.set('archetype', 'regular'); @@ -233,7 +233,7 @@ Discourse.Topic = Discourse.Model.extend({ }, // Recover this topic if deleted - recover: function(deleted_by) { + recover: function() { this.setProperties({ deleted_at: null, deleted_by: null, @@ -326,14 +326,13 @@ Discourse.Topic.reopenClass({ // Load a topic, but accepts a set of filters find: function(topicId, opts) { - var data, promise, url; - url = Discourse.getURL("/t/") + topicId; + var url = Discourse.getURL("/t/") + topicId; if (opts.nearPost) { url += "/" + opts.nearPost; } - data = {}; + var data = {}; if (opts.postsAfter) { data.posts_after = opts.postsAfter; } diff --git a/app/assets/javascripts/discourse/models/topic_details.js b/app/assets/javascripts/discourse/models/topic_details.js index ac4356e4ab5..fe915dcd551 100644 --- a/app/assets/javascripts/discourse/models/topic_details.js +++ b/app/assets/javascripts/discourse/models/topic_details.js @@ -66,7 +66,7 @@ Discourse.TopicDetails = Discourse.Model.extend({ Discourse.ajax("/t/" + this.get('topic.id') + "/remove-allowed-user", { type: 'PUT', data: { username: username } - }).then(function(res) { + }).then(function() { users.removeObject(users.findProperty('username', username)); }); } diff --git a/app/assets/javascripts/discourse/models/topic_list.js b/app/assets/javascripts/discourse/models/topic_list.js index 71aa5b7831c..9c762f2640d 100644 --- a/app/assets/javascripts/discourse/models/topic_list.js +++ b/app/assets/javascripts/discourse/models/topic_list.js @@ -169,8 +169,7 @@ Discourse.TopicList.reopenClass({ topicsFrom: function(result) { // Stitch together our side loaded data var categories = Discourse.Category.list(), - users = this.extractByKey(result.users, Discourse.User), - topics = Em.A(); + users = this.extractByKey(result.users, Discourse.User); return result.topic_list.topics.map(function (t) { t.category = categories.findBy('id', t.category_id); diff --git a/app/assets/javascripts/discourse/routes/discourse_location.js b/app/assets/javascripts/discourse/routes/discourse_location.js index b4e9042ad47..43c86ae73b4 100644 --- a/app/assets/javascripts/discourse/routes/discourse_location.js +++ b/app/assets/javascripts/discourse/routes/discourse_location.js @@ -216,7 +216,7 @@ Ember.DiscourseLocation = Ember.Object.extend({ var guid = Ember.guidFor(this), self = this; - Ember.$(window).on('popstate.ember-location-'+guid, function(e) { + Ember.$(window).on('popstate.ember-location-'+guid, function() { // Ignore initial page load popstate event in Chrome if (!popstateFired) { popstateFired = true; diff --git a/app/assets/javascripts/discourse/routes/discourse_route.js b/app/assets/javascripts/discourse/routes/discourse_route.js index 18dd83bd798..4f3be7f703d 100644 --- a/app/assets/javascripts/discourse/routes/discourse_route.js +++ b/app/assets/javascripts/discourse/routes/discourse_route.js @@ -16,7 +16,7 @@ Discourse.Route = Em.Route.extend({ @method activate **/ - activate: function(router, context) { + activate: function() { this._super(); // Close mini profiler diff --git a/app/assets/javascripts/discourse/routes/user_topic_list_routes.js b/app/assets/javascripts/discourse/routes/user_topic_list_routes.js index 99830a2a5e6..c89e1a444fd 100644 --- a/app/assets/javascripts/discourse/routes/user_topic_list_routes.js +++ b/app/assets/javascripts/discourse/routes/user_topic_list_routes.js @@ -10,7 +10,7 @@ Discourse.UserTopicListRoute = Discourse.Route.extend({ } }); -function createPMRoute(viewName, path, type) { +function createPMRoute(viewName, path) { return Discourse.UserTopicListRoute.extend({ userActionType: Discourse.UserAction.TYPES.messages_received, @@ -18,7 +18,7 @@ function createPMRoute(viewName, path, type) { return Discourse.TopicList.find('topics/' + path + '/' + this.modelFor('user').get('username_lower')); }, - setupController: function(controller, model) { + setupController: function() { this._super.apply(this, arguments); this.controllerFor('user').setProperties({ pmView: viewName, diff --git a/app/assets/javascripts/discourse/views/buttons/clear_pin_button.js b/app/assets/javascripts/discourse/views/buttons/clear_pin_button.js index 1b82a871ce0..8f26c569ee7 100644 --- a/app/assets/javascripts/discourse/views/buttons/clear_pin_button.js +++ b/app/assets/javascripts/discourse/views/buttons/clear_pin_button.js @@ -18,7 +18,7 @@ Discourse.ClearPinButton = Discourse.ButtonView.extend({ return this.get('controller.pinned') ? null : 'hidden'; }.property('controller.pinned'), - click: function(buffer) { + click: function() { this.get('controller').send('clearPin'); }, diff --git a/app/assets/javascripts/discourse/views/buttons/dropdown_button_view.js b/app/assets/javascripts/discourse/views/buttons/dropdown_button_view.js index ce0b918b776..0aa875663c6 100644 --- a/app/assets/javascripts/discourse/views/buttons/dropdown_button_view.js +++ b/app/assets/javascripts/discourse/views/buttons/dropdown_button_view.js @@ -10,7 +10,7 @@ Discourse.DropdownButtonView = Discourse.View.extend({ classNameBindings: [':btn-group', 'hidden'], shouldRerender: Discourse.View.renderIfChanged('text', 'longDescription'), - didInsertElement: function(e) { + didInsertElement: function() { // If there's a click handler, call it if (this.clicked) { var dropDownButtonView = this; @@ -22,7 +22,7 @@ Discourse.DropdownButtonView = Discourse.View.extend({ } }, - willDestroyElement: function(e) { + willDestroyElement: function() { this.$('ul li').off('click.dropdown-button'); }, diff --git a/app/assets/javascripts/discourse/views/composer/composer_view.js b/app/assets/javascripts/discourse/views/composer/composer_view.js index d3ed47ae4b6..8fe9829cd46 100644 --- a/app/assets/javascripts/discourse/views/composer/composer_view.js +++ b/app/assets/javascripts/discourse/views/composer/composer_view.js @@ -88,7 +88,7 @@ Discourse.ComposerView = Discourse.View.extend(Ember.Evented, { }); }.observes('model.composeState'), - keyUp: function(e) { + keyUp: function() { var controller = this.get('controller'); controller.checkReplyLength(); @@ -337,7 +337,7 @@ Discourse.ComposerView = Discourse.View.extend(Ember.Evented, { return result; }, - childDidInsertElement: function(e) { + childDidInsertElement: function() { return this.initEditor(); }, diff --git a/app/assets/javascripts/discourse/views/list/list_topics_view.js b/app/assets/javascripts/discourse/views/list/list_topics_view.js index 74602e49d94..a0ab85d94a1 100644 --- a/app/assets/javascripts/discourse/views/list/list_topics_view.js +++ b/app/assets/javascripts/discourse/views/list/list_topics_view.js @@ -55,7 +55,7 @@ Discourse.ListTopicsView = Discourse.View.extend(Discourse.LoadMore, { }, // When the topic list is scrolled - scrolled: function(e) { + scrolled: function() { this._super(); this.saveScrollPosition(); } diff --git a/app/assets/javascripts/discourse/views/modal/avatar_selector_view.js b/app/assets/javascripts/discourse/views/modal/avatar_selector_view.js index 9cf871ce1cc..54f8e8eb3a9 100644 --- a/app/assets/javascripts/discourse/views/modal/avatar_selector_view.js +++ b/app/assets/javascripts/discourse/views/modal/avatar_selector_view.js @@ -39,7 +39,7 @@ Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({ }); // when a file has been selected - $upload.on("fileuploadadd", function (e, data) { + $upload.on("fileuploadadd", function () { self.setProperties({ uploading: true, imageIsNotASquare: false @@ -81,7 +81,7 @@ Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({ }); // when the upload is done - $upload.on("fileuploadalways", function (e, data) { + $upload.on("fileuploadalways", function () { self.setProperties({ uploading: false, uploadProgress: 0 }); }); }, diff --git a/app/assets/javascripts/discourse/views/modal/create_account_view.js b/app/assets/javascripts/discourse/views/modal/create_account_view.js index f7bedc879fb..7946c461382 100644 --- a/app/assets/javascripts/discourse/views/modal/create_account_view.js +++ b/app/assets/javascripts/discourse/views/modal/create_account_view.js @@ -11,7 +11,7 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({ title: I18n.t('create_account.title'), classNames: ['create-account'], - didInsertElement: function(e) { + didInsertElement: function() { this._super(); diff --git a/app/assets/javascripts/discourse/views/modal/hide_modal_view.js b/app/assets/javascripts/discourse/views/modal/hide_modal_view.js index 172751b24a4..f6a54a82b7d 100644 --- a/app/assets/javascripts/discourse/views/modal/hide_modal_view.js +++ b/app/assets/javascripts/discourse/views/modal/hide_modal_view.js @@ -9,7 +9,7 @@ Discourse.HideModalView = Discourse.ModalBodyView.extend({ // No rendering! - render: function(buffer) { }, + render: function() { }, didInsertElement: function() { $('#discourse-modal').modal('hide'); diff --git a/app/assets/javascripts/discourse/views/modal/login_view.js b/app/assets/javascripts/discourse/views/modal/login_view.js index 058fda0ab6d..cf2bbb652d1 100644 --- a/app/assets/javascripts/discourse/views/modal/login_view.js +++ b/app/assets/javascripts/discourse/views/modal/login_view.js @@ -41,7 +41,7 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({ }); }, - didInsertElement: function(e) { + didInsertElement: function() { this._super(); diff --git a/app/assets/javascripts/discourse/views/popup_input_tip_view.js b/app/assets/javascripts/discourse/views/popup_input_tip_view.js index c17467a9383..551d1cb97f6 100644 --- a/app/assets/javascripts/discourse/views/popup_input_tip_view.js +++ b/app/assets/javascripts/discourse/views/popup_input_tip_view.js @@ -17,7 +17,7 @@ Discourse.PopupInputTipView = Discourse.View.extend({ bouncePixels: 6, bounceDelay: 100, - click: function(e) { + click: function() { this.set('shownAt', false); }, diff --git a/app/assets/javascripts/discourse/views/quote_button_view.js b/app/assets/javascripts/discourse/views/quote_button_view.js index aa70ffdc981..ab13c1c249c 100644 --- a/app/assets/javascripts/discourse/views/quote_button_view.js +++ b/app/assets/javascripts/discourse/views/quote_button_view.js @@ -56,10 +56,10 @@ Discourse.QuoteButtonView = Discourse.View.extend({ view.selectText(e.target, controller); view.set('isMouseDown', false); }) - .on('touchstart.quote-button', function(e){ + .on('touchstart.quote-button', function(){ view.set('isTouchInProgress', true); }) - .on('touchend.quote-button', function(e){ + .on('touchend.quote-button', function(){ view.set('isTouchInProgress', false); }) .on('selectionchange', function() { diff --git a/app/assets/javascripts/discourse/views/topic_view.js b/app/assets/javascripts/discourse/views/topic_view.js index feffb23c081..3f173019b24 100644 --- a/app/assets/javascripts/discourse/views/topic_view.js +++ b/app/assets/javascripts/discourse/views/topic_view.js @@ -71,7 +71,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { } }.observes('controller.enteredAt'), - didInsertElement: function(e) { + didInsertElement: function() { this.bindScrolling({name: 'topic-view'}); var topicView = this; diff --git a/app/assets/javascripts/pagedown_custom.js b/app/assets/javascripts/pagedown_custom.js index eff6c090cf5..9c862739e99 100644 --- a/app/assets/javascripts/pagedown_custom.js +++ b/app/assets/javascripts/pagedown_custom.js @@ -1,5 +1,3 @@ -/*global Markdown:true*/ - window.PagedownCustom = { insertButtons: [ { diff --git a/config/jshint.yml b/config/jshint.yml index 2b9bda7ac25..a54a2ab30a3 100644 --- a/config/jshint.yml +++ b/config/jshint.yml @@ -34,6 +34,7 @@ regexp: false # true if . and [^...] should not be allowed in RegExp liter safe: false # true if the safe subset rules are enforced (used by ADsafe) strict: false # true if the ES5 "use strict"; pragma is required undef: true # true if variables must be declared before used +unused: true white: false # true if strict whitespace rules apply (see also 'indent' option) eqnull: false onecase: true # allow for one case switches, can be more elegant sometimes diff --git a/test/javascripts/controllers/topic_controller_test.js b/test/javascripts/controllers/topic_controller_test.js index 81370496cd4..c99a84dc3f6 100644 --- a/test/javascripts/controllers/topic_controller_test.js +++ b/test/javascripts/controllers/topic_controller_test.js @@ -92,8 +92,7 @@ test("Select Replies when present", function() { tc = testController(Discourse.TopicController, topic), p1 = Discourse.Post.create({id: 1, post_number: 1, reply_count: 1}), p2 = Discourse.Post.create({id: 2, post_number: 2}), - p3 = Discourse.Post.create({id: 2, post_number: 3, reply_to_post_number: 1}), - postStream = tc.get('postStream'); + p3 = Discourse.Post.create({id: 2, post_number: 3, reply_to_post_number: 1}); ok(!tc.postSelected(p3), "replies are not selected by default"); tc.send('toggledSelectedPostReplies', p1); diff --git a/test/javascripts/jshint_all.js.erb b/test/javascripts/jshint_all.js.erb index 153a71649d9..8ac790cd647 100644 --- a/test/javascripts/jshint_all.js.erb +++ b/test/javascripts/jshint_all.js.erb @@ -150,6 +150,7 @@ var jsHintOpts = { "plusplus": false, "regexp": false, "undef": true, + "unused": true, "sub": true, "strict": false, "white": false, diff --git a/test/javascripts/lib/bbcode_test.js b/test/javascripts/lib/bbcode_test.js index 91bce2ac0d9..88160015477 100644 --- a/test/javascripts/lib/bbcode_test.js +++ b/test/javascripts/lib/bbcode_test.js @@ -1,4 +1,3 @@ -/*global md5:true */ module("Discourse.BBCode"); var format = function(input, expected, text) { diff --git a/test/javascripts/lib/formatter_test.js b/test/javascripts/lib/formatter_test.js index 2c65e4f41d1..531ea2280e6 100644 --- a/test/javascripts/lib/formatter_test.js +++ b/test/javascripts/lib/formatter_test.js @@ -28,10 +28,6 @@ var formatDays = function(days) { return formatHours(days * 24); }; -var formatMonths = function(months) { - return formatDays(months * 30); -}; - var shortDate = function(days){ return moment().subtract('days', days).format('D MMM'); }; diff --git a/test/javascripts/lib/html_test.js b/test/javascripts/lib/html_test.js index cc683407329..c0d2879d77b 100644 --- a/test/javascripts/lib/html_test.js +++ b/test/javascripts/lib/html_test.js @@ -1,7 +1,5 @@ module("Discourse.HTML"); -var html = Discourse.HTML; - test("categoryLink without a category", function() { blank(Discourse.HTML.categoryLink(), "it returns no HTML"); }); diff --git a/test/javascripts/lib/markdown_test.js b/test/javascripts/lib/markdown_test.js index 56348270a8a..4fb041e0e65 100644 --- a/test/javascripts/lib/markdown_test.js +++ b/test/javascripts/lib/markdown_test.js @@ -1,5 +1,3 @@ -/*global sanitizeHtml:true */ - module("Discourse.Markdown", { setup: function() { Discourse.SiteSettings.traditional_markdown_linebreaks = false; @@ -173,7 +171,7 @@ test("Quotes", function() { "handles quotes properly"); cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2", - { topicId: 2, lookupAvatar: function(name) { } }, + { topicId: 2, lookupAvatar: function() { } }, "

1

\n\n

\n\n

2

", "includes no avatar if none is found"); diff --git a/test/javascripts/mixins/selected_posts_count_test.js b/test/javascripts/mixins/selected_posts_count_test.js index e448cff2427..d8ecc084e4a 100644 --- a/test/javascripts/mixins/selected_posts_count_test.js +++ b/test/javascripts/mixins/selected_posts_count_test.js @@ -1,6 +1,6 @@ module("Discourse.SelectedPostsCount"); -var buildTestObj = function(params, topicParams) { +var buildTestObj = function(params) { return Ember.Object.createWithMixins(Discourse.SelectedPostsCount, params || {}); }; diff --git a/test/javascripts/models/composer_test.js b/test/javascripts/models/composer_test.js index 292ace4ab98..56ada6026b6 100644 --- a/test/javascripts/models/composer_test.js +++ b/test/javascripts/models/composer_test.js @@ -1,7 +1,7 @@ module("Discourse.Composer"); test('replyLength', function() { - var replyLength = function(val, expectedLength, text) { + var replyLength = function(val, expectedLength) { var composer = Discourse.Composer.create({ reply: val }); equal(composer.get('replyLength'), expectedLength); }; diff --git a/test/javascripts/models/post_stream_test.js b/test/javascripts/models/post_stream_test.js index f6b1221d292..4fd3346f1df 100644 --- a/test/javascripts/models/post_stream_test.js +++ b/test/javascripts/models/post_stream_test.js @@ -227,7 +227,7 @@ test("storePost", function() { test("identity map", function() { var postStream = buildStream(1234); var p1 = postStream.appendPost(Discourse.Post.create({id: 1, post_number: 1})); - var p3 = postStream.appendPost(Discourse.Post.create({id: 3, post_number: 4})); + postStream.appendPost(Discourse.Post.create({id: 3, post_number: 4})); equal(postStream.findLoadedPost(1), p1, "it can return cached posts by id"); blank(postStream.findLoadedPost(4), "it can't find uncached posts"); @@ -403,7 +403,7 @@ test("comitting and triggerNewPostInStream race condition", function() { var user = Discourse.User.create({username: 'eviltrout', name: 'eviltrout', id: 321}); var stagedPost = Discourse.Post.create({ raw: 'hello world this is my new post' }); - var result = postStream.stagePost(stagedPost, user); + postStream.stagePost(stagedPost, user); equal(postStream.get('filteredPostsCount'), 0, "it has no filteredPostsCount yet"); stagedPost.set('id', 123);