eslint: Update node tests to use new comma-dangle rules.

* In most cases, eslint --fix with the right comma-dangle settings was
  able to update the code correctly.

* The exceptions were cases where the parser incorrectly treated the
  arguments to functions like `assert_equal` as arguments; we fixed
  these manually.  Since this is test code, we can be reasonably
  confident that just fixing the failures suffices to correct any bugs
  introduced by making changes automatically.
This commit is contained in:
Tim Abbott
2016-12-03 14:17:57 -08:00
parent 77938f6247
commit 459421d045
24 changed files with 461 additions and 500 deletions

View File

@@ -1,13 +1,13 @@
set_global('page_params', {realm_emoji: {
burrito: {display_url: '/static/third/gemoji/images/emoji/burrito.png',
source_url: '/static/third/gemoji/images/emoji/burrito.png'}
source_url: '/static/third/gemoji/images/emoji/burrito.png'},
}});
add_dependencies({
Handlebars: 'handlebars',
templates: 'js/templates',
emoji: 'js/emoji',
i18n: 'i18next'
i18n: 'i18next',
});
var i18n = global.i18n;
@@ -16,9 +16,9 @@ i18n.init({
keySeparator: false,
interpolation: {
prefix: "__",
suffix: "__"
suffix: "__",
},
lng: 'en'
lng: 'en',
});
var jsdom = require("jsdom");
@@ -43,7 +43,7 @@ function render(template_name, args) {
'notification-settings',
'bot-settings',
'alert-word-settings',
'ui-settings'
'ui-settings',
]);
}());
@@ -78,11 +78,11 @@ function render(template_name, args) {
id: "99",
stream: "devel",
subject: "testing",
sender_full_name: "King Lear"
sender_full_name: "King Lear",
},
can_edit_message: true,
can_mute_topic: true,
narrowed: true
narrowed: true,
};
var html = '<div style="height: 250px">';
@@ -111,8 +111,8 @@ function render(template_name, args) {
emoji: {
name: "MouseFace",
display_url: "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png",
source_url: "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png"
}
source_url: "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png",
},
};
var html = '';
@@ -133,8 +133,8 @@ function render(template_name, args) {
var args = {
filter: {
pattern: "#(?P<id>[0-9]+)",
url_format_string: "https://trac.example.com/ticket/%(id)s"
}
url_format_string: "https://trac.example.com/ticket/%(id)s",
},
};
var html = '';
@@ -166,7 +166,7 @@ function render(template_name, args) {
(function admin_tab() {
var args = {
realm_name: 'Zulip'
realm_name: 'Zulip',
};
var html = render('admin_tab', args);
var admin_features = ["admin_users_table", "admin_bots_table",
@@ -187,8 +187,8 @@ function render(template_name, args) {
is_active: true,
is_active_human: true,
email: user + '@zulip.com',
full_name: user
}
full_name: user,
},
};
html += render('admin_user_list', args);
});
@@ -213,7 +213,7 @@ function render(template_name, args) {
var words = ['lunch', 'support'];
_.each(words, function (word) {
var args = {
word: word
word: word,
};
html += render('alert_word_settings_item', args);
});
@@ -230,7 +230,7 @@ function render(template_name, args) {
(function bankruptcy_modal() {
var args = {
unread_count: 99
unread_count: 99,
};
var html = render('bankruptcy_modal', args);
global.write_handlebars_output("bankruptcy_modal", html);
@@ -242,8 +242,8 @@ function render(template_name, args) {
var args = {
method: {
method: "Email",
enabled: false
}
enabled: false,
},
};
var html = '';
@@ -263,7 +263,7 @@ function render(template_name, args) {
var args = {
bookend_content: "subscribed to stream",
trailing: true,
subscribed: true
subscribed: true,
};
var html;
var all_html = '';
@@ -277,7 +277,7 @@ function render(template_name, args) {
args = {
bookend_content: "Not subscribed to stream",
trailing: true,
subscribed: false
subscribed: false,
};
html = render('bookend', args);
@@ -299,7 +299,7 @@ function render(template_name, args) {
email: "hamlet@zulip.com",
api_key: "123456ABCD",
name: "Hamlet",
avatar_url: "/hamlet/avatar/url"
avatar_url: "/hamlet/avatar/url",
};
html += render('bot_avatar_row', args);
html += '</ol>';
@@ -315,7 +315,7 @@ function render(template_name, args) {
(function compose_invite_users() {
var args = {
email: 'hamlet@zulip.com',
name: 'Hamlet'
name: 'Hamlet',
};
var html = render('compose-invite-users', args);
global.write_handlebars_output("compose-invite-users", html);
@@ -326,7 +326,7 @@ function render(template_name, args) {
(function compose_all_everyone() {
var args = {
count: '101',
name: 'all'
name: 'all',
};
var html = render('compose_all_everyone', args);
global.write_handlebars_output("compose_all_everyone", html);
@@ -341,7 +341,7 @@ function render(template_name, args) {
note: "You sent a message to a muted topic.",
link_text: "Narrow to here",
link_msg_id: "99",
link_class: "compose_notification_narrow_by_subject"
link_class: "compose_notification_narrow_by_subject",
};
var html = '<div id="out-of-view-notification" class="notification-alert">';
html += render('compose_notification', args);
@@ -360,7 +360,7 @@ function render(template_name, args) {
(function emoji_popover_content() {
var args = {
emoji_list: global.emoji.emojis_name_to_css_class
emoji_list: global.emoji.emojis_name_to_css_class,
};
var html = '<div style="height: 250px">';
@@ -379,9 +379,9 @@ function render(template_name, args) {
fraction_present: 0.1,
emails: "alice@zulip.com,bob@zulip.com",
short_name: "Alice and Bob",
name: "Alice and Bob"
}
]
name: "Alice and Bob",
},
],
};
var html = render('group_pms', args);
global.write_handlebars_output("group_pms", html);
@@ -394,12 +394,12 @@ function render(template_name, args) {
var args = {
streams: [
{
name: "devel"
name: "devel",
},
{
name: "social"
}
]
name: "social",
},
],
};
var html = render('invite_subscription', args);
global.write_handlebars_output("invite_subscription", html);
@@ -417,8 +417,8 @@ function render(template_name, args) {
is_stream: true,
content: 'This is message one.',
last_edit_timestr: '11:00',
starred: true
}
starred: true,
},
};
var html = render('single_message', message);
@@ -439,7 +439,7 @@ function render(template_name, args) {
var args = {
topic: "lunch",
content: "Let's go to lunch!",
is_stream: true
is_stream: true,
};
var html = render('message_edit_form', args);
global.write_handlebars_output("message_edit_form", html);
@@ -456,11 +456,11 @@ function render(template_name, args) {
match_content: 'This is message one.',
starred: true,
is_stream: true,
content: 'This is message one.'
content: 'This is message one.',
},
include_recipient: true,
display_recipient: 'devel',
last_edit_timestr: '11:00'
last_edit_timestr: '11:00',
},
{
msg: {
@@ -468,9 +468,9 @@ function render(template_name, args) {
match_content: 'This is message <span class="highlight">two</span>.',
is_stream: true,
unread: true,
id: 2
}
}
id: 2,
},
},
];
var groups = [
@@ -481,8 +481,8 @@ function render(template_name, args) {
message_containers: messages,
show_date: '"<span id="timerender82">Jan&nbsp;07</span>"',
subject: 'two messages',
match_subject: '<span class="highlight">two</span> messages'
}
match_subject: '<span class="highlight">two</span> messages',
},
];
var html = render('message_group', {message_groups: groups, use_match_properties: true});
@@ -505,10 +505,10 @@ function render(template_name, args) {
full_date_str: 'Monday',
full_time_str: '12:00',
sender_full_name: 'Alice Smith',
sender_email: 'alice@zulip.com'
sender_email: 'alice@zulip.com',
},
sent_by_uri: '/sent_by/uri',
pm_with_uri: '/pm_with/uri'
pm_with_uri: '/pm_with/uri',
};
var html = render('message_info_popover_content', args);
@@ -523,8 +523,8 @@ function render(template_name, args) {
var args = {
message: {
is_stream: true,
stream: 'devel'
}
stream: 'devel',
},
};
var html = render('message_info_popover_title', args);
@@ -539,13 +539,13 @@ function render(template_name, args) {
users: [
{
email: 'lear@zulip.com',
full_name: 'King Lear'
full_name: 'King Lear',
},
{
email: 'othello@zulip.com',
full_name: 'Othello the Moor'
}
]
full_name: 'Othello the Moor',
},
],
};
var html = render('new_stream_users', args);
@@ -559,7 +559,7 @@ function render(template_name, args) {
var args = {
content: "Hello",
gravatar_url: "/gravatar/url",
title: "You have a notification"
title: "You have a notification",
};
var html = render('notification', args);
@@ -585,12 +585,12 @@ function render(template_name, args) {
sounds_enabled: true, enable_offline_email_notifications: true,
enable_offline_push_notifications: true, enable_online_push_notifications: true,
enable_digest_emails: true,
autoscroll_forever: true, default_desktop_notifications: true
autoscroll_forever: true, default_desktop_notifications: true,
};
var page_params = $.extend(page_param_checkbox_options, {
fullname: "Alyssa P. Hacker", password_auth_enabled: true,
avatar_url: "https://google.com",
domain: "zulip.com"
domain: "zulip.com",
});
var checkbox_ids = ["enable_stream_desktop_notifications",
@@ -628,9 +628,9 @@ function render(template_name, args) {
want_show_more_messages_links: true,
messages: [
{
recipients: "alice,bob"
}
]
recipients: "alice,bob",
},
],
};
var html = '';
@@ -673,8 +673,8 @@ function render(template_name, args) {
color: 'red',
name: 'devel',
in_home_view: true,
id: 55
}
id: 55,
},
};
var html = render('stream_sidebar_actions', args);
@@ -690,7 +690,7 @@ function render(template_name, args) {
color: "red",
dark_background: "maroon",
uri: "/devel/uri",
id: 999
id: 999,
};
var html = '<ul id="stream_filters">';
@@ -719,14 +719,14 @@ function render(template_name, args) {
can_make_private: true, /* not logical, but that's ok */
email_address: 'xxxxxxxxxxxxxxx@zulip.com',
id: 888,
in_home_view: true
in_home_view: true,
},
{
name: 'social',
color: 'green',
id: 999
}
]
id: 999,
},
],
};
var html = '';
@@ -754,15 +754,15 @@ function render(template_name, args) {
cls: 'root',
title: 'Home',
hash: '#',
data: 'home'
data: 'home',
},
{
cls: 'stream',
title: 'Devel',
hash: '/stream/uri',
data: 'devel'
}
]
data: 'devel',
},
],
};
var html = render('tab_bar', args);
@@ -787,7 +787,7 @@ function render(template_name, args) {
is_muted: false,
topic_name: 'lunch',
url: '/lunch/url',
unread: 5
unread: 5,
};
var html = render('topic_list_item', args);
@@ -802,7 +802,7 @@ function render(template_name, args) {
var args = {
stream_name: 'social',
topic_name: 'lunch',
can_mute_topic: true
can_mute_topic: true,
};
var html = render('topic_sidebar_actions', args);
@@ -820,13 +820,13 @@ function render(template_name, args) {
'tutorial_reply',
'tutorial_stream',
'tutorial_subject',
'tutorial_title'
'tutorial_title',
];
var html = '';
_.each(tutorials, function (tutorial) {
var args = {
placement: 'left',
title: 'Title'
title: 'Title',
};
html = render(tutorial, args);
global.write_handlebars_output(tutorial, html);
@@ -842,16 +842,16 @@ function render(template_name, args) {
type: "active",
num_unread: 0,
email: "lear@zulip.com",
name: "King Lear"
name: "King Lear",
},
{
type_desc: "Away",
type: "away",
num_unread: 5,
email: "othello@zulip.com",
name: "Othello"
}
]
name: "Othello",
},
],
};
var html = '';
@@ -868,7 +868,7 @@ function render(template_name, args) {
(function user_sidebar_actions() {
var args = {
email: 'hamlet@zulip.com',
name: 'Hamlet'
name: 'Hamlet',
};
var html = render('user_sidebar_actions', args);