Commit f5cbb44d authored by gfyoung's avatar gfyoung Committed by Clement Ho

Follow-up to !19808: Split up for-loop initializations

parent 94ac31e2
...@@ -142,14 +142,14 @@ LineHighlighter.prototype.highlightLine = function(lineNumber) { ...@@ -142,14 +142,14 @@ LineHighlighter.prototype.highlightLine = function(lineNumber) {
// //
// range - Array containing the starting and ending line numbers // range - Array containing the starting and ending line numbers
LineHighlighter.prototype.highlightRange = function(range) { LineHighlighter.prototype.highlightRange = function(range) {
var i, lineNumber, ref, ref1, results;
if (range[1]) { if (range[1]) {
results = []; const results = [];
const ref = range[0] <= range[1] ? range : range.reverse();
// eslint-disable-next-line no-multi-assign for (let lineNumber = range[0]; lineNumber <= ref[1]; lineNumber += 1) {
for (lineNumber = i = ref = range[0], ref1 = range[1]; ref <= ref1 ? i <= ref1 : i >= ref1; lineNumber = ref <= ref1 ? (i += 1) : (i -= 1)) {
results.push(this.highlightLine(lineNumber)); results.push(this.highlightLine(lineNumber));
} }
return results; return results;
} else { } else {
return this.highlightLine(range[0]); return this.highlightLine(range[0]);
......
...@@ -113,8 +113,7 @@ export default (function() { ...@@ -113,8 +113,7 @@ export default (function() {
}); });
ref = this.days; ref = this.days;
// eslint-disable-next-line no-multi-assign for (mm = 0, len = ref.length; mm < len; mm += 1) {
for (mm = j = 0, len = ref.length; j < len; mm = (j += 1)) {
day = ref[mm]; day = ref[mm];
if (cuday !== day[0] || cumonth !== day[1]) { if (cuday !== day[0] || cumonth !== day[1]) {
// Dates // Dates
...@@ -288,8 +287,7 @@ export default (function() { ...@@ -288,8 +287,7 @@ export default (function() {
ref = commit.parents; ref = commit.parents;
results = []; results = [];
// eslint-disable-next-line no-multi-assign for (i = 0, len = ref.length; i < len; i += 1) {
for (i = j = 0, len = ref.length; j < len; i = (j += 1)) {
parent = ref[i]; parent = ref[i];
parentCommit = this.preparedCommits[parent[0]]; parentCommit = this.preparedCommits[parent[0]];
parentY = this.offsetY + this.unitTime * parentCommit.time; parentY = this.offsetY + this.unitTime * parentCommit.time;
......
...@@ -140,10 +140,9 @@ import _ from 'underscore'; ...@@ -140,10 +140,9 @@ import _ from 'underscore';
binary = atob(dataURL.split(',')[1]); binary = atob(dataURL.split(',')[1]);
array = []; array = [];
// eslint-disable-next-line no-multi-assign for (i = 0, len = binary.length; i < len; i += 1) {
for (k = i = 0, len = binary.length; i < len; k = (i += 1)) { v = binary[i];
v = binary[k]; array.push(binary.charCodeAt(i));
array.push(binary.charCodeAt(k));
} }
return new Blob([new Uint8Array(array)], { return new Blob([new Uint8Array(array)], {
type: 'image/png' type: 'image/png'
......
...@@ -92,8 +92,7 @@ export default class ProjectFindFile { ...@@ -92,8 +92,7 @@ export default class ProjectFindFile {
this.element.find(".tree-table > tbody").empty(); this.element.find(".tree-table > tbody").empty();
results = []; results = [];
// eslint-disable-next-line no-multi-assign for (i = 0, len = filePaths.length; i < len; i += 1) {
for (i = j = 0, len = filePaths.length; j < len; i = (j += 1)) {
filePath = filePaths[i]; filePath = filePaths[i];
if (i === 20) { if (i === 20) {
break; break;
......
...@@ -259,8 +259,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -259,8 +259,7 @@ function UsersSelect(currentUser, els, options = {}) {
showDivider = 0; showDivider = 0;
if (firstUser) { if (firstUser) {
// Move current user to the front of the list // Move current user to the front of the list
// eslint-disable-next-line no-multi-assign for (index = 0, len = users.length; index < len; index += 1) {
for (index = j = 0, len = users.length; j < len; index = (j += 1)) {
obj = users[index]; obj = users[index];
if (obj.username === firstUser) { if (obj.username === firstUser) {
users.splice(index, 1); users.splice(index, 1);
...@@ -563,8 +562,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -563,8 +562,7 @@ function UsersSelect(currentUser, els, options = {}) {
// Move current user to the front of the list // Move current user to the front of the list
ref = data.results; ref = data.results;
// eslint-disable-next-line no-multi-assign for (index = 0, len = ref.length; index < len; index += 1) {
for (index = j = 0, len = ref.length; j < len; index = (j += 1)) {
obj = ref[index]; obj = ref[index];
if (obj.username === firstUser) { if (obj.username === firstUser) {
data.results.splice(index, 1); data.results.splice(index, 1);
......
---
title: Improve no-multi-assignment fixes after enabling rule
merge_request: 19915
author: gfyoung
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment