mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate number of generally very old violations in the codebase. Fix this and clear the ones that exist..
This commit is contained in:
@@ -245,6 +245,12 @@
|
|||||||
"FunctionExpression": {"parameters": "first"},
|
"FunctionExpression": {"parameters": "first"},
|
||||||
"FunctionDeclaration": {"parameters": "first"}
|
"FunctionDeclaration": {"parameters": "first"}
|
||||||
}],
|
}],
|
||||||
|
"key-spacing": [ "error",
|
||||||
|
{
|
||||||
|
"beforeColon": false,
|
||||||
|
"afterColon": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"keyword-spacing": [ "error",
|
"keyword-spacing": [ "error",
|
||||||
{
|
{
|
||||||
"before": true,
|
"before": true,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ exports.select_item_via_typeahead = function (field_selector, str, item) {
|
|||||||
currentTarget: $('.typeahead:visible li:contains("' + item + '")')[0],
|
currentTarget: $('.typeahead:visible li:contains("' + item + '")')[0],
|
||||||
});
|
});
|
||||||
tah.select();
|
tah.select();
|
||||||
}, {field_selector:field_selector, str: str, item: item});
|
}, {field_selector: field_selector, str: str, item: item});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ casper.then(function () {
|
|||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
casper.waitUntilVisible('#get_api_key_button', function () {
|
casper.waitUntilVisible('#get_api_key_button', function () {
|
||||||
casper.fill('#get_api_key_form', {password:test_credentials.default_user.password});
|
casper.fill('#get_api_key_form', {password: test_credentials.default_user.password});
|
||||||
casper.click('#get_api_key_button');
|
casper.click('#get_api_key_button');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ zrequire('components');
|
|||||||
|
|
||||||
var noop = function () {};
|
var noop = function () {};
|
||||||
|
|
||||||
var LEFT_KEY = { which: 37, preventDefault: noop, stopPropagation:noop };
|
var LEFT_KEY = { which: 37, preventDefault: noop, stopPropagation: noop };
|
||||||
var RIGHT_KEY = { which: 39, preventDefault: noop, stopPropagation:noop };
|
var RIGHT_KEY = { which: 39, preventDefault: noop, stopPropagation: noop };
|
||||||
|
|
||||||
run_test('basics', () => {
|
run_test('basics', () => {
|
||||||
var keydown_f;
|
var keydown_f;
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ run_test('marked', () => {
|
|||||||
{input: 'T\n@**Cordelia Lear**',
|
{input: 'T\n@**Cordelia Lear**',
|
||||||
expected: '<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>'},
|
expected: '<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>'},
|
||||||
{input: '@**Mark Twin|104** and @**Mark Twin|105** are out to confuse you.',
|
{input: '@**Mark Twin|104** and @**Mark Twin|105** are out to confuse you.',
|
||||||
expected:'<p><span class="user-mention" data-user-id="104">@Mark Twin</span> and <span class="user-mention" data-user-id="105">@Mark Twin</span> are out to confuse you.</p>'},
|
expected: '<p><span class="user-mention" data-user-id="104">@Mark Twin</span> and <span class="user-mention" data-user-id="105">@Mark Twin</span> are out to confuse you.</p>'},
|
||||||
{input: '@**Invalid User|1234**',
|
{input: '@**Invalid User|1234**',
|
||||||
expected: '<p>@**Invalid User|1234**</p>'},
|
expected: '<p>@**Invalid User|1234**</p>'},
|
||||||
{input: '@**Cordelia Lear|103** has a wrong user_id.',
|
{input: '@**Cordelia Lear|103** has a wrong user_id.',
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ run_test('updates', () => {
|
|||||||
|
|
||||||
run_test('nth_most_recent_id', () => {
|
run_test('nth_most_recent_id', () => {
|
||||||
var list = new MessageList({});
|
var list = new MessageList({});
|
||||||
list.append([{id:10}, {id:20}, {id:30}]);
|
list.append([{id: 10}, {id: 20}, {id: 30}]);
|
||||||
assert.equal(list.nth_most_recent_id(1), 30);
|
assert.equal(list.nth_most_recent_id(1), 30);
|
||||||
assert.equal(list.nth_most_recent_id(2), 20);
|
assert.equal(list.nth_most_recent_id(2), 20);
|
||||||
assert.equal(list.nth_most_recent_id(3), 10);
|
assert.equal(list.nth_most_recent_id(3), 10);
|
||||||
@@ -269,8 +269,9 @@ run_test('last_sent_by_me', () => {
|
|||||||
|
|
||||||
run_test('local_echo', () => {
|
run_test('local_echo', () => {
|
||||||
var list = new MessageList({});
|
var list = new MessageList({});
|
||||||
list.append([{id:10}, {id:20}, {id:30}, {id:20.02}, {id:20.03}, {id:40}, {id:50}, {id:60}]);
|
list.append([{id: 10}, {id: 20}, {id: 30}, {id: 20.02},
|
||||||
list._local_only = {20.02: {id:20.02}, 20.03: {id:20.03}};
|
{id: 20.03}, {id: 40}, {id: 50}, {id: 60}]);
|
||||||
|
list._local_only = {20.02: {id: 20.02}, 20.03: {id: 20.03}};
|
||||||
|
|
||||||
assert.equal(list.closest_id(10), 10);
|
assert.equal(list.closest_id(10), 10);
|
||||||
assert.equal(list.closest_id(20), 20);
|
assert.equal(list.closest_id(20), 20);
|
||||||
@@ -292,9 +293,9 @@ run_test('local_echo', () => {
|
|||||||
|
|
||||||
list = new MessageList({});
|
list = new MessageList({});
|
||||||
list.append([
|
list.append([
|
||||||
{id:10}, {id:20}, {id:30}, {id:20.02}, {id:20.03}, {id:40},
|
{id: 10}, {id: 20}, {id: 30}, {id: 20.02}, {id: 20.03}, {id: 40},
|
||||||
{id:50}, {id: 50.01}, {id: 50.02}, {id:60}]);
|
{id: 50}, {id: 50.01}, {id: 50.02}, {id: 60}]);
|
||||||
list._local_only = {20.02: {id:20.02}, 20.03: {id:20.03},
|
list._local_only = {20.02: {id: 20.02}, 20.03: {id: 20.03},
|
||||||
50.01: {id: 50.01}, 50.02: {id: 50.02}};
|
50.01: {id: 50.01}, 50.02: {id: 50.02}};
|
||||||
|
|
||||||
assert.equal(list.closest_id(10), 10);
|
assert.equal(list.closest_id(10), 10);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ set_global('timerender', {
|
|||||||
}
|
}
|
||||||
return [{outerHTML: String(time1.getTime()) + ' - ' + String(time2.getTime())}];
|
return [{outerHTML: String(time1.getTime()) + ' - ' + String(time2.getTime())}];
|
||||||
},
|
},
|
||||||
stringify_time : function (time) {
|
stringify_time: function (time) {
|
||||||
if (page_params.twenty_four_hour_time) {
|
if (page_params.twenty_four_hour_time) {
|
||||||
return time.toString('HH:mm');
|
return time.toString('HH:mm');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ set_global("page_params", {
|
|||||||
realm_uri: "https://chat.example.com",
|
realm_uri: "https://chat.example.com",
|
||||||
realm_embedded_bots: [
|
realm_embedded_bots: [
|
||||||
{name: "converter", config: {}},
|
{name: "converter", config: {}},
|
||||||
{name:"giphy", config: {key: "12345678"}},
|
{name: "giphy", config: {key: "12345678"}},
|
||||||
{name:"foobot", config: {bar: "baz", qux: "quux"}},
|
{name: "foobot", config: {bar: "baz", qux: "quux"}},
|
||||||
],
|
],
|
||||||
realm_bots: [{api_key: 'QadL788EkiottHmukyhHgePUFHREiu8b',
|
realm_bots: [{api_key: 'QadL788EkiottHmukyhHgePUFHREiu8b',
|
||||||
email: 'error-bot@zulip.org',
|
email: 'error-bot@zulip.org',
|
||||||
|
|||||||
@@ -210,22 +210,22 @@ run_test('sort_recipients', () => {
|
|||||||
|
|
||||||
// For splitting based on recency
|
// For splitting based on recency
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 7,
|
sender_id: 7,
|
||||||
stream_id : 1,
|
stream_id: 1,
|
||||||
subject : "Dev Topic",
|
subject: "Dev Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 5,
|
sender_id: 5,
|
||||||
stream_id : 1,
|
stream_id: 1,
|
||||||
subject : "Dev Topic",
|
subject: "Dev Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 6,
|
sender_id: 6,
|
||||||
stream_id : 1,
|
stream_id: 1,
|
||||||
subject : "Dev Topic",
|
subject: "Dev Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Typeahead for stream message [query, stream-name, topic-name]
|
// Typeahead for stream message [query, stream-name, topic-name]
|
||||||
@@ -240,16 +240,16 @@ run_test('sort_recipients', () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 5,
|
sender_id: 5,
|
||||||
stream_id : 2,
|
stream_id: 2,
|
||||||
subject : "Linux Topic",
|
subject: "Linux Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 7,
|
sender_id: 7,
|
||||||
stream_id : 2,
|
stream_id: 2,
|
||||||
subject : "Linux Topic",
|
subject: "Linux Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// No match
|
// No match
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ run_test('mentions', () => {
|
|||||||
stream_id: 999,
|
stream_id: 999,
|
||||||
subject: 'lunch',
|
subject: 'lunch',
|
||||||
mentioned: true,
|
mentioned: true,
|
||||||
unread:true,
|
unread: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
unread.process_loaded_messages([message]);
|
unread.process_loaded_messages([message]);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ run_test('lower_bound', () => {
|
|||||||
assert.equal(util.lower_bound(arr, 55), 5);
|
assert.equal(util.lower_bound(arr, 55), 5);
|
||||||
assert.equal(util.lower_bound(arr, 2, 4, 31), 3);
|
assert.equal(util.lower_bound(arr, 2, 4, 31), 3);
|
||||||
|
|
||||||
arr = [{x: 10}, {x: 20}, {x:30}];
|
arr = [{x: 10}, {x: 20}, {x: 30}];
|
||||||
|
|
||||||
function compare(a, b) {
|
function compare(a, b) {
|
||||||
return a.x < b;
|
return a.x < b;
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ class MarkdownComparer {
|
|||||||
are_equivalent = this._haveEqualContents(element_actual, element_expected);
|
are_equivalent = this._haveEqualContents(element_actual, element_expected);
|
||||||
if (!are_equivalent) {
|
if (!are_equivalent) {
|
||||||
html = {
|
html = {
|
||||||
actual : this._reorderAttributes(element_actual).innerHTML,
|
actual: this._reorderAttributes(element_actual).innerHTML,
|
||||||
expected : this._reorderAttributes(element_expected).innerHTML,
|
expected: this._reorderAttributes(element_expected).innerHTML,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ class MarkdownComparer {
|
|||||||
|
|
||||||
if (comparison_results.are_equivalent === false) {
|
if (comparison_results.are_equivalent === false) {
|
||||||
throw new assert.AssertionError({
|
throw new assert.AssertionError({
|
||||||
message : message + this._output_formatter(
|
message: message + this._output_formatter(
|
||||||
comparison_results.html.actual,
|
comparison_results.html.actual,
|
||||||
comparison_results.html.expected
|
comparison_results.html.expected
|
||||||
),
|
),
|
||||||
@@ -153,7 +153,7 @@ class MarkdownComparer {
|
|||||||
|
|
||||||
if (comparison_results.are_equivalent) {
|
if (comparison_results.are_equivalent) {
|
||||||
throw new assert.AssertionError({
|
throw new assert.AssertionError({
|
||||||
message : message + [
|
message: message + [
|
||||||
"actual and expected output produce semantially identical HTML",
|
"actual and expected output produce semantially identical HTML",
|
||||||
actual,
|
actual,
|
||||||
"==",
|
"==",
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ function apply_color(input_string, changes) {
|
|||||||
input_string = input_string.slice(2);
|
input_string = input_string.slice(2);
|
||||||
|
|
||||||
const formatter = {
|
const formatter = {
|
||||||
delete : (string) => { return "\u001b[31m" + string + "\u001b[0m"; },
|
delete: (string) => { return "\u001b[31m" + string + "\u001b[0m"; },
|
||||||
insert : (string) => { return "\u001b[32m" + string + "\u001b[0m"; },
|
insert: (string) => { return "\u001b[32m" + string + "\u001b[0m"; },
|
||||||
replace : (string) => { return "\u001b[33m" + string + "\u001b[0m"; },
|
replace: (string) => { return "\u001b[33m" + string + "\u001b[0m"; },
|
||||||
};
|
};
|
||||||
changes.forEach((change) => {
|
changes.forEach((change) => {
|
||||||
if (formatter.hasOwnProperty(change.tag)) {
|
if (formatter.hasOwnProperty(change.tag)) {
|
||||||
@@ -57,16 +57,16 @@ function parse_questionmark_line(questionmark_line) {
|
|||||||
|
|
||||||
const changes_list = [];
|
const changes_list = [];
|
||||||
const aliases = {
|
const aliases = {
|
||||||
"^" : "replace",
|
"^": "replace",
|
||||||
"+" : "insert",
|
"+": "insert",
|
||||||
"-" : "delete",
|
"-": "delete",
|
||||||
};
|
};
|
||||||
const add_change = () => {
|
const add_change = () => {
|
||||||
if (current_sequence) {
|
if (current_sequence) {
|
||||||
changes_list.push({
|
changes_list.push({
|
||||||
tag : aliases[current_sequence],
|
tag: aliases[current_sequence],
|
||||||
beginning_index,
|
beginning_index,
|
||||||
ending_index : index,
|
ending_index: index,
|
||||||
});
|
});
|
||||||
current_sequence = "";
|
current_sequence = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var admin_settings_label = {
|
|||||||
|
|
||||||
// Organization permissions
|
// Organization permissions
|
||||||
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),
|
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),
|
||||||
realm_email_changes_disabled : i18n.t("Prevent users from changing their email address"),
|
realm_email_changes_disabled: i18n.t("Prevent users from changing their email address"),
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.build_page = function () {
|
exports.build_page = function () {
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ function integration_events() {
|
|||||||
$(".integrations .searchbar input[type='text']")
|
$(".integrations .searchbar input[type='text']")
|
||||||
.focus()
|
.focus()
|
||||||
.on('input', function (e) {
|
.on('input', function (e) {
|
||||||
dispatch('UPDATE_QUERY', { query : e.target.value.toLowerCase() });
|
dispatch('UPDATE_QUERY', { query: e.target.value.toLowerCase() });
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).scroll(function () {
|
$(window).scroll(function () {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ var settings_notifications = (function () {
|
|||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
var stream_notification_settings = [
|
var stream_notification_settings = [
|
||||||
{setting: "enable_stream_desktop_notifications", notifications:"desktop_notifications"},
|
{setting: "enable_stream_desktop_notifications", notifications: "desktop_notifications"},
|
||||||
{setting: "enable_stream_push_notifications", notifications:"push_notifications"},
|
{setting: "enable_stream_push_notifications", notifications: "push_notifications"},
|
||||||
{setting: "enable_stream_sounds", notifications:"audible_notifications"},
|
{setting: "enable_stream_sounds", notifications: "audible_notifications"},
|
||||||
{setting: "enable_stream_email_notifications", notifications:"email_notifications"},
|
{setting: "enable_stream_email_notifications", notifications: "email_notifications"},
|
||||||
];
|
];
|
||||||
|
|
||||||
var pm_mention_notification_settings = [
|
var pm_mention_notification_settings = [
|
||||||
|
|||||||
@@ -1084,7 +1084,7 @@ exports.build_page = function () {
|
|||||||
overlays.close_modal('deactivate-realm-modal');
|
overlays.close_modal('deactivate-realm-modal');
|
||||||
}
|
}
|
||||||
channel.post({
|
channel.post({
|
||||||
url:'/json/realm/deactivate',
|
url: '/json/realm/deactivate',
|
||||||
error: function (xhr) {
|
error: function (xhr) {
|
||||||
ui_report.error(
|
ui_report.error(
|
||||||
i18n.t("Failed"), xhr, $('#admin-realm-deactivation-status').expectOne()
|
i18n.t("Failed"), xhr, $('#admin-realm-deactivation-status').expectOne()
|
||||||
|
|||||||
Reference in New Issue
Block a user