Add semi colon linting to Javascript

This commit is contained in:
Robin Ward 2015-09-15 17:08:50 -04:00
parent 24991c4016
commit 975edceff4
24 changed files with 37 additions and 40 deletions

View file

@ -90,10 +90,7 @@
"no-undef": 2, "no-undef": 2,
"no-unused-vars": 2, "no-unused-vars": 2,
"no-with": 2, "no-with": 2,
"semi": [ "semi": 2,
0,
"never"
],
"strict": 0, "strict": 0,
"valid-typeof": 2, "valid-typeof": 2,
"wrap-iife": [ "wrap-iife": [

View file

@ -13,7 +13,7 @@ export default Ember.Controller.extend({
}.property('problems'), }.property('problems'),
thereWereProblems: function() { thereWereProblems: function() {
if(!Discourse.User.currentProp('admin')) { return false } if(!Discourse.User.currentProp('admin')) { return false; }
if( this.get('foundProblems') ) { if( this.get('foundProblems') ) {
this.set('hadProblems', true); this.set('hadProblems', true);
return true; return true;

View file

@ -56,8 +56,8 @@ export default Ember.Controller.extend({
saveAll: function(){ saveAll: function(){
var self = this; var self = this;
var items = this.get('workingCopy'); var items = this.get('workingCopy');
var groupIds = items.map(function(i){return i.get("id") || -1}); var groupIds = items.map(function(i){return i.get("id") || -1;});
var names = items.map(function(i){return i.get("name")}); var names = items.map(function(i){return i.get("name");});
Discourse.ajax('/admin/badges/badge_groupings',{ Discourse.ajax('/admin/badges/badge_groupings',{
data: {ids: groupIds, names: names}, data: {ids: groupIds, names: names},

View file

@ -152,10 +152,10 @@ function proxyDep(propName, moduleFunc, msg) {
}); });
} }
proxyDep('computed', function() { return require('discourse/lib/computed') }); proxyDep('computed', function() { return require('discourse/lib/computed'); });
proxyDep('Formatter', function() { return require('discourse/lib/formatter') }); proxyDep('Formatter', function() { return require('discourse/lib/formatter'); });
proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default }); proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default; });
proxyDep('URL', function() { return require('discourse/lib/url').default }); proxyDep('URL', function() { return require('discourse/lib/url').default; });
proxyDep('Quote', function() { return require('discourse/lib/quote').default }); proxyDep('Quote', function() { return require('discourse/lib/quote').default; });
proxyDep('debounce', function() { return require('discourse/lib/debounce').default }); proxyDep('debounce', function() { return require('discourse/lib/debounce').default; });
proxyDep('View', function() { return Ember.View }, "Use `Ember.View` instead"); proxyDep('View', function() { return Ember.View; }, "Use `Ember.View` instead");

View file

@ -47,7 +47,7 @@ export default Ember.Component.extend({
if (color) { if (color) {
var style = ""; var style = "";
if (color) { style += "background-color: #" + color + ";" } if (color) { style += "background-color: #" + color + ";"; }
return style.htmlSafe(); return style.htmlSafe();
} }
} }

View file

@ -25,7 +25,7 @@ export default Ember.Component.extend({
} }
return groups.filter(function(group){ return groups.filter(function(group){
return !selectedGroups.any(function(s){return s === group.name}); return !selectedGroups.any(function(s){return s === group.name;});
}); });
}); });
}, },

View file

@ -61,7 +61,7 @@ export default Ember.Component.extend({
@observes('searchService.term', 'typeFilter') @observes('searchService.term', 'typeFilter')
newSearchNeeded() { newSearchNeeded() {
this.set('noResults', false); this.set('noResults', false);
const term = this.get('searchService.term') const term = this.get('searchService.term');
if (isValidSearchTerm(term)) { if (isValidSearchTerm(term)) {
this.set('loading', true); this.set('loading', true);
Ember.run.debounce(this, 'searchTerm', term, this.get('typeFilter'), 400); Ember.run.debounce(this, 'searchTerm', term, this.get('typeFilter'), 400);

View file

@ -11,4 +11,4 @@ export default Ember.Component.extend({
list.removeObject(id); list.removeObject(id);
} }
}.observes('selected') }.observes('selected')
}) });

