eslint: change keyword-spacing from warning to error and fix violations.

This commit is contained in:
Tommy Ip 2016-12-01 19:02:56 +00:00 committed by Tim Abbott
parent aab5ca620e
commit c90da24541
8 changed files with 21 additions and 13 deletions

View File

@ -164,7 +164,15 @@
"quote-props": 0,
"radix": 2,
"semi": 2,
"keyword-spacing": 1,
"keyword-spacing": ["error", {
"before": true,
"after": true,
"overrides": {
"return": { "after": true },
"throw": { "after": true },
"case": { "after": true }
}
}],
"space-before-blocks": 1,
"strict": 1,
"unnecessary-strict": 0,

View File

@ -20,7 +20,7 @@ var page_params = {
set_global('page_params', page_params);
var patched_underscore = _.clone(_);
patched_underscore.debounce = function (f) { return(f); };
patched_underscore.debounce = function (f) { return f; };
global.patch_builtin('_', patched_underscore);

View File

@ -188,19 +188,19 @@ var _ = global._;
'some_email@**everyone**.com'
];
var i;
for(i=0; i<messages_with_all_mentions.length; i++) {
for (i=0; i<messages_with_all_mentions.length; i++) {
assert(util.is_all_or_everyone_mentioned(messages_with_all_mentions[i]));
}
for(i=0; i<messages_with_everyone_mentions.length; i++) {
for (i=0; i<messages_with_everyone_mentions.length; i++) {
assert(util.is_all_or_everyone_mentioned(messages_with_everyone_mentions[i]));
}
for(i=0; i<messages_without_all_mentions.length; i++) {
for (i=0; i<messages_without_all_mentions.length; i++) {
assert(!util.is_all_or_everyone_mentioned(messages_without_everyone_mentions[i]));
}
for(i=0; i<messages_without_everyone_mentions.length; i++) {
for (i=0; i<messages_without_everyone_mentions.length; i++) {
assert(!util.is_all_or_everyone_mentioned(messages_without_everyone_mentions[i]));
}
}());

View File

@ -9,7 +9,7 @@ function mkdir_p(path) {
// This works like mkdir -p in Unix.
try {
fs.mkdirSync(path);
} catch(e) {
} catch (e) {
if ( e.code !== 'EEXIST' ) {
throw e;
}

View File

@ -802,7 +802,7 @@ function validate_stream_message() {
var response;
if (!stream_data.is_subscribed(stream_name)) {
switch(check_stream_for_send(stream_name, page_params.narrow_stream !== undefined)) {
switch (check_stream_for_send(stream_name, page_params.narrow_stream !== undefined)) {
case "does-not-exist":
response = "<p>The stream <b>" +
Handlebars.Utils.escapeExpression(stream_name) + "</b> does not exist.</p>" +
@ -1088,7 +1088,7 @@ $(function () {
$("#send-status").addClass("alert-error")
.removeClass("alert-info");
$("#compose-send-button").removeAttr("disabled");
switch(err) {
switch (err) {
case 'BrowserNotSupported':
msg = "File upload is not yet available for your browser.";
break;

View File

@ -261,7 +261,7 @@ exports.MessageList.prototype = {
do {
potential_closest_matches.push(closest);
closest--;
} while(closest > 0 && this._is_localonly_id(items[closest - 1].id));
} while (closest > 0 && this._is_localonly_id(items[closest - 1].id));
}
potential_closest_matches.push(closest);
@ -550,7 +550,7 @@ exports.MessageList.prototype = {
var cur_idx = start_index;
do {
cur_idx = op(cur_idx);
} while(item_list[cur_idx] !== undefined && this._is_localonly_id(item_list[cur_idx].id));
} while (item_list[cur_idx] !== undefined && this._is_localonly_id(item_list[cur_idx].id));
return item_list[cur_idx];
},

View File

@ -182,7 +182,7 @@ function dispatch_normal_event(event) {
case 'update_message_flags':
var new_value = event.operation === "add";
switch(event.flag) {
switch (event.flag) {
case 'starred':
_.each(event.messages, function (message_id) {
ui.update_starred(message_id, new_value);

View File

@ -558,7 +558,7 @@ exports.update_subscription_properties = function (stream_name, property, value)
value: value});
return;
}
switch(property) {
switch (property) {
case 'color':
stream_color.update_stream_color(sub, stream_name, value, {update_historical: true});
break;