Commit cab4302a authored by Mike Greiling's avatar Mike Greiling

Merge branch 'enable-no-multi-assign' into 'master'

Enable no-multi-assignment in JS files

See merge request gitlab-org/gitlab-ce!19808
parents 12a1ddd5 dbc74800
...@@ -71,5 +71,3 @@ rules: ...@@ -71,5 +71,3 @@ rules:
body: 1 body: 1
## Destructuring: https://eslint.org/docs/rules/prefer-destructuring ## Destructuring: https://eslint.org/docs/rules/prefer-destructuring
prefer-destructuring: off prefer-destructuring: off
## no-multi-assign: https://eslint.org/docs/rules/no-multi-assign
no-multi-assign: off
...@@ -197,7 +197,10 @@ export const insertText = (target, text) => { ...@@ -197,7 +197,10 @@ export const insertText = (target, text) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
target.value = newText; target.value = newText;
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
target.selectionStart = target.selectionEnd = selectionStart + insertedText.length; target.selectionStart = selectionStart + insertedText.length;
// eslint-disable-next-line no-param-reassign
target.selectionEnd = selectionStart + insertedText.length;
// Trigger autosave // Trigger autosave
target.dispatchEvent(new Event('input')); target.dispatchEvent(new Event('input'));
......
...@@ -145,6 +145,8 @@ LineHighlighter.prototype.highlightRange = function(range) { ...@@ -145,6 +145,8 @@ LineHighlighter.prototype.highlightRange = function(range) {
var i, lineNumber, ref, ref1, results; var i, lineNumber, ref, ref1, results;
if (range[1]) { if (range[1]) {
results = []; results = [];
// eslint-disable-next-line no-multi-assign
for (lineNumber = i = ref = range[0], ref1 = range[1]; ref <= ref1 ? i <= ref1 : i >= ref1; lineNumber = ref <= ref1 ? (i += 1) : (i -= 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));
} }
......
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
this.updateAspectRatio = true; this.updateAspectRatio = true;
}, },
toggleAspectRatio() { toggleAspectRatio() {
this.updatedAspectRatios = this.updatedAspectRatios += 1; this.updatedAspectRatios += 1;
if (this.store.getMetricsCount() === this.updatedAspectRatios) { if (this.store.getMetricsCount() === this.updatedAspectRatios) {
this.updateAspectRatio = !this.updateAspectRatio; this.updateAspectRatio = !this.updateAspectRatio;
this.updatedAspectRatios = 0; this.updatedAspectRatios = 0;
......
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
point.x = e.clientX; point.x = e.clientX;
point.y = e.clientY; point.y = e.clientY;
point = point.matrixTransform(this.$refs.graphData.getScreenCTM().inverse()); point = point.matrixTransform(this.$refs.graphData.getScreenCTM().inverse());
point.x = point.x += 7; point.x += 7;
const firstTimeSeries = this.timeSeries[0]; const firstTimeSeries = this.timeSeries[0];
const timeValueOverlay = firstTimeSeries.timeSeriesScaleX.invert(point.x); const timeValueOverlay = firstTimeSeries.timeSeriesScaleX.invert(point.x);
const overlayIndex = bisectDate(firstTimeSeries.values, timeValueOverlay, 1); const overlayIndex = bisectDate(firstTimeSeries.values, timeValueOverlay, 1);
......
...@@ -112,6 +112,8 @@ export default (function() { ...@@ -112,6 +112,8 @@ export default (function() {
fill: "#444" fill: "#444"
}); });
ref = this.days; ref = this.days;
// eslint-disable-next-line no-multi-assign
for (mm = j = 0, len = ref.length; j < len; mm = (j += 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]) {
...@@ -285,6 +287,8 @@ export default (function() { ...@@ -285,6 +287,8 @@ export default (function() {
r = this.r; r = this.r;
ref = commit.parents; ref = commit.parents;
results = []; results = [];
// eslint-disable-next-line no-multi-assign
for (i = j = 0, len = ref.length; j < len; i = (j += 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]];
......
...@@ -36,7 +36,9 @@ export default (function() { ...@@ -36,7 +36,9 @@ export default (function() {
var author_graph, author_header; var author_graph, author_header;
author_header = _this.create_author_header(d); author_header = _this.create_author_header(d);
$(".contributors-list").append(author_header); $(".contributors-list").append(author_header);
_this.authors[d.author_name] = author_graph = new ContributorsAuthorGraph(d.dates);
author_graph = new ContributorsAuthorGraph(d.dates);
_this.authors[d.author_name] = author_graph;
return author_graph.draw(); return author_graph.draw();
}; };
})(this)); })(this));
......
...@@ -111,10 +111,15 @@ export default { ...@@ -111,10 +111,15 @@ export default {
parse_log_entry: function(log_entry, field, date_range) { parse_log_entry: function(log_entry, field, date_range) {
var parsed_entry; var parsed_entry;
parsed_entry = {}; parsed_entry = {};
parsed_entry.author_name = log_entry.author_name; parsed_entry.author_name = log_entry.author_name;
parsed_entry.author_email = log_entry.author_email; parsed_entry.author_email = log_entry.author_email;
parsed_entry.dates = {}; parsed_entry.dates = {};
parsed_entry.commits = parsed_entry.additions = parsed_entry.deletions = 0;
parsed_entry.commits = 0;
parsed_entry.additions = 0;
parsed_entry.deletions = 0;
_.each(_.omit(log_entry, 'author_name', 'author_email'), (function(_this) { _.each(_.omit(log_entry, 'author_name', 'author_email'), (function(_this) {
return function(value, key) { return function(value, key) {
if (_this.in_range(value.date, date_range)) { if (_this.in_range(value.date, date_range)) {
......
...@@ -139,6 +139,8 @@ import _ from 'underscore'; ...@@ -139,6 +139,8 @@ import _ from 'underscore';
var array, binary, i, k, len, v; var array, binary, i, k, len, v;
binary = atob(dataURL.split(',')[1]); binary = atob(dataURL.split(',')[1]);
array = []; array = [];
// eslint-disable-next-line no-multi-assign
for (k = i = 0, len = binary.length; i < len; k = (i += 1)) { for (k = i = 0, len = binary.length; i < len; k = (i += 1)) {
v = binary[k]; v = binary[k];
array.push(binary.charCodeAt(k)); array.push(binary.charCodeAt(k));
......
...@@ -91,6 +91,8 @@ export default class ProjectFindFile { ...@@ -91,6 +91,8 @@ export default class ProjectFindFile {
var blobItemUrl, filePath, html, i, j, len, matches, results; var blobItemUrl, filePath, html, i, j, len, matches, results;
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 = j = 0, len = filePaths.length; j < len; i = (j += 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) {
......
...@@ -107,7 +107,7 @@ export default class PrometheusMetrics { ...@@ -107,7 +107,7 @@ export default class PrometheusMetrics {
if (data && data.success) { if (data && data.success) {
stop(data); stop(data);
} else { } else {
this.backOffRequestCounter = this.backOffRequestCounter += 1; this.backOffRequestCounter += 1;
if (this.backOffRequestCounter < 3) { if (this.backOffRequestCounter < 3) {
next(); next();
} else { } else {
......
...@@ -259,6 +259,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -259,6 +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 = j = 0, len = users.length; j < len; index = (j += 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) {
...@@ -561,6 +562,8 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -561,6 +562,8 @@ function UsersSelect(currentUser, els, options = {}) {
if (firstUser) { if (firstUser) {
// 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 = j = 0, len = ref.length; j < len; index = (j += 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) {
......
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
MRWidgetService.fetchMetrics(this.metricsUrl) MRWidgetService.fetchMetrics(this.metricsUrl)
.then((res) => { .then((res) => {
if (res.status === statusCodes.NO_CONTENT) { if (res.status === statusCodes.NO_CONTENT) {
this.backOffRequestCounter = this.backOffRequestCounter += 1; this.backOffRequestCounter += 1;
/* eslint-disable no-unused-expressions */ /* eslint-disable no-unused-expressions */
this.backOffRequestCounter < 3 ? next() : stop(res); this.backOffRequestCounter < 3 ? next() : stop(res);
} else { } else {
......
...@@ -8,7 +8,9 @@ describe('GL Style Field Errors', function() { ...@@ -8,7 +8,9 @@ describe('GL Style Field Errors', function() {
beforeEach(function() { beforeEach(function() {
loadFixtures('static/gl_field_errors.html.raw'); loadFixtures('static/gl_field_errors.html.raw');
const $form = this.$form = $('form.gl-show-field-errors'); const $form = $('form.gl-show-field-errors');
this.$form = $form;
this.fieldErrors = new GlFieldErrors($form); this.fieldErrors = new GlFieldErrors($form);
}); });
......
export default { export default {
createNumberRandomUsers(numberUsers) { createNumberRandomUsers(numberUsers) {
const users = []; const users = [];
for (let i = 0; i < numberUsers; i = i += 1) { for (let i = 0; i < numberUsers; i += 1) {
users.push( users.push(
{ {
avatar: 'https://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon', avatar: 'https://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
......
...@@ -90,7 +90,8 @@ describe('UpdateUsername component', () => { ...@@ -90,7 +90,8 @@ describe('UpdateUsername component', () => {
it('confirmation modal should escape usernames properly', done => { it('confirmation modal should escape usernames properly', done => {
const { modalBody } = findElements(); const { modalBody } = findElements();
vm.username = vm.newUsername = '<i>Italic</i>'; vm.username = '<i>Italic</i>';
vm.newUsername = vm.username;
Vue.nextTick() Vue.nextTick()
.then(() => { .then(() => {
......
...@@ -39,7 +39,8 @@ jasmine.getJSONFixtures().fixturesPath = FIXTURES_PATH; ...@@ -39,7 +39,8 @@ jasmine.getJSONFixtures().fixturesPath = FIXTURES_PATH;
beforeAll(() => jasmine.addMatchers(customMatchers)); beforeAll(() => jasmine.addMatchers(customMatchers));
// globalize common libraries // globalize common libraries
window.$ = window.jQuery = $; window.$ = $;
window.jQuery = window.$;
// stub expected globals // stub expected globals
window.gl = window.gl || {}; window.gl = window.gl || {};
......
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