View file

@ -24,7 +24,7 @@ export default Ember.Controller.extend({
return (!skip && context) || skip === "false"; return (!skip && context) || skip === "false";
}, },
set(val) { set(val) {
this.set('skip_context', val ? "false" : "true" ) this.set('skip_context', val ? "false" : "true" );
} }
}, },
@ -100,7 +100,7 @@ export default Ember.Controller.extend({
const model = translateResults(results) || {}; const model = translateResults(results) || {};
router.transientCache('lastSearch', { searchKey, model }, 5); router.transientCache('lastSearch', { searchKey, model }, 5);
this.set("model", model); this.set("model", model);
}).finally(() => {this._searching = false}); }).finally(() => this._searching = false);
}, },
actions: { actions: {
@ -116,7 +116,7 @@ export default Ember.Controller.extend({
}, },
clearAll() { clearAll() {
this.get('selected').clear() this.get('selected').clear();
$('.fps-result input[type=checkbox]').prop('checked', false); $('.fps-result input[type=checkbox]').prop('checked', false);
}, },

View file

@ -34,7 +34,7 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, {
showApplyAll: function() { showApplyAll: function() {
let anyChanged = false; let anyChanged = false;
this.get('categoriesBuffered').forEach(bc => { anyChanged = anyChanged || bc.get('hasBufferedChanges') }); this.get('categoriesBuffered').forEach(bc => { anyChanged = anyChanged || bc.get('hasBufferedChanges'); });
return anyChanged; return anyChanged;
}.property('categoriesBuffered.@each.hasBufferedChanges'), }.property('categoriesBuffered.@each.hasBufferedChanges'),

View file

@ -22,4 +22,4 @@ Discourse.CensoredWords = {
} }
return text; return text;
} }
} };

View file

@ -14,7 +14,7 @@ try {
const KeyValueStore = function(ctx) { const KeyValueStore = function(ctx) {
this.context = ctx; this.context = ctx;
} };
KeyValueStore.prototype = { KeyValueStore.prototype = {
abandonLocal() { abandonLocal() {

View file

@ -30,7 +30,7 @@ const ScreenTrack = Ember.Object.extend({
self.tick(); self.tick();
}, 1000)); }, 1000));
$(window).on('scroll.screentrack', function(){self.scrolled()}); $(window).on('scroll.screentrack', function(){self.scrolled();});
} }
this.set('topicId', topicId); this.set('topicId', topicId);

View file

