Switch no-loop-func eslint rule from warning to error (in .eslintrc)

The one error that needed to be fixed was in static/js/echo.js.
The function in the loop was being used by _.each(). This has been
replaced by iterating through the array using a while loop instead.
This commit is contained in:
Arpith Siromoney
2016-11-24 12:58:16 +05:30
committed by Tim Abbott
parent fdae58f96b
commit 29d3019262
2 changed files with 8 additions and 5 deletions

View File

@@ -133,7 +133,7 @@
"no-self-compare": 2, "no-self-compare": 2,
"no-sync": 2, "no-sync": 2,
"no-underscore-dangle": 1, "no-underscore-dangle": 1,
"no-loop-func": 1, "no-loop-func": 2,
"no-labels": 2, "no-labels": 2,
"no-unused-vars": 1, "no-unused-vars": 1,
"no-script-url": 2, "no-script-url": 2,

View File

@@ -95,13 +95,16 @@ function add_subject_links(message) {
var url = realm_filter[1]; var url = realm_filter[1];
var match; var match;
while ((match = pattern.exec(subject)) !== null) { while ((match = pattern.exec(subject)) !== null) {
var current_group = 1;
var link_url = url; var link_url = url;
_.each(match.slice(1), function (matched_group) { var matched_groups = match.slice(1);
var i = 0;
while (i < matched_groups.length) {
var matched_group = matched_groups[i];
var current_group = i + 1;
var back_ref = "\\" + current_group; var back_ref = "\\" + current_group;
link_url = link_url.replace(back_ref, matched_group); link_url = link_url.replace(back_ref, matched_group);
current_group++; i++;
}); }
links.push(link_url); links.push(link_url);
} }
}); });