Commit 64274626 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'leipert-01-eslint-prefer-arrow-callback' into 'master'

Fix eslint prefer-arrow-callback rule

See merge request gitlab-org/gitlab!17112
parents 3d999ccd 57961bbd
/* eslint-disable func-names, no-var, prefer-arrow-callback */
/* eslint-disable func-names, no-var */
import $ from 'jquery';
import axios from '~/lib/utils/axios_utils';
......@@ -45,26 +45,22 @@ MarkdownPreview.prototype.showPreview = function($form) {
this.hideReferencedUsers($form);
} else {
preview.addClass('md-preview-loading').text(__('Loading...'));
this.fetchMarkdownPreview(
mdText,
url,
function(response) {
var body;
if (response.body.length > 0) {
({ body } = response);
} else {
body = this.emptyMessage;
}
preview.removeClass('md-preview-loading').html(body);
preview.renderGFM();
this.renderReferencedUsers(response.references.users, $form);
if (response.references.commands) {
this.renderReferencedCommands(response.references.commands, $form);
}
}.bind(this),
);
this.fetchMarkdownPreview(mdText, url, response => {
var body;
if (response.body.length > 0) {
({ body } = response);
} else {
body = this.emptyMessage;
}
preview.removeClass('md-preview-loading').html(body);
preview.renderGFM();
this.renderReferencedUsers(response.references.users, $form);
if (response.references.commands) {
this.renderReferencedCommands(response.references.commands, $form);
}
});
}
};
......@@ -132,12 +128,12 @@ const markdownToolbar = $('.md-header-toolbar');
$.fn.setupMarkdownPreview = function() {
var $form = $(this);
$form.find('textarea.markdown-area').on('input', function() {
$form.find('textarea.markdown-area').on('input', () => {
markdownPreview.hideReferencedUsers($form);
});
};
$(document).on('markdown-preview:show', function(e, $form) {
$(document).on('markdown-preview:show', (e, $form) => {
if (!$form) {
return;
}
......@@ -162,7 +158,7 @@ $(document).on('markdown-preview:show', function(e, $form) {
markdownPreview.showPreview($form);
});
$(document).on('markdown-preview:hide', function(e, $form) {
$(document).on('markdown-preview:hide', (e, $form) => {
if (!$form) {
return;
}
......@@ -191,7 +187,7 @@ $(document).on('markdown-preview:hide', function(e, $form) {
markdownPreview.hideReferencedCommands($form);
});
$(document).on('markdown-preview:toggle', function(e, keyboardEvent) {
$(document).on('markdown-preview:toggle', (e, keyboardEvent) => {
var $target;
$target = $(keyboardEvent.target);
if ($target.is('textarea.markdown-area')) {
......
/* eslint-disable func-names, prefer-arrow-callback */
/* eslint-disable func-names */
import $ from 'jquery';
import Dropzone from 'dropzone';
......@@ -43,18 +43,18 @@ export default class BlobFileDropzone {
previewsContainer: '.dropzone-previews',
headers: csrf.headers,
init() {
this.on('addedfile', function() {
this.on('addedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.addClass(HIDDEN_CLASS);
$('.dropzone-alerts')
.html('')
.hide();
});
this.on('removedfile', function() {
this.on('removedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.removeClass(HIDDEN_CLASS);
});
this.on('success', function(header, response) {
this.on('success', (header, response) => {
$('#modal-upload-blob').modal('hide');
visitUrl(response.filePath);
});
......@@ -62,7 +62,7 @@ export default class BlobFileDropzone {
dropzoneMessage.addClass(HIDDEN_CLASS);
this.removeFile(file);
});
this.on('sending', function(file, xhr, formData) {
this.on('sending', (file, xhr, formData) => {
formData.append('branch_name', form.find('.js-branch-name').val());
formData.append('create_merge_request', form.find('.js-create-merge-request').val());
formData.append('commit_message', form.find('.js-commit-message').val());
......
/* eslint-disable func-names, prefer-arrow-callback */
/* eslint-disable func-names */
import $ from 'jquery';
import { visitUrl } from './lib/utils/url_utility';
......@@ -12,11 +12,11 @@ export default class BuildArtifacts {
}
// eslint-disable-next-line class-methods-use-this
disablePropagation() {
$('.top-block').on('click', '.download', function(e) {
return e.stopPropagation();
$('.top-block').on('click', '.download', e => {
e.stopPropagation();
});
return $('.tree-holder').on('click', 'tr[data-link] a', function(e) {
return e.stopImmediatePropagation();
return $('.tree-holder').on('click', 'tr[data-link] a', e => {
e.stopImmediatePropagation();
});
}
// eslint-disable-next-line class-methods-use-this
......
/* eslint-disable func-names, no-var, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, one-var, no-return-assign, no-unused-expressions, no-sequences */
/* eslint-disable func-names, no-var, no-else-return, consistent-return, prefer-template, one-var, no-return-assign, no-unused-expressions, no-sequences */
import $ from 'jquery';
......@@ -13,14 +13,14 @@ export default class ImageFile {
$('.two-up.view .frame.deleted img', this.file),
(function(_this) {
return function() {
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function() {
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), () => {
_this.initViewModes();
// Load two-up view after images are loaded
// so that we can display the correct width and height information
const $images = $('.two-up.view img', _this.file);
$images.waitForImages(function() {
$images.waitForImages(() => {
_this.initView('two-up');
});
});
......@@ -138,7 +138,7 @@ export default class ImageFile {
return $(this).width(availWidth / 2);
}
});
return _this.requestImageInfo($('img', wrap), function(width, height) {
return _this.requestImageInfo($('img', wrap), (width, height) => {
$('.image-info .meta-width', wrap).text(width + 'px');
$('.image-info .meta-height', wrap).text(height + 'px');
return $('.image-info', wrap).removeClass('hide');
......@@ -175,7 +175,7 @@ export default class ImageFile {
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
_this.initDraggable($swipeBar, wrapPadding, function(e, left) {
_this.initDraggable($swipeBar, wrapPadding, (e, left) => {
if (left > 0 && left < $swipeFrame.width() - wrapPadding * 2) {
$swipeWrap.width(maxWidth + 1 - left);
$swipeBar.css('left', left);
......@@ -215,7 +215,7 @@ export default class ImageFile {
$frameAdded.css('opacity', 1);
framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10);
_this.initDraggable($dragger, framePadding, function(e, left) {
_this.initDraggable($dragger, framePadding, (e, left) => {
var opacity = left / dragTrackWidth;
if (opacity >= 0 && opacity <= 1) {
......
/* eslint-disable func-names, prefer-arrow-callback */
/* eslint-disable func-names */
import $ from 'jquery';
import Api from './api';
......@@ -50,7 +50,7 @@ export default class CreateLabelDropdown {
this.$dropdownBack.on('click', this.resetForm.bind(this));
this.$cancelButton.on('click', function(e) {
this.$cancelButton.on('click', e => {
e.preventDefault();
e.stopPropagation();
......
/* eslint-disable func-names, no-underscore-dangle, no-var, one-var, vars-on-top, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func */
/* eslint-disable func-names, no-underscore-dangle, no-var, one-var, vars-on-top, no-shadow, no-cond-assign, no-return-assign, no-else-return, camelcase, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func */
import $ from 'jquery';
import _ from 'underscore';
......@@ -35,13 +35,13 @@ GitLabDropdownInput = (function() {
);
this.input
.on('keydown', function(e) {
.on('keydown', e => {
var keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) {
e.preventDefault();
}
})
.on('input', function(e) {
.on('input', e => {
var val = e.currentTarget.value || _this.options.inputFieldName;
val = val
.split(' ')
......@@ -95,42 +95,33 @@ GitLabDropdownFilter = (function() {
// Key events
timeout = '';
this.input
.on('keydown', function(e) {
.on('keydown', e => {
var keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) {
e.preventDefault();
}
})
.on(
'input',
function() {
if (this.input.val() !== '' && !$inputContainer.hasClass(HAS_VALUE_CLASS)) {
$inputContainer.addClass(HAS_VALUE_CLASS);
} else if (this.input.val() === '' && $inputContainer.hasClass(HAS_VALUE_CLASS)) {
$inputContainer.removeClass(HAS_VALUE_CLASS);
}
// Only filter asynchronously only if option remote is set
if (this.options.remote) {
clearTimeout(timeout);
return (timeout = setTimeout(
function() {
$inputContainer.parent().addClass('is-loading');
return this.options.query(
this.input.val(),
function(data) {
$inputContainer.parent().removeClass('is-loading');
return this.options.callback(data);
}.bind(this),
);
}.bind(this),
250,
));
} else {
return this.filter(this.input.val());
}
}.bind(this),
);
.on('input', () => {
if (this.input.val() !== '' && !$inputContainer.hasClass(HAS_VALUE_CLASS)) {
$inputContainer.addClass(HAS_VALUE_CLASS);
} else if (this.input.val() === '' && $inputContainer.hasClass(HAS_VALUE_CLASS)) {
$inputContainer.removeClass(HAS_VALUE_CLASS);
}
// Only filter asynchronously only if option remote is set
if (this.options.remote) {
clearTimeout(timeout);
return (timeout = setTimeout(() => {
$inputContainer.parent().addClass('is-loading');
return this.options.query(this.input.val(), data => {
$inputContainer.parent().removeClass('is-loading');
return this.options.callback(data);
});
}, 250));
} else {
return this.filter(this.input.val());
}
});
}
GitLabDropdownFilter.prototype.shouldBlur = function(keyCode) {
......@@ -175,9 +166,7 @@ GitLabDropdownFilter = (function() {
key: this.options.keys,
});
if (tmp.length) {
results[key] = tmp.map(function(item) {
return item;
});
results[key] = tmp.map(item => item);
}
}
}
......@@ -453,32 +442,28 @@ GitLabDropdown = (function() {
if (this.dropdown.find('.dropdown-toggle-page').length) {
selector = '.dropdown-page-one .dropdown-content a';
}
this.dropdown.on(
'click',
selector,
function(e) {
var $el, selected, selectedObj, isMarking;
$el = $(e.currentTarget);
selected = self.rowClicked($el);
selectedObj = selected ? selected[0] : null;
isMarking = selected ? selected[1] : null;
if (this.options.clicked) {
this.options.clicked.call(this, {
selectedObj,
$el,
e,
isMarking,
});
}
this.dropdown.on('click', selector, e => {
var $el, selected, selectedObj, isMarking;
$el = $(e.currentTarget);
selected = self.rowClicked($el);
selectedObj = selected ? selected[0] : null;
isMarking = selected ? selected[1] : null;
if (this.options.clicked) {
this.options.clicked.call(this, {
selectedObj,
$el,
e,
isMarking,
});
}
// Update label right after all modifications in dropdown has been done
if (this.options.toggleLabel) {
this.updateLabel(selectedObj, $el, this);
}
// Update label right after all modifications in dropdown has been done
if (this.options.toggleLabel) {
this.updateLabel(selectedObj, $el, this);
}
$el.trigger('blur');
}.bind(this),
);
$el.trigger('blur');
});
}
}
......@@ -525,9 +510,7 @@ GitLabDropdown = (function() {
name,
),
);
this.renderData(groupData, name).map(function(item) {
return html.push(item);
});
this.renderData(groupData, name).map(item => html.push(item));
}
} else {
// Render each row
......@@ -708,7 +691,7 @@ GitLabDropdown = (function() {
return text
.split('')
.map(function(character, i) {
.map((character, i) => {
if (indexOf.call(occurrences, i) !== -1) {
return '<b>' + character + '</b>';
} else {
......
/* eslint-disable consistent-return, func-names, array-callback-return, prefer-arrow-callback */
/* eslint-disable consistent-return, func-names, array-callback-return */
import $ from 'jquery';
import _ from 'underscore';
......@@ -45,7 +45,7 @@ export default {
this.getSelectedIssues().map(function() {
const labelsData = $(this).data('labels');
if (labelsData) {
return labelsData.map(function(labelId) {
return labelsData.map(labelId => {
if (labels.indexOf(labelId) === -1) {
return labels.push(labelId);
}
......
/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */
/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, one-var, prefer-template, no-new, consistent-return, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */
/* global Issuable */
/* global ListLabel */
......@@ -24,7 +24,7 @@ export default class LabelsSelect {
$els = $('.js-label-select');
}
$els.each(function(i, dropdown) {
$els.each((i, dropdown) => {
var $block,
$dropdown,
$form,
......@@ -172,9 +172,7 @@ export default class LabelsSelect {
$sidebarCollapsedValue.text(labelCount);
if (data.labels.length) {
labelTitles = data.labels.map(function(label) {
return label.title;
});
labelTitles = data.labels.map(label => label.title);
if (labelTitles.length > 5) {
labelTitles = labelTitles.slice(0, 5);
......@@ -456,9 +454,7 @@ export default class LabelsSelect {
);
} else {
var { labels } = boardsStore.detail.issue;
labels = labels.filter(function(selectedLabel) {
return selectedLabel.id !== label.id;
});
labels = labels.filter(selectedLabel => selectedLabel.id !== label.id);
boardsStore.detail.issue.labels = labels;
}
......
/* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign */
/* eslint-disable no-var, consistent-return, no-return-assign */
function notificationGranted(message, opts, onclick) {
var notification;
notification = new Notification(message, opts);
setTimeout(function() {
// Hide the notification after X amount of seconds
return notification.close();
}, 8000);
setTimeout(
() =>
// Hide the notification after X amount of seconds
notification.close(),
8000,
);
return (notification.onclick = onclick || notification.close);
}
......@@ -32,7 +34,7 @@ function notifyMe(message, body, icon, onclick) {
// If it's okay let's create a notification
return notificationGranted(message, opts, onclick);
} else if (Notification.permission !== 'denied') {
return Notification.requestPermission(function(permission) {
return Notification.requestPermission(permission => {
// If the user accepts, let's create a notification
if (permission === 'granted') {
return notificationGranted(message, opts, onclick);
......
/* eslint-disable func-names, no-var, no-param-reassign, one-var, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, consistent-return */
/* eslint-disable func-names, no-var, no-param-reassign, one-var, operator-assignment, no-else-return, prefer-template, consistent-return */
import $ from 'jquery';
import { insertText } from '~/lib/utils/common_utils';
......@@ -218,7 +218,7 @@ export function insertMarkdownText({
: blockTagText(text, textArea, blockTag, selected);
} else {
textToInsert = selectedSplit
.map(function(val) {
.map(val => {
if (tag.indexOf(textPlaceholder) > -1) {
return tag.replace(textPlaceholder, val);
}
......@@ -301,7 +301,7 @@ export function addMarkdownListeners(form) {
export function addEditorMarkdownListeners(editor) {
$('.js-md')
.off('click')
.on('click', function(e) {
.on('click', e => {
const { mdTag, mdBlock, mdPrepend, mdSelect } = $(e.currentTarget).data();
insertMarkdownText({
......
/* eslint-disable func-names, no-var, no-underscore-dangle, one-var, consistent-return, prefer-arrow-callback */
/* eslint-disable func-names, no-var, no-underscore-dangle, one-var, consistent-return */
import $ from 'jquery';
import { __ } from '~/locale';
......@@ -105,7 +105,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) {
};
MergeRequest.prototype.initCommitMessageListeners = function() {
$(document).on('click', 'a.js-with-description-link', function(e) {
$(document).on('click', 'a.js-with-description-link', e => {
var textarea = $('textarea.js-commit-message');
e.preventDefault();
......@@ -114,7 +114,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
$('.js-without-description-hint').show();
});
$(document).on('click', 'a.js-without-description-link', function(e) {
$(document).on('click', 'a.js-without-description-link', e => {
var textarea = $('textarea.js-commit-message');
e.preventDefault();
......
/* eslint-disable func-names, no-else-return, prefer-template, prefer-arrow-callback */
/* eslint-disable no-else-return, prefer-template */
import $ from 'jquery';
import '~/gl_dropdown';
......@@ -28,7 +28,7 @@ export default class NamespaceSelect {
}
},
data(term, dataCallback) {
return Api.namespaces(term, function(namespaces) {
return Api.namespaces(term, namespaces => {
if (isFilter) {
const anyNamespace = {
text: __('Any namespace'),
......
/* eslint-disable func-names, no-var, one-var, no-loop-func, consistent-return, prefer-template, prefer-arrow-callback, camelcase */
/* eslint-disable func-names, no-var, one-var, no-loop-func, consistent-return, prefer-template, camelcase */
import $ from 'jquery';
import { __ } from '../locale';
......@@ -259,9 +259,7 @@ export default (function() {
opacity: 0,
cursor: 'pointer',
})
.click(function() {
return window.open(options.commit_url.replace('%s', commit.id), '_blank');
})
.click(() => window.open(options.commit_url.replace('%s', commit.id), '_blank'))
.hover(
function() {
this.tooltip = r.commitTooltip(x + 5, y, commit);
......
/* eslint-disable func-names, no-var, one-var, consistent-return, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, @gitlab/i18n/no-non-i18n-strings */
/* eslint-disable func-names, no-var, one-var, consistent-return, no-return-assign, prefer-template, no-shadow, no-else-return, @gitlab/i18n/no-non-i18n-strings */
import $ from 'jquery';
import RefSelectDropdown from './ref_select_dropdown';
......@@ -63,7 +63,7 @@ export default class NewBranchForm {
};
formatter = function(values, restriction) {
var formatted;
formatted = values.map(function(value) {
formatted = values.map(value => {
switch (false) {
case !/\s/.test(value):
return 'spaces';
......
/* eslint-disable no-restricted-properties, func-names, no-var, camelcase,
no-unused-expressions, one-var, default-case,
prefer-template, consistent-return, no-alert, no-return-assign,
no-param-reassign, prefer-arrow-callback, no-else-return, vars-on-top,
no-param-reassign, no-else-return, vars-on-top,
no-shadow, no-useless-escape, class-methods-use-this */
/* global ResolveService */
......@@ -1370,7 +1370,7 @@ export default class Notes {
.find('li.system-note')
.has('ul');
$.each(systemNotes, function(index, systemNote) {
$.each(systemNotes, (index, systemNote) => {
const $systemNote = $(systemNote);
const headerMessage = $systemNote
.find('.note-text')
......
/* eslint-disable func-names, no-restricted-syntax, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, no-return-assign, prefer-arrow-callback, prefer-template, no-else-return, no-shadow */
/* eslint-disable func-names, no-restricted-syntax, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, no-return-assign, prefer-template, no-else-return, no-shadow */
import $ from 'jquery';
import _ from 'underscore';
......@@ -69,24 +69,18 @@ export const ContributorsGraph = (function() {
ContributorsGraph.set_y_domain = function(data) {
return (ContributorsGraph.prototype.y_domain = [
0,
d3.max(data, function(d) {
return (d.commits = d.commits || d.additions || d.deletions);
}),
d3.max(data, d => (d.commits = d.commits || d.additions || d.deletions)),
]);
};
ContributorsGraph.init_x_domain = function(data) {
return (ContributorsGraph.prototype.x_domain = d3.extent(data, function(d) {
return d.date;
}));
return (ContributorsGraph.prototype.x_domain = d3.extent(data, d => d.date));
};
ContributorsGraph.init_y_domain = function(data) {
return (ContributorsGraph.prototype.y_domain = [
0,
d3.max(data, function(d) {
return (d.commits = d.commits || d.additions || d.deletions);
}),
d3.max(data, d => (d.commits = d.commits || d.additions || d.deletions)),
]);
};
......@@ -180,9 +174,7 @@ export const ContributorsMasterGraph = (function(superClass) {
ContributorsMasterGraph.prototype.parse_dates = function(data) {
const parseDate = d3.timeParse('%Y-%m-%d');
return data.forEach(function(d) {
return (d.date = parseDate(d.date));
});
return data.forEach(d => (d.date = parseDate(d.date)));
};
ContributorsMasterGraph.prototype.create_scale = function() {
......@@ -216,11 +208,9 @@ export const ContributorsMasterGraph = (function(superClass) {
ContributorsMasterGraph.prototype.create_area = function(x, y) {
return (this.area = d3
.area()
.x(function(d) {
return x(d.date);
})
.x(d => x(d.date))
.y0(this.height)
.y1(function(d) {
.y1(d => {
d.commits = d.commits || d.additions || d.deletions;
return y(d.commits);
}));
......@@ -330,7 +320,7 @@ export const ContributorsAuthorGraph = (function(superClass) {
ContributorsAuthorGraph.prototype.create_area = function(x, y) {
return (this.area = d3
.area()
.x(function(d) {
.x(d => {
const parseDate = d3.timeParse('%Y-%m-%d');
return x(parseDate(d));
})
......
/* eslint-disable func-names, no-var, one-var, camelcase, no-param-reassign, no-return-assign, prefer-arrow-callback, consistent-return, no-cond-assign, no-else-return */
/* eslint-disable func-names, no-var, one-var, camelcase, no-param-reassign, no-return-assign, consistent-return, no-cond-assign, no-else-return */
import _ from 'underscore';
export default {
......@@ -76,16 +76,12 @@ export default {
var log, total_data;
log = parsed_log.total;
total_data = this.pick_field(log, field);
return _.sortBy(total_data, function(d) {
return d.date;
});
return _.sortBy(total_data, d => d.date);
},
pick_field(log, field) {
var total_data;
total_data = [];
_.each(log, function(d) {
return total_data.push(_.pick(d, [field, 'date']));
});
_.each(log, d => total_data.push(_.pick(d, [field, 'date'])));
return total_data;
},
get_author_data(parsed_log, field, date_range) {
......@@ -107,9 +103,7 @@ export default {
};
})(this),
);
return _.sortBy(author_data, function(d) {
return d[field];
}).reverse();
return _.sortBy(author_data, d => d[field]).reverse();
},
parse_log_entry(log_entry, field, date_range) {
var parsed_entry;
......
/* eslint-disable func-names, prefer-arrow-callback, consistent-return, */
/* eslint-disable consistent-return */
import $ from 'jquery';
import { __ } from './locale';
......@@ -40,12 +40,9 @@ export default class SingleFileDiff {
this.$toggleIcon.addClass('fa-caret-down');
}
$('.js-file-title, .click-to-expand', this.file).on(
'click',
function(e) {
this.toggleDiff($(e.target));
}.bind(this),
);
$('.js-file-title, .click-to-expand', this.file).on('click', e => {
this.toggleDiff($(e.target));
});
}
toggleDiff($target, cb) {
......
/* eslint-disable func-names, consistent-return, no-var, one-var, no-else-return, prefer-arrow-callback, class-methods-use-this */
/* eslint-disable func-names, consistent-return, no-var, one-var, no-else-return, class-methods-use-this */
import $ from 'jquery';
import { visitUrl } from './lib/utils/url_utility';
......@@ -29,7 +29,7 @@ export default class TreeView {
var li, liSelected;
li = $('tr.tree-item');
liSelected = null;
return $('body').keydown(function(e) {
return $('body').keydown(e => {
var next, path;
if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) {
return false;
......
/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, no-shadow, no-else-return, no-self-compare, prefer-template, no-unused-expressions, yoda, prefer-spread, camelcase, no-param-reassign */
/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, consistent-return, no-shadow, no-else-return, no-self-compare, prefer-template, no-unused-expressions, yoda, prefer-spread, camelcase, no-param-reassign */
/* global Issuable */
/* global emitSidebarEvent */
......@@ -250,16 +250,12 @@ function UsersSelect(currentUser, els, options = {}) {
return $dropdown.glDropdown({
showMenuAbove,
data(term, callback) {
return _this.users(
term,
options,
function(users) {
// GitLabDropdownFilter returns this.instance
// GitLabDropdownRemote returns this.options.instance
const glDropdown = this.instance || this.options.instance;
glDropdown.options.processData(term, users, callback);
}.bind(this),
);
return _this.users(term, options, users => {
// GitLabDropdownFilter returns this.instance
// GitLabDropdownRemote returns this.options.instance
const glDropdown = this.instance || this.options.instance;
glDropdown.options.processData(term, users, callback);
});
},
processData(term, data, callback) {
let users = data;
......@@ -606,7 +602,7 @@ function UsersSelect(currentUser, els, options = {}) {
multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0,
query(query) {
return _this.users(query.term, options, function(users) {
return _this.users(query.term, options, users => {
var anyUser, data, emailUser, index, len, name, nullUser, obj, ref;
data = {
results: users,
......
/* eslint-disable func-names, prefer-arrow-callback, consistent-return, camelcase, class-methods-use-this */
/* eslint-disable func-names, consistent-return, camelcase, class-methods-use-this */
// Zen Mode (full screen) textarea
//
......@@ -39,11 +39,11 @@ export default class ZenMode {
constructor() {
this.active_backdrop = null;
this.active_textarea = null;
$(document).on('click', '.js-zen-enter', function(e) {
$(document).on('click', '.js-zen-enter', e => {
e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:enter');
});
$(document).on('click', '.js-zen-leave', function(e) {
$(document).on('click', '.js-zen-leave', e => {
e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:leave');
});
......@@ -67,7 +67,7 @@ export default class ZenMode {
};
})(this),
);
$(document).on('keydown', function(e) {
$(document).on('keydown', e => {
// Esc
if (e.keyCode === 27) {
e.preventDefault();
......
/* eslint-disable prefer-arrow-callback, no-var, one-var, consistent-return, func-names */
/* eslint-disable no-var, one-var, consistent-return, func-names */
import $ from 'jquery';
import Api from 'ee/api';
......@@ -14,8 +14,8 @@ export default function initLDAPGroupsSelect() {
};
import(/* webpackChunkName: 'select2' */ 'select2/select2')
.then(() => {
$('.ajax-ldap-groups-select').each(function(i, select) {
return $(select).select2({
$('.ajax-ldap-groups-select').each((i, select) => {
$(select).select2({
id(group) {
return group.cn;
},
......@@ -24,7 +24,7 @@ export default function initLDAPGroupsSelect() {
query(query) {
var provider;
provider = $('#ldap_group_link_provider').val();
return Api.ldapGroups(query.term, provider, function(groups) {
return Api.ldapGroups(query.term, provider, groups => {
var data;
data = {
results: groups,
......@@ -52,7 +52,7 @@ export default function initLDAPGroupsSelect() {
})
.catch(() => {});
return $('#ldap_group_link_provider').on('change', function() {
return $('.ajax-ldap-groups-select').select2('data', null);
$('#ldap_group_link_provider').on('change', () => {
$('.ajax-ldap-groups-select').select2('data', null);
});
}
/* eslint-disable no-var, func-names, one-var, prefer-arrow-callback, prefer-template, no-else-return */
/* eslint-disable no-var, func-names, one-var, prefer-template, no-else-return */
import $ from 'jquery';
import Api from '~/api';
......@@ -20,7 +20,7 @@ function AdminEmailSelect() {
order_by: 'id',
membership: false,
});
return Promise.all([projectsFetch, groupsFetch]).then(function([projects, groups]) {
return Promise.all([projectsFetch, groupsFetch]).then(([projects, groups]) => {
var all, data;
all = {
id: 'all',
......
/* eslint-disable prefer-arrow-callback, one-var, no-var, no-shadow, no-else-return, func-names */
/* eslint-disable one-var, no-var, no-shadow, no-else-return */
import $ from 'jquery';
import '~/gl_dropdown';
......@@ -6,7 +6,7 @@ import '~/gl_dropdown';
function WeightSelect(els, options = {}) {
const $els = $(els || '.js-weight-select');
$els.each(function(i, dropdown) {
$els.each((i, dropdown) => {
var $block, $dropdown, $selectbox, $value;
$dropdown = $(dropdown);
$selectbox = $dropdown.closest('.selectbox');
......
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