lint: Ban two spaces after comma in JS code.

We exclude the frontend tests, mostly because the lint rule isn't that
precise, and the test code has some sample user input that's a bit
funny.
This commit is contained in:
Tim Abbott
2017-10-18 10:16:41 -07:00
parent 8afe9835f6
commit 2bc14d256f
8 changed files with 20 additions and 20 deletions

View File

@@ -22,7 +22,7 @@ exports.set = function (url) {
// in re-rendering the page (see #882).
$(favicon_selector).remove();
$('head').append($('<link>')
.attr('rel', 'shortcut icon')
.attr('rel', 'shortcut icon')
.attr('href', url));
}
};

View File

@@ -226,10 +226,10 @@ Filter.canonicalize_term = function (opts) {
narrow in the URL fragment. There we do use full
URI encoding to avoid problematic characters. */
function encodeOperand(operand) {
return operand.replace(/%/g, '%25')
return operand.replace(/%/g, '%25')
.replace(/\+/g, '%2B')
.replace(/ /g, '+')
.replace(/"/g, '%22');
.replace(/ /g, '+')
.replace(/"/g, '%22');
}
function decodeOperand(encoded, operator) {

View File

@@ -8,7 +8,7 @@ var exports = {};
exports.encodeHashComponent = function (str) {
return encodeURIComponent(str)
.replace(/\./g, '%2E')
.replace(/%/g, '.');
.replace(/%/g, '.');
};
exports.encode_operand = function (operator, operand) {

View File

@@ -244,7 +244,7 @@ function make_dimen_wrapper(dimen_name, dimen_func) {
}
exports.height = make_dimen_wrapper('height', $(exports.message_pane).height);
exports.width = make_dimen_wrapper('width', $(exports.message_pane).width);
exports.width = make_dimen_wrapper('width', $(exports.message_pane).width);
exports.stop_auto_scrolling = function () {
if (in_stoppable_autoscroll) {

View File

@@ -118,11 +118,11 @@ function show_user_info_popover(element, user, message) {
elt.popover({
placement: placement,
template: templates.render('user_info_popover', {class: "message-info-popover"}),
title: templates.render('user_info_popover_title',
{user_avatar: "avatar/" + user.email}),
content: templates.render('user_info_popover_content', args),
trigger: "manual",
template: templates.render('user_info_popover', {class: "message-info-popover"}),
title: templates.render('user_info_popover_title',
{user_avatar: "avatar/" + user.email}),
content: templates.render('user_info_popover_content', args),
trigger: "manual",
});
elt.popover("show");
@@ -451,10 +451,10 @@ exports.register_click_handlers = function () {
};
target.popover({
template: templates.render('user_info_popover', {class: "user_popover"}),
title: templates.render('user_info_popover_title', {user_avatar: "avatar/" + user_email}),
content: templates.render('user_info_popover_content', args),
trigger: "manual",
template: templates.render('user_info_popover', {class: "user_popover"}),
title: templates.render('user_info_popover_title', {user_avatar: "avatar/" + user_email}),
content: templates.render('user_info_popover_content', args),
trigger: "manual",
fixed: true,
placement: userlist_placement === "left" ? "right" : "left",
});

View File

@@ -396,7 +396,7 @@ function populate_messages_sent_by_client(data) {
plot_data.values.reverse();
plot_data.labels.reverse();
plot_data.percentages.reverse();
var annotations = { values : [], labels : [], text : []};
var annotations = {values: [], labels: [], text: []};
for (var i=0; i<plot_data.values.length; i+=1) {
if (plot_data.values[i] > 0) {
annotations.values.push(plot_data.values[i]);

View File

@@ -310,7 +310,7 @@ exports.set_click_handlers = function (callbacks) {
var sub = stream_data.get_sub_by_id(stream_id);
var topic = $(e.target).parents('li').attr('data-topic-name');
narrow.activate([{operator: 'stream', operand: sub.name},
narrow.activate([{operator: 'stream', operand: sub.name},
{operator: 'topic', operand: topic}],
{select_first_unread: true, trigger: 'sidebar'});

View File

@@ -146,8 +146,8 @@ def build_custom_checkers(by_lang):
'description': 'Fix tab-based whitespace'},
] # type: RuleList
comma_whitespace_rule = [
{'pattern': ', {2,}[^# ]',
'exclude': set(['zerver/tests']),
{'pattern': ', {2,}[^#/ ]',
'exclude': set(['zerver/tests', 'frontend_tests/node_tests']),
'description': "Remove multiple whitespaces after ','",
'good_lines': ['foo(1, 2, 3)', 'foo = bar # some inline comment'],
'bad_lines': ['foo(1, 2, 3)', 'foo(1, 2, 3)']},
@@ -232,7 +232,7 @@ def build_custom_checkers(by_lang):
]),
'good_lines': ['#my-style {color: blue;}'],
'bad_lines': ['<p style="color: blue;">Foo</p>', 'style = "color: blue;"']},
]) + whitespace_rules
]) + whitespace_rules + comma_whitespace_rule
python_rules = cast(RuleList, [
{'pattern': '^(?!#)@login_required',
'description': '@login_required is unsupported; use @zulip_login_required',