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-unused-vars": 2,
"no-with": 2,
"semi": [
0,
"never"
],
"semi": 2,
"strict": 0,
"valid-typeof": 2,
"wrap-iife": [

View file

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

View file

@ -56,8 +56,8 @@ export default Ember.Controller.extend({
saveAll: function(){
var self = this;
var items = this.get('workingCopy');
var groupIds = items.map(function(i){return i.get("id") || -1});
var names = items.map(function(i){return i.get("name")});
var groupIds = items.map(function(i){return i.get("id") || -1;});
var names = items.map(function(i){return i.get("name");});
Discourse.ajax('/admin/badges/badge_groupings',{
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('Formatter', function() { return require('discourse/lib/formatter') });
proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default });
proxyDep('URL', function() { return require('discourse/lib/url').default });
proxyDep('Quote', function() { return require('discourse/lib/quote').default });
proxyDep('debounce', function() { return require('discourse/lib/debounce').default });
proxyDep('View', function() { return Ember.View }, "Use `Ember.View` instead");
proxyDep('computed', function() { return require('discourse/lib/computed'); });
proxyDep('Formatter', function() { return require('discourse/lib/formatter'); });
proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default; });
proxyDep('URL', function() { return require('discourse/lib/url').default; });
proxyDep('Quote', function() { return require('discourse/lib/quote').default; });
proxyDep('debounce', function() { return require('discourse/lib/debounce').default; });
proxyDep('View', function() { return Ember.View; }, "Use `Ember.View` instead");

View file

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

View file

@ -25,7 +25,7 @@ export default Ember.Component.extend({
}
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')
newSearchNeeded() {
this.set('noResults', false);
const term = this.get('searchService.term')
const term = this.get('searchService.term');
if (isValidSearchTerm(term)) {
this.set('loading', true);
Ember.run.debounce(this, 'searchTerm', term, this.get('typeFilter'), 400);

View file

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

View file

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

View file

@ -34,7 +34,7 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, {
showApplyAll: function() {
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;
}.property('categoriesBuffered.@each.hasBufferedChanges'),

View file

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

View file

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

View file

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

View file

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

View file

@ -99,7 +99,7 @@ Discourse.Utilities = {
div.innerHTML = html;
var $div = $(div);
// 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();
var text = div.textContent || div.innerText || "";

View file

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

View file

@ -104,7 +104,7 @@ NavItem.reopenClass({
buildList(category, args) {
args = args || {};
if (category) { args.category = category }
if (category) { args.category = category; }
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 = {
type: params.context,
id: params.context_id
}
};
}
const searchKey = getSearchKey(args);

View file

@ -61,7 +61,7 @@ export default Discourse.Route.extend({
setupController(controller, user) {
controller.set('model', user);
this.searchService.set('searchContext', user.get('searchContext'))
this.searchService.set('searchContext', user.get('searchContext'));
},
activate() {
@ -77,7 +77,7 @@ export default Discourse.Route.extend({
this.messageBus.unsubscribe("/users/" + this.modelFor('user').get('username_lower'));
// 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",
left: toolbarPos.left + pos.left,
top: toolbarPos.top + pos.top,
}
};
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');
});
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");
});
click('#outside-area')
click('#outside-area');
andThen(() => {
assert.ok(exists(".menu-panel.hidden"), "clicking the body hides the menu");
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");
});
click('#outside-area')
click('#outside-area');
andThen(() => {
assert.ok(exists(".menu-panel.hidden"), "clicking the body hides the menu");
assert.equal(this.get('panelVisible'), false, 'it updates the bound variable');