@ -103,7 +103,7 @@ const searchContextDescription = function(type, name){
const getSearchKey = function(args){ const getSearchKey = function(args){
return args.q + "|" + ((args.searchContext && args.searchContext.type) || "") + "|" + return args.q + "|" + ((args.searchContext && args.searchContext.type) || "") + "|" +
((args.searchContext && args.searchContext.id) || "") ((args.searchContext && args.searchContext.id) || "");
}; };
const isValidSearchTerm = function(searchTerm) { const isValidSearchTerm = function(searchTerm) {

View file

@ -99,7 +99,7 @@ Discourse.Utilities = {
div.innerHTML = html; div.innerHTML = html;
var $div = $(div); var $div = $(div);
// Find all emojis and replace with its title attribute. // Find all emojis and replace with its title attribute.
$div.find('img.emoji').replaceWith(function() { return this.title }); $div.find('img.emoji').replaceWith(function() { return this.title; });
$('.clicks', $div).remove(); $('.clicks', $div).remove();
var text = div.textContent || div.innerText || ""; var text = div.textContent || div.innerText || "";

View file

@ -10,7 +10,7 @@ export default {
findStale(store, type, findArgs, opts) { findStale(store, type, findArgs, opts) {
const staleResult = new StaleResult(); const staleResult = new StaleResult();
const key = (opts && opts.storageKey) || this.storageKey(type, findArgs) const key = (opts && opts.storageKey) || this.storageKey(type, findArgs);
try { try {
const stored = this.keyValueStore.getItem(key); const stored = this.keyValueStore.getItem(key);
if (stored) { if (stored) {
@ -24,11 +24,11 @@ export default {
}, },
find(store, type, findArgs, opts) { find(store, type, findArgs, opts) {
const key = (opts && opts.storageKey) || this.storageKey(type, findArgs) const key = (opts && opts.storageKey) || this.storageKey(type, findArgs);
return this._super(store, type, findArgs).then((results) => { return this._super(store, type, findArgs).then((results) => {
this.keyValueStore.setItem(key, JSON.stringify(results)); this.keyValueStore.setItem(key, JSON.stringify(results));
return results; return results;
}); });
} }
} };

View file

@ -104,7 +104,7 @@ NavItem.reopenClass({
buildList(category, args) { buildList(category, args) {
args = args || {}; args = args || {};
if (category) { args.category = category } if (category) { args.category = category; }
let items = Discourse.SiteSettings.top_menu.split("|"); let items = Discourse.SiteSettings.top_menu.split("|");

View file

@ -103,4 +103,4 @@ export default (filter, params) => {
} }
} }
}); });
} };

View file

@ -11,7 +11,7 @@ export default Discourse.Route.extend({
args.search_context = { args.search_context = {
type: params.context, type: params.context,
id: params.context_id id: params.context_id
} };
} }
const searchKey = getSearchKey(args); const searchKey = getSearchKey(args);

View file

@ -61,7 +61,7 @@ export default Discourse.Route.extend({
setupController(controller, user) { setupController(controller, user) {
controller.set('model', user); controller.set('model', user);
this.searchService.set('searchContext', user.get('searchContext')) this.searchService.set('searchContext', user.get('searchContext'));
}, },
activate() { activate() {
@ -77,7 +77,7 @@ export default Discourse.Route.extend({
this.messageBus.unsubscribe("/users/" + this.modelFor('user').get('username_lower')); this.messageBus.unsubscribe("/users/" + this.modelFor('user').get('username_lower'));
// Remove the search context // Remove the search context
this.searchService.set('searchContext', null) this.searchService.set('searchContext', null);
} }
}); });

View file

@ -272,7 +272,7 @@ const ComposerView = Ember.View.extend(Ember.Evented, {
position: "absolute", position: "absolute",
left: toolbarPos.left + pos.left, left: toolbarPos.left + pos.left,
top: toolbarPos.top + pos.top, top: toolbarPos.top + pos.top,
} };
controller.send('showOptions', location); controller.send('showOptions', location);
} }
}]; }];

View file

@ -1 +1 @@
export default Ember.View.extend({}); export default Ember.View.extend();

View file

@ -56,6 +56,6 @@ componentTest('with an action', {
assert.ok(true, 'it fired the action'); assert.ok(true, 'it fired the action');
}); });
click('a') click('a');
} }
}); });

View file

@ -24,7 +24,7 @@ componentTest('as a dropdown', {
assert.ok(!exists(".menu-panel.hidden"), "toggling visible makes it appear"); assert.ok(!exists(".menu-panel.hidden"), "toggling visible makes it appear");
}); });
click('#outside-area') click('#outside-area');
andThen(() => { andThen(() => {
assert.ok(exists(".menu-panel.hidden"), "clicking the body hides the menu"); assert.ok(exists(".menu-panel.hidden"), "clicking the body hides the menu");
assert.equal(this.get('panelVisible'), false, 'it updates the bound variable'); assert.equal(this.get('panelVisible'), false, 'it updates the bound variable');
@ -54,7 +54,7 @@ componentTest('as a slide-in', {
assert.ok(!exists(".menu-panel.hidden"), "toggling visible makes it appear"); assert.ok(!exists(".menu-panel.hidden"), "toggling visible makes it appear");
}); });
click('#outside-area') click('#outside-area');
andThen(() => { andThen(() => {
assert.ok(exists(".menu-panel.hidden"), "clicking the body hides the menu"); assert.ok(exists(".menu-panel.hidden"), "clicking the body hides the menu");
assert.equal(this.get('panelVisible'), false, 'it updates the bound variable'); assert.equal(this.get('panelVisible'), false, 'it updates the bound variable');