Commit 8df7fa38 authored by Lukas Eipert's avatar Lukas Eipert

Fix eslints for the object-shorthand rule

This fixes all disabled lints for the `object-shorthand` rule:
https://eslint.org/docs/rules/object-shorthand
parent e8e4887e
/* eslint-disable func-names, no-var, object-shorthand, prefer-arrow-callback */ /* eslint-disable func-names, no-var, prefer-arrow-callback */
import $ from 'jquery'; import $ from 'jquery';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
...@@ -82,7 +82,7 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) { ...@@ -82,7 +82,7 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
}) })
.then(({ data }) => { .then(({ data }) => {
this.ajaxCache = { this.ajaxCache = {
text: text, text,
response: data, response: data,
}; };
success(data); success(data);
......
/* eslint-disable func-names, object-shorthand, prefer-arrow-callback */ /* eslint-disable func-names, prefer-arrow-callback */
import $ from 'jquery'; import $ from 'jquery';
import Dropzone from 'dropzone'; import Dropzone from 'dropzone';
...@@ -32,7 +32,7 @@ export default class BlobFileDropzone { ...@@ -32,7 +32,7 @@ export default class BlobFileDropzone {
url: form.attr('action'), url: form.attr('action'),
// Rails uses a hidden input field for PUT // Rails uses a hidden input field for PUT
// http://stackoverflow.com/questions/21056482/how-to-set-method-put-in-form-tag-in-rails // http://stackoverflow.com/questions/21056482/how-to-set-method-put-in-form-tag-in-rails
method: method, method,
clickable: true, clickable: true,
uploadMultiple: false, uploadMultiple: false,
paramName: 'file', paramName: 'file',
...@@ -42,7 +42,7 @@ export default class BlobFileDropzone { ...@@ -42,7 +42,7 @@ export default class BlobFileDropzone {
addRemoveLinks: true, addRemoveLinks: true,
previewsContainer: '.dropzone-previews', previewsContainer: '.dropzone-previews',
headers: csrf.headers, headers: csrf.headers,
init: function() { init() {
this.on('addedfile', function() { this.on('addedfile', function() {
toggleLoading(submitButton, submitButtonLoadingIcon, false); toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.addClass(HIDDEN_CLASS); dropzoneMessage.addClass(HIDDEN_CLASS);
...@@ -69,7 +69,7 @@ export default class BlobFileDropzone { ...@@ -69,7 +69,7 @@ export default class BlobFileDropzone {
}); });
}, },
// Override behavior of adding error underneath preview // Override behavior of adding error underneath preview
error: function(file, errorMessage) { error(file, errorMessage) {
const stripped = $('<div/>') const stripped = $('<div/>')
.html(errorMessage) .html(errorMessage)
.text(); .text();
......
/* eslint-disable func-names, one-var, no-var, object-shorthand, no-else-return */ /* eslint-disable func-names, one-var, no-var, no-else-return */
import $ from 'jquery'; import $ from 'jquery';
import { __ } from './locale'; import { __ } from './locale';
...@@ -15,7 +15,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( ...@@ -15,7 +15,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
const $fieldInput = $(`input[name="${$dropdown.data('fieldName')}"]`, $dropdownContainer); const $fieldInput = $(`input[name="${$dropdown.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer); const $filterInput = $('input[type="search"]', $dropdownContainer);
$dropdown.glDropdown({ $dropdown.glDropdown({
data: function(term, callback) { data(term, callback) {
const params = { const params = {
ref: $dropdown.data('ref'), ref: $dropdown.data('ref'),
search: term, search: term,
...@@ -43,7 +43,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( ...@@ -43,7 +43,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
filterRemote: Boolean($dropdown.data('refsUrl')), filterRemote: Boolean($dropdown.data('refsUrl')),
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
filterInput: 'input[type="search"]', filterInput: 'input[type="search"]',
renderRow: function(ref) { renderRow(ref) {
var link; var link;
if (ref.header != null) { if (ref.header != null) {
return $('<li />') return $('<li />')
...@@ -58,10 +58,10 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( ...@@ -58,10 +58,10 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
return $('<li />').append(link); return $('<li />').append(link);
} }
}, },
id: function(obj, $el) { id(obj, $el) {
return $el.attr('data-ref'); return $el.attr('data-ref');
}, },
toggleLabel: function(obj, $el) { toggleLabel(obj, $el) {
return $el.text().trim(); return $el.text().trim();
}, },
clicked: () => clickHandler($dropdown), clicked: () => clickHandler($dropdown),
......
/* eslint-disable object-shorthand, func-names, no-else-return, no-lonely-if */ /* eslint-disable no-else-return, no-lonely-if */
/* global CommentsStore */ /* global CommentsStore */
import $ from 'jquery'; import $ from 'jquery';
...@@ -19,17 +19,17 @@ const CommentAndResolveBtn = Vue.extend({ ...@@ -19,17 +19,17 @@ const CommentAndResolveBtn = Vue.extend({
}; };
}, },
computed: { computed: {
showButton: function() { showButton() {
if (this.discussion) { if (this.discussion) {
return this.discussion.isResolvable(); return this.discussion.isResolvable();
} else { } else {
return false; return false;
} }
}, },
isDiscussionResolved: function() { isDiscussionResolved() {
return this.discussion.isResolved(); return this.discussion.isResolved();
}, },
buttonText: function() { buttonText() {
if (this.isDiscussionResolved) { if (this.isDiscussionResolved) {
if (this.textareaIsEmpty) { if (this.textareaIsEmpty) {
return __('Unresolve thread'); return __('Unresolve thread');
...@@ -50,7 +50,7 @@ const CommentAndResolveBtn = Vue.extend({ ...@@ -50,7 +50,7 @@ const CommentAndResolveBtn = Vue.extend({
this.discussion = CommentsStore.state[this.discussionId]; this.discussion = CommentsStore.state[this.discussionId];
} }
}, },
mounted: function() { mounted() {
if (!this.discussionId) return; if (!this.discussionId) return;
const $textarea = $( const $textarea = $(
...@@ -62,7 +62,7 @@ const CommentAndResolveBtn = Vue.extend({ ...@@ -62,7 +62,7 @@ const CommentAndResolveBtn = Vue.extend({
this.textareaIsEmpty = $textarea.val() === ''; this.textareaIsEmpty = $textarea.val() === '';
}); });
}, },
destroyed: function() { destroyed() {
if (!this.discussionId) return; if (!this.discussionId) return;
$(`.js-discussion-note-form[data-discussion-id=${this.discussionId}] .note-textarea`).off( $(`.js-discussion-note-form[data-discussion-id=${this.discussionId}] .note-textarea`).off(
......
/* eslint-disable object-shorthand, func-names, no-else-return, guard-for-in, no-restricted-syntax, no-lonely-if, no-continue */ /* eslint-disable func-names, no-else-return, guard-for-in, no-restricted-syntax, no-lonely-if, no-continue */
/* global CommentsStore */ /* global CommentsStore */
import $ from 'jquery'; import $ from 'jquery';
...@@ -15,24 +15,24 @@ const JumpToDiscussion = Vue.extend({ ...@@ -15,24 +15,24 @@ const JumpToDiscussion = Vue.extend({
required: true, required: true,
}, },
}, },
data: function() { data() {
return { return {
discussions: CommentsStore.state, discussions: CommentsStore.state,
discussion: {}, discussion: {},
}; };
}, },
computed: { computed: {
buttonText: function() { buttonText() {
if (this.discussionId) { if (this.discussionId) {
return __('Jump to next unresolved discussion'); return __('Jump to next unresolved discussion');
} else { } else {
return __('Jump to first unresolved discussion'); return __('Jump to first unresolved discussion');
} }
}, },
allResolved: function() { allResolved() {
return this.unresolvedDiscussionCount === 0; return this.unresolvedDiscussionCount === 0;
}, },
showButton: function() { showButton() {
if (this.discussionId) { if (this.discussionId) {
if (this.unresolvedDiscussionCount > 1) { if (this.unresolvedDiscussionCount > 1) {
return true; return true;
...@@ -43,7 +43,7 @@ const JumpToDiscussion = Vue.extend({ ...@@ -43,7 +43,7 @@ const JumpToDiscussion = Vue.extend({
return this.unresolvedDiscussionCount >= 1; return this.unresolvedDiscussionCount >= 1;
} }
}, },
lastResolvedId: function() { lastResolvedId() {
let lastId; let lastId;
for (const discussionId in this.discussions) { for (const discussionId in this.discussions) {
const discussion = this.discussions[discussionId]; const discussion = this.discussions[discussionId];
...@@ -59,7 +59,7 @@ const JumpToDiscussion = Vue.extend({ ...@@ -59,7 +59,7 @@ const JumpToDiscussion = Vue.extend({
this.discussion = this.discussions[this.discussionId]; this.discussion = this.discussions[this.discussionId];
}, },
methods: { methods: {
jumpToNextUnresolvedDiscussion: function() { jumpToNextUnresolvedDiscussion() {
let discussionsSelector; let discussionsSelector;
let discussionIdsInScope; let discussionIdsInScope;
let firstUnresolvedDiscussionId; let firstUnresolvedDiscussionId;
......
/* eslint-disable object-shorthand, func-names */
/* global CommentsStore */ /* global CommentsStore */
import Vue from 'vue'; import Vue from 'vue';
...@@ -13,13 +12,13 @@ window.ResolveCount = Vue.extend({ ...@@ -13,13 +12,13 @@ window.ResolveCount = Vue.extend({
required: true, required: true,
}, },
}, },
data: function() { data() {
return { return {
discussions: CommentsStore.state, discussions: CommentsStore.state,
}; };
}, },
computed: { computed: {
allResolved: function() { allResolved() {
return this.resolvedDiscussionCount === this.discussionCount; return this.resolvedDiscussionCount === this.discussionCount;
}, },
resolvedCountText() { resolvedCountText() {
......
/* eslint-disable object-shorthand, func-names, no-else-return */ /* eslint-disable no-else-return */
/* global CommentsStore */ /* global CommentsStore */
/* global ResolveService */ /* global ResolveService */
...@@ -20,34 +20,34 @@ const ResolveDiscussionBtn = Vue.extend({ ...@@ -20,34 +20,34 @@ const ResolveDiscussionBtn = Vue.extend({
required: true, required: true,
}, },
}, },
data: function() { data() {
return { return {
discussion: {}, discussion: {},
}; };
}, },
computed: { computed: {
showButton: function() { showButton() {
if (this.discussion) { if (this.discussion) {
return this.discussion.isResolvable(); return this.discussion.isResolvable();
} else { } else {
return false; return false;
} }
}, },
isDiscussionResolved: function() { isDiscussionResolved() {
if (this.discussion) { if (this.discussion) {
return this.discussion.isResolved(); return this.discussion.isResolved();
} else { } else {
return false; return false;
} }
}, },
buttonText: function() { buttonText() {
if (this.isDiscussionResolved) { if (this.isDiscussionResolved) {
return __('Unresolve discussion'); return __('Unresolve discussion');
} else { } else {
return __('Resolve discussion'); return __('Resolve discussion');
} }
}, },
loading: function() { loading() {
if (this.discussion) { if (this.discussion) {
return this.discussion.loading; return this.discussion.loading;
} else { } else {
...@@ -55,13 +55,13 @@ const ResolveDiscussionBtn = Vue.extend({ ...@@ -55,13 +55,13 @@ const ResolveDiscussionBtn = Vue.extend({
} }
}, },
}, },
created: function() { created() {
CommentsStore.createDiscussion(this.discussionId, this.canResolve); CommentsStore.createDiscussion(this.discussionId, this.canResolve);
this.discussion = CommentsStore.state[this.discussionId]; this.discussion = CommentsStore.state[this.discussionId];
}, },
methods: { methods: {
resolve: function() { resolve() {
ResolveService.toggleResolveForDiscussion(this.mergeRequestId, this.discussionId); ResolveService.toggleResolveForDiscussion(this.mergeRequestId, this.discussionId);
}, },
}, },
......
/* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, */ /* eslint-disable guard-for-in, no-restricted-syntax, */
const DiscussionMixins = { const DiscussionMixins = {
computed: { computed: {
discussionCount: function() { discussionCount() {
return Object.keys(this.discussions).length; return Object.keys(this.discussions).length;
}, },
resolvedDiscussionCount: function() { resolvedDiscussionCount() {
let resolvedCount = 0; let resolvedCount = 0;
for (const discussionId in this.discussions) { for (const discussionId in this.discussions) {
...@@ -18,7 +18,7 @@ const DiscussionMixins = { ...@@ -18,7 +18,7 @@ const DiscussionMixins = {
return resolvedCount; return resolvedCount;
}, },
unresolvedDiscussionCount: function() { unresolvedDiscussionCount() {
let unresolvedCount = 0; let unresolvedCount = 0;
for (const discussionId in this.discussions) { for (const discussionId in this.discussions) {
......
/* eslint-disable object-shorthand, func-names, camelcase, no-restricted-syntax, guard-for-in */ /* eslint-disable camelcase, no-restricted-syntax, guard-for-in */
/* global DiscussionModel */ /* global DiscussionModel */
import Vue from 'vue'; import Vue from 'vue';
window.CommentsStore = { window.CommentsStore = {
state: {}, state: {},
get: function(discussionId, noteId) { get(discussionId, noteId) {
return this.state[discussionId].getNote(noteId); return this.state[discussionId].getNote(noteId);
}, },
createDiscussion: function(discussionId, canResolve) { createDiscussion(discussionId, canResolve) {
let discussion = this.state[discussionId]; let discussion = this.state[discussionId];
if (!this.state[discussionId]) { if (!this.state[discussionId]) {
discussion = new DiscussionModel(discussionId); discussion = new DiscussionModel(discussionId);
...@@ -21,18 +21,18 @@ window.CommentsStore = { ...@@ -21,18 +21,18 @@ window.CommentsStore = {
return discussion; return discussion;
}, },
create: function(noteObj) { create(noteObj) {
const discussion = this.createDiscussion(noteObj.discussionId); const discussion = this.createDiscussion(noteObj.discussionId);
discussion.createNote(noteObj); discussion.createNote(noteObj);
}, },
update: function(discussionId, noteId, resolved, resolved_by) { update(discussionId, noteId, resolved, resolved_by) {
const discussion = this.state[discussionId]; const discussion = this.state[discussionId];
const note = discussion.getNote(noteId); const note = discussion.getNote(noteId);
note.resolved = resolved; note.resolved = resolved;
note.resolved_by = resolved_by; note.resolved_by = resolved_by;
}, },
delete: function(discussionId, noteId) { delete(discussionId, noteId) {
const discussion = this.state[discussionId]; const discussion = this.state[discussionId];
discussion.deleteNote(noteId); discussion.deleteNote(noteId);
...@@ -40,7 +40,7 @@ window.CommentsStore = { ...@@ -40,7 +40,7 @@ window.CommentsStore = {
Vue.delete(this.state, discussionId); Vue.delete(this.state, discussionId);
} }
}, },
unresolvedDiscussionIds: function() { unresolvedDiscussionIds() {
const ids = []; const ids = [];
for (const discussionId in this.state) { for (const discussionId in this.state) {
......
/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, object-shorthand, 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, 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 */
/* global Issuable */ /* global Issuable */
/* global ListLabel */ /* global ListLabel */
...@@ -197,8 +197,8 @@ export default class LabelsSelect { ...@@ -197,8 +197,8 @@ export default class LabelsSelect {
.catch(() => flash(__('Error saving label update.'))); .catch(() => flash(__('Error saving label update.')));
}; };
$dropdown.glDropdown({ $dropdown.glDropdown({
showMenuAbove: showMenuAbove, showMenuAbove,
data: function(term, callback) { data(term, callback) {
labelUrl = $dropdown.attr('data-labels'); labelUrl = $dropdown.attr('data-labels');
axios axios
.get(labelUrl) .get(labelUrl)
...@@ -231,7 +231,7 @@ export default class LabelsSelect { ...@@ -231,7 +231,7 @@ export default class LabelsSelect {
}) })
.catch(() => flash(__('Error fetching labels.'))); .catch(() => flash(__('Error fetching labels.')));
}, },
renderRow: function(label) { renderRow(label) {
var linkEl, var linkEl,
listItemEl, listItemEl,
colorEl, colorEl,
...@@ -316,7 +316,7 @@ export default class LabelsSelect { ...@@ -316,7 +316,7 @@ export default class LabelsSelect {
selectable: true, selectable: true,
filterable: true, filterable: true,
selected: $dropdown.data('selected') || [], selected: $dropdown.data('selected') || [],
toggleLabel: function(selected, el) { toggleLabel(selected, el) {
var $dropdownParent = $dropdown.parent(); var $dropdownParent = $dropdown.parent();
var $dropdownInputField = $dropdownParent.find('.dropdown-input-field'); var $dropdownInputField = $dropdownParent.find('.dropdown-input-field');
var isSelected = el !== null ? el.hasClass('is-active') : false; var isSelected = el !== null ? el.hasClass('is-active') : false;
...@@ -350,7 +350,7 @@ export default class LabelsSelect { ...@@ -350,7 +350,7 @@ export default class LabelsSelect {
} }
}, },
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
id: function(label) { id(label) {
if (label.id <= 0) return label.title; if (label.id <= 0) return label.title;
if ($dropdown.hasClass('js-issuable-form-dropdown')) { if ($dropdown.hasClass('js-issuable-form-dropdown')) {
...@@ -363,7 +363,7 @@ export default class LabelsSelect { ...@@ -363,7 +363,7 @@ export default class LabelsSelect {
return label.id; return label.id;
} }
}, },
hidden: function() { hidden() {
var isIssueIndex, isMRIndex, page; var isIssueIndex, isMRIndex, page;
page = $('body').attr('data-page'); page = $('body').attr('data-page');
isIssueIndex = page === 'projects:issues:index'; isIssueIndex = page === 'projects:issues:index';
...@@ -394,7 +394,7 @@ export default class LabelsSelect { ...@@ -394,7 +394,7 @@ export default class LabelsSelect {
}, },
multiSelect: $dropdown.hasClass('js-multiselect'), multiSelect: $dropdown.hasClass('js-multiselect'),
vue: $dropdown.hasClass('js-issue-board-sidebar'), vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: function(clickEvent) { clicked(clickEvent) {
const { $el, e, isMarking } = clickEvent; const { $el, e, isMarking } = clickEvent;
const label = clickEvent.selectedObj; const label = clickEvent.selectedObj;
...@@ -478,7 +478,7 @@ export default class LabelsSelect { ...@@ -478,7 +478,7 @@ export default class LabelsSelect {
} }
} }
}, },
opened: function() { opened() {
if ($dropdown.hasClass('js-issue-board-sidebar')) { if ($dropdown.hasClass('js-issue-board-sidebar')) {
const previousSelection = $dropdown.attr('data-selected'); const previousSelection = $dropdown.attr('data-selected');
this.selected = previousSelection ? previousSelection.split(',') : []; this.selected = previousSelection ? previousSelection.split(',') : [];
......
/* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign, object-shorthand */ /* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign */
function notificationGranted(message, opts, onclick) { function notificationGranted(message, opts, onclick) {
var notification; var notification;
...@@ -21,8 +21,8 @@ function notifyPermissions() { ...@@ -21,8 +21,8 @@ function notifyPermissions() {
function notifyMe(message, body, icon, onclick) { function notifyMe(message, body, icon, onclick) {
var opts; var opts;
opts = { opts = {
body: body, body,
icon: icon, icon,
}; };
// Let's check if the browser supports notifications // Let's check if the browser supports notifications
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */ /* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
......
/* eslint-disable no-useless-computed-key, object-shorthand, no-param-reassign */ /* eslint-disable no-param-reassign */
/* global ace */ /* global ace */
import Vue from 'vue'; import Vue from 'vue';
...@@ -42,7 +42,7 @@ import getModeByFileExtension from '~/lib/utils/ace_utils'; ...@@ -42,7 +42,7 @@ import getModeByFileExtension from '~/lib/utils/ace_utils';
}, },
}, },
watch: { watch: {
['file.showEditor'](val) { 'file.showEditor': function showEditorWatcher(val) {
this.resetEditorContent(); this.resetEditorContent();
if (!val || this.fileLoaded || this.loading) { if (!val || this.fileLoaded || this.loading) {
......
/* eslint-disable object-shorthand, no-param-reassign, camelcase, no-nested-ternary, no-continue */ /* eslint-disable no-param-reassign, camelcase, no-nested-ternary, no-continue */
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
...@@ -31,7 +31,7 @@ import { s__ } from '~/locale'; ...@@ -31,7 +31,7 @@ import { s__ } from '~/locale';
hasError: false, hasError: false,
isSubmitting: false, isSubmitting: false,
isParallel: diffViewType === VIEW_TYPES.PARALLEL, isParallel: diffViewType === VIEW_TYPES.PARALLEL,
diffViewType: diffViewType, diffViewType,
conflictsData: {}, conflictsData: {},
}, },
...@@ -188,7 +188,7 @@ import { s__ } from '~/locale'; ...@@ -188,7 +188,7 @@ import { s__ } from '~/locale';
getHeadHeaderLine(id) { getHeadHeaderLine(id) {
return { return {
id: id, id,
richText: HEAD_HEADER_TEXT, richText: HEAD_HEADER_TEXT,
buttonTitle: HEAD_BUTTON_TITLE, buttonTitle: HEAD_BUTTON_TITLE,
type: 'new', type: 'new',
...@@ -233,7 +233,7 @@ import { s__ } from '~/locale'; ...@@ -233,7 +233,7 @@ import { s__ } from '~/locale';
getOriginHeaderLine(id) { getOriginHeaderLine(id) {
return { return {
id: id, id,
richText: ORIGIN_HEADER_TEXT, richText: ORIGIN_HEADER_TEXT,
buttonTitle: ORIGIN_BUTTON_TITLE, buttonTitle: ORIGIN_BUTTON_TITLE,
type: 'old', type: 'old',
......
/* eslint-disable one-var, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */ /* eslint-disable one-var, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */
/* global Issuable */ /* global Issuable */
/* global ListMilestone */ /* global ListMilestone */
...@@ -65,7 +65,7 @@ export default class MilestoneSelect { ...@@ -65,7 +65,7 @@ export default class MilestoneSelect {
milestoneLinkNoneTemplate = `<span class="no-value">${__('None')}</span>`; milestoneLinkNoneTemplate = `<span class="no-value">${__('None')}</span>`;
} }
return $dropdown.glDropdown({ return $dropdown.glDropdown({
showMenuAbove: showMenuAbove, showMenuAbove,
data: (term, callback) => data: (term, callback) =>
axios.get(milestonesUrl).then(({ data }) => { axios.get(milestonesUrl).then(({ data }) => {
const extraOptions = []; const extraOptions = [];
...@@ -126,7 +126,7 @@ export default class MilestoneSelect { ...@@ -126,7 +126,7 @@ export default class MilestoneSelect {
return defaultLabel; return defaultLabel;
} }
}, },
defaultLabel: defaultLabel, defaultLabel,
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
text: milestone => _.escape(milestone.title), text: milestone => _.escape(milestone.title),
id: milestone => { id: milestone => {
......
/* eslint-disable func-names, object-shorthand, no-else-return, prefer-template, prefer-arrow-callback */ /* eslint-disable func-names, no-else-return, prefer-template, prefer-arrow-callback */
import $ from 'jquery'; import $ from 'jquery';
import Api from './api'; import Api from './api';
...@@ -18,15 +18,15 @@ export default class NamespaceSelect { ...@@ -18,15 +18,15 @@ export default class NamespaceSelect {
search: { search: {
fields: ['path'], fields: ['path'],
}, },
fieldName: fieldName, fieldName,
toggleLabel: function(selected) { toggleLabel(selected) {
if (selected.id == null) { if (selected.id == null) {
return selected.text; return selected.text;
} else { } else {
return selected.kind + ': ' + selected.full_path; return selected.kind + ': ' + selected.full_path;
} }
}, },
data: function(term, dataCallback) { data(term, dataCallback) {
return Api.namespaces(term, function(namespaces) { return Api.namespaces(term, function(namespaces) {
if (isFilter) { if (isFilter) {
const anyNamespace = { const anyNamespace = {
...@@ -39,7 +39,7 @@ export default class NamespaceSelect { ...@@ -39,7 +39,7 @@ export default class NamespaceSelect {
return dataCallback(namespaces); return dataCallback(namespaces);
}); });
}, },
text: function(namespace) { text(namespace) {
if (namespace.id == null) { if (namespace.id == null) {
return namespace.text; return namespace.text;
} else { } else {
......
/* eslint-disable func-names, object-shorthand, 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, prefer-arrow-callback, consistent-return, no-cond-assign, no-else-return */
import _ from 'underscore'; import _ from 'underscore';
export default { export default {
parse_log: function(log) { parse_log(log) {
var by_author, by_email, data, entry, i, len, total, normalized_email; var by_author, by_email, data, entry, i, len, total, normalized_email;
total = {}; total = {};
by_author = {}; by_author = {};
...@@ -25,15 +25,15 @@ export default { ...@@ -25,15 +25,15 @@ export default {
total = _.toArray(total); total = _.toArray(total);
by_author = _.toArray(by_author); by_author = _.toArray(by_author);
return { return {
total: total, total,
by_author: by_author, by_author,
}; };
}, },
add_date: function(date, collection) { add_date(date, collection) {
collection[date] = {}; collection[date] = {};
return (collection[date].date = date); return (collection[date].date = date);
}, },
add_author: function(author, by_author, by_email) { add_author(author, by_author, by_email) {
var data, normalized_email; var data, normalized_email;
data = {}; data = {};
data.author_name = author.author_name; data.author_name = author.author_name;
...@@ -43,36 +43,36 @@ export default { ...@@ -43,36 +43,36 @@ export default {
by_email[normalized_email] = data; by_email[normalized_email] = data;
return data; return data;
}, },
store_data: function(entry, total, by_author) { store_data(entry, total, by_author) {
this.store_commits(total, by_author); this.store_commits(total, by_author);
this.store_additions(entry, total, by_author); this.store_additions(entry, total, by_author);
return this.store_deletions(entry, total, by_author); return this.store_deletions(entry, total, by_author);
}, },
store_commits: function(total, by_author) { store_commits(total, by_author) {
this.add(total, 'commits', 1); this.add(total, 'commits', 1);
return this.add(by_author, 'commits', 1); return this.add(by_author, 'commits', 1);
}, },
add: function(collection, field, value) { add(collection, field, value) {
if (collection[field] == null) { if (collection[field] == null) {
collection[field] = 0; collection[field] = 0;
} }
return (collection[field] += value); return (collection[field] += value);
}, },
store_additions: function(entry, total, by_author) { store_additions(entry, total, by_author) {
if (entry.additions == null) { if (entry.additions == null) {
entry.additions = 0; entry.additions = 0;
} }
this.add(total, 'additions', entry.additions); this.add(total, 'additions', entry.additions);
return this.add(by_author, 'additions', entry.additions); return this.add(by_author, 'additions', entry.additions);
}, },
store_deletions: function(entry, total, by_author) { store_deletions(entry, total, by_author) {
if (entry.deletions == null) { if (entry.deletions == null) {
entry.deletions = 0; entry.deletions = 0;
} }
this.add(total, 'deletions', entry.deletions); this.add(total, 'deletions', entry.deletions);
return this.add(by_author, 'deletions', entry.deletions); return this.add(by_author, 'deletions', entry.deletions);
}, },
get_total_data: function(parsed_log, field) { get_total_data(parsed_log, field) {
var log, total_data; var log, total_data;
log = parsed_log.total; log = parsed_log.total;
total_data = this.pick_field(log, field); total_data = this.pick_field(log, field);
...@@ -80,7 +80,7 @@ export default { ...@@ -80,7 +80,7 @@ export default {
return d.date; return d.date;
}); });
}, },
pick_field: function(log, field) { pick_field(log, field) {
var total_data; var total_data;
total_data = []; total_data = [];
_.each(log, function(d) { _.each(log, function(d) {
...@@ -88,7 +88,7 @@ export default { ...@@ -88,7 +88,7 @@ export default {
}); });
return total_data; return total_data;
}, },
get_author_data: function(parsed_log, field, date_range) { get_author_data(parsed_log, field, date_range) {
var author_data, log; var author_data, log;
if (date_range == null) { if (date_range == null) {
date_range = null; date_range = null;
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
return d[field]; return d[field];
}).reverse(); }).reverse();
}, },
parse_log_entry: function(log_entry, field, date_range) { parse_log_entry(log_entry, field, date_range) {
var parsed_entry; var parsed_entry;
parsed_entry = {}; parsed_entry = {};
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
); );
return parsed_entry; return parsed_entry;
}, },
in_range: function(date, date_range) { in_range(date, date_range) {
var ref; var ref;
if (date_range === null || (date_range[0] <= (ref = new Date(date)) && ref <= date_range[1])) { if (date_range === null || (date_range[0] <= (ref = new Date(date)) && ref <= date_range[1])) {
return true; return true;
......
/* eslint-disable func-names, no-var, no-return-assign, object-shorthand, vars-on-top */ /* eslint-disable func-names, no-var, no-return-assign, vars-on-top */
import $ from 'jquery'; import $ from 'jquery';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
...@@ -123,7 +123,7 @@ export default class Project { ...@@ -123,7 +123,7 @@ export default class Project {
filterByText: true, filterByText: true,
inputFieldName: $dropdown.data('inputFieldName'), inputFieldName: $dropdown.data('inputFieldName'),
fieldName, fieldName,
renderRow: function(ref) { renderRow(ref) {
var li = refListItem.cloneNode(false); var li = refListItem.cloneNode(false);
if (ref.header != null) { if (ref.header != null) {
...@@ -144,13 +144,13 @@ export default class Project { ...@@ -144,13 +144,13 @@ export default class Project {
return li; return li;
}, },
id: function(obj, $el) { id(obj, $el) {
return $el.attr('data-ref'); return $el.attr('data-ref');
}, },
toggleLabel: function(obj, $el) { toggleLabel(obj, $el) {
return $el.text().trim(); return $el.text().trim();
}, },
clicked: function(options) { clicked(options) {
const { e } = options; const { e } = options;
e.preventDefault(); e.preventDefault();
if ($(`input[name="${fieldName}"]`).length) { if ($(`input[name="${fieldName}"]`).length) {
......
/* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-return-assign, object-shorthand, one-var, consistent-return, class-methods-use-this */ /* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-return-assign, one-var, consistent-return, class-methods-use-this */
import $ from 'jquery'; import $ from 'jquery';
import 'cropper'; import 'cropper';
...@@ -100,7 +100,7 @@ import _ from 'underscore'; ...@@ -100,7 +100,7 @@ import _ from 'underscore';
cropBoxMovable: false, cropBoxMovable: false,
cropBoxResizable: false, cropBoxResizable: false,
toggleDragModeOnDblclick: false, toggleDragModeOnDblclick: false,
built: function() { built() {
const $image = $(this); const $image = $(this);
const container = $image.cropper('getContainerData'); const container = $image.cropper('getContainerData');
const { cropBoxWidth, cropBoxHeight } = _this; const { cropBoxWidth, cropBoxHeight } = _this;
......
/* eslint-disable func-names, no-var, object-shorthand, one-var, no-else-return */ /* eslint-disable func-names, no-var, one-var, no-else-return */
import $ from 'jquery'; import $ from 'jquery';
import Api from './api'; import Api from './api';
...@@ -28,7 +28,7 @@ export default function projectSelect() { ...@@ -28,7 +28,7 @@ export default function projectSelect() {
} }
$(select).select2({ $(select).select2({
placeholder: placeholder, placeholder,
minimumInputLength: 0, minimumInputLength: 0,
query: (function(_this) { query: (function(_this) {
return function(query) { return function(query) {
...@@ -79,18 +79,18 @@ export default function projectSelect() { ...@@ -79,18 +79,18 @@ export default function projectSelect() {
} }
}; };
})(this), })(this),
id: function(project) { id(project) {
if (simpleFilter) return project.id; if (simpleFilter) return project.id;
return JSON.stringify({ return JSON.stringify({
name: project.name, name: project.name,
url: project.web_url, url: project.web_url,
}); });
}, },
text: function(project) { text(project) {
return project.name_with_namespace || project.name; return project.name_with_namespace || project.name;
}, },
initSelection: function(el, callback) { initSelection(el, callback) {
return Api.project(el.val()).then(({ data }) => callback(data)); return Api.project(el.val()).then(({ data }) => callback(data));
}, },
......
/* eslint-disable no-return-assign, one-var, no-var, consistent-return, object-shorthand, prefer-template, class-methods-use-this, no-lonely-if, vars-on-top */ /* eslint-disable no-return-assign, one-var, no-var, consistent-return, prefer-template, class-methods-use-this, no-lonely-if, vars-on-top */
import $ from 'jquery'; import $ from 'jquery';
import { escape, throttle } from 'underscore'; import { escape, throttle } from 'underscore';
...@@ -171,7 +171,7 @@ export class SearchAutocomplete { ...@@ -171,7 +171,7 @@ export class SearchAutocomplete {
params: { params: {
project_id: this.projectId, project_id: this.projectId,
project_ref: this.projectRef, project_ref: this.projectRef,
term: term, term,
}, },
}) })
.then(response => { .then(response => {
......
/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, object-shorthand, 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, 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 */
/* global Issuable */ /* global Issuable */
/* global emitSidebarEvent */ /* global emitSidebarEvent */
...@@ -248,8 +248,8 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -248,8 +248,8 @@ function UsersSelect(currentUser, els, options = {}) {
})}</span> <% } %>`, })}</span> <% } %>`,
); );
return $dropdown.glDropdown({ return $dropdown.glDropdown({
showMenuAbove: showMenuAbove, showMenuAbove,
data: function(term, callback) { data(term, callback) {
return _this.users( return _this.users(
term, term,
options, options,
...@@ -261,7 +261,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -261,7 +261,7 @@ function UsersSelect(currentUser, els, options = {}) {
}.bind(this), }.bind(this),
); );
}, },
processData: function(term, data, callback) { processData(term, data, callback) {
let users = data; let users = data;
// Only show assigned user list when there is no search term // Only show assigned user list when there is no search term
...@@ -326,7 +326,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -326,7 +326,7 @@ function UsersSelect(currentUser, els, options = {}) {
} }
anyUser = { anyUser = {
beforeDivider: true, beforeDivider: true,
name: name, name,
id: null, id: null,
}; };
users.unshift(anyUser); users.unshift(anyUser);
...@@ -376,7 +376,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -376,7 +376,7 @@ function UsersSelect(currentUser, els, options = {}) {
}, },
selectable: true, selectable: true,
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
toggleLabel: function(selected, el, glDropdown) { toggleLabel(selected, el, glDropdown) {
const inputValue = glDropdown.filterInput.val(); const inputValue = glDropdown.filterInput.val();
if (this.multiSelect && inputValue === '') { if (this.multiSelect && inputValue === '') {
...@@ -404,8 +404,8 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -404,8 +404,8 @@ function UsersSelect(currentUser, els, options = {}) {
return defaultLabel; return defaultLabel;
} }
}, },
defaultLabel: defaultLabel, defaultLabel,
hidden: function() { hidden() {
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
emitSidebarEvent('sidebar.saveAssignees'); emitSidebarEvent('sidebar.saveAssignees');
} }
...@@ -422,7 +422,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -422,7 +422,7 @@ function UsersSelect(currentUser, els, options = {}) {
}, },
multiSelect: $dropdown.hasClass('js-multiselect'), multiSelect: $dropdown.hasClass('js-multiselect'),
inputMeta: $dropdown.data('inputMeta'), inputMeta: $dropdown.data('inputMeta'),
clicked: function(options) { clicked(options) {
const { $el, e, isMarking } = options; const { $el, e, isMarking } = options;
const user = options.selectedObj; const user = options.selectedObj;
...@@ -522,10 +522,10 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -522,10 +522,10 @@ function UsersSelect(currentUser, els, options = {}) {
$dropdown.dropdown('toggle'); $dropdown.dropdown('toggle');
} }
}, },
id: function(user) { id(user) {
return user.id; return user.id;
}, },
opened: function(e) { opened(e) {
const $el = $(e.currentTarget); const $el = $(e.currentTarget);
const selected = getSelected(); const selected = getSelected();
if ($dropdown.hasClass('js-issue-board-sidebar') && selected.length === 0) { if ($dropdown.hasClass('js-issue-board-sidebar') && selected.length === 0) {
...@@ -546,7 +546,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -546,7 +546,7 @@ function UsersSelect(currentUser, els, options = {}) {
} }
}, },
updateLabel: $dropdown.data('dropdownTitle'), updateLabel: $dropdown.data('dropdownTitle'),
renderRow: function(user) { renderRow(user) {
var avatar, img, username; var avatar, img, username;
username = user.username ? '@' + user.username : ''; username = user.username ? '@' + user.username : '';
avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url; avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url;
...@@ -605,7 +605,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -605,7 +605,7 @@ function UsersSelect(currentUser, els, options = {}) {
placeholder: __('Search for a user'), placeholder: __('Search for a user'),
multiple: $(select).hasClass('multiselect'), multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0, minimumInputLength: 0,
query: function(query) { query(query) {
return _this.users(query.term, options, function(users) { return _this.users(query.term, options, function(users) {
var anyUser, data, emailUser, index, len, name, nullUser, obj, ref; var anyUser, data, emailUser, index, len, name, nullUser, obj, ref;
data = { data = {
...@@ -638,7 +638,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -638,7 +638,7 @@ function UsersSelect(currentUser, els, options = {}) {
name = s__('UsersSelect|Any User'); name = s__('UsersSelect|Any User');
} }
anyUser = { anyUser = {
name: name, name,
id: null, id: null,
}; };
data.results.unshift(anyUser); data.results.unshift(anyUser);
...@@ -661,24 +661,24 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -661,24 +661,24 @@ function UsersSelect(currentUser, els, options = {}) {
return query.callback(data); return query.callback(data);
}); });
}, },
initSelection: function() { initSelection() {
var args; var args;
args = 1 <= arguments.length ? [].slice.call(arguments, 0) : []; args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
return _this.initSelection.apply(_this, args); return _this.initSelection.apply(_this, args);
}, },
formatResult: function() { formatResult() {
var args; var args;
args = 1 <= arguments.length ? [].slice.call(arguments, 0) : []; args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
return _this.formatResult.apply(_this, args); return _this.formatResult.apply(_this, args);
}, },
formatSelection: function() { formatSelection() {
var args; var args;
args = 1 <= arguments.length ? [].slice.call(arguments, 0) : []; args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
return _this.formatSelection.apply(_this, args); return _this.formatSelection.apply(_this, args);
}, },
dropdownCssClass: 'ajax-users-dropdown', dropdownCssClass: 'ajax-users-dropdown',
// we do not want to escape markup since we are displaying html in results // we do not want to escape markup since we are displaying html in results
escapeMarkup: function(m) { escapeMarkup(m) {
return m; return m;
}, },
}); });
......
/* eslint-disable prefer-arrow-callback, no-var, one-var, object-shorthand, consistent-return, func-names */ /* eslint-disable prefer-arrow-callback, no-var, one-var, consistent-return, func-names */
import $ from 'jquery'; import $ from 'jquery';
import Api from 'ee/api'; import Api from 'ee/api';
...@@ -16,12 +16,12 @@ export default function initLDAPGroupsSelect() { ...@@ -16,12 +16,12 @@ export default function initLDAPGroupsSelect() {
.then(() => { .then(() => {
$('.ajax-ldap-groups-select').each(function(i, select) { $('.ajax-ldap-groups-select').each(function(i, select) {
return $(select).select2({ return $(select).select2({
id: function(group) { id(group) {
return group.cn; return group.cn;
}, },
placeholder: __('Search for a LDAP group'), placeholder: __('Search for a LDAP group'),
minimumInputLength: 1, minimumInputLength: 1,
query: function(query) { query(query) {
var provider; var provider;
provider = $('#ldap_group_link_provider').val(); provider = $('#ldap_group_link_provider').val();
return Api.ldapGroups(query.term, provider, function(groups) { return Api.ldapGroups(query.term, provider, function(groups) {
...@@ -32,7 +32,7 @@ export default function initLDAPGroupsSelect() { ...@@ -32,7 +32,7 @@ export default function initLDAPGroupsSelect() {
return query.callback(data); return query.callback(data);
}); });
}, },
initSelection: function(element, callback) { initSelection(element, callback) {
var id; var id;
id = $(element).val(); id = $(element).val();
if (id !== '') { if (id !== '') {
...@@ -44,7 +44,7 @@ export default function initLDAPGroupsSelect() { ...@@ -44,7 +44,7 @@ export default function initLDAPGroupsSelect() {
formatResult: ldapGroupResult, formatResult: ldapGroupResult,
formatSelection: groupFormatSelection, formatSelection: groupFormatSelection,
dropdownCssClass: 'ajax-groups-dropdown', dropdownCssClass: 'ajax-groups-dropdown',
formatNoMatches: function() { formatNoMatches() {
return __('Match not found; try refining your search query.'); return __('Match not found; try refining your search query.');
}, },
}); });
......
/* eslint-disable no-var, func-names, object-shorthand, one-var, prefer-arrow-callback, prefer-template, no-else-return */ /* eslint-disable no-var, func-names, one-var, prefer-arrow-callback, prefer-template, no-else-return */
import $ from 'jquery'; import $ from 'jquery';
import Api from '~/api'; import Api from '~/api';
...@@ -14,7 +14,7 @@ function AdminEmailSelect() { ...@@ -14,7 +14,7 @@ function AdminEmailSelect() {
placeholder: __('Select group or project'), placeholder: __('Select group or project'),
multiple: $(select).hasClass('multiselect'), multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0, minimumInputLength: 0,
query: function(query) { query(query) {
const groupsFetch = Api.groups(query.term, {}); const groupsFetch = Api.groups(query.term, {});
const projectsFetch = Api.projects(query.term, { const projectsFetch = Api.projects(query.term, {
order_by: 'id', order_by: 'id',
...@@ -31,7 +31,7 @@ function AdminEmailSelect() { ...@@ -31,7 +31,7 @@ function AdminEmailSelect() {
}); });
}); });
}, },
id: function(object) { id(object) {
if (object.path_with_namespace) { if (object.path_with_namespace) {
return 'project-' + object.id; return 'project-' + object.id;
} else if (object.path) { } else if (object.path) {
...@@ -47,7 +47,7 @@ function AdminEmailSelect() { ...@@ -47,7 +47,7 @@ function AdminEmailSelect() {
return _this.formatSelection(...args); return _this.formatSelection(...args);
}, },
dropdownCssClass: 'ajax-admin-email-dropdown', dropdownCssClass: 'ajax-admin-email-dropdown',
escapeMarkup: function(m) { escapeMarkup(m) {
return m; return m;
}, },
}); });
......
/* eslint-disable prefer-arrow-callback, one-var, no-var, object-shorthand, no-shadow, no-else-return, func-names */ /* eslint-disable prefer-arrow-callback, one-var, no-var, no-shadow, no-else-return, func-names */
import $ from 'jquery'; import $ from 'jquery';
import '~/gl_dropdown'; import '~/gl_dropdown';
...@@ -23,21 +23,21 @@ function WeightSelect(els, options = {}) { ...@@ -23,21 +23,21 @@ function WeightSelect(els, options = {}) {
return $dropdown.glDropdown({ return $dropdown.glDropdown({
selectable: true, selectable: true,
fieldName, fieldName,
toggleLabel: function(selected, el) { toggleLabel(selected, el) {
return $(el).data('id'); return $(el).data('id');
}, },
hidden: function() { hidden() {
$selectbox.hide(); $selectbox.hide();
return $value.css('display', ''); return $value.css('display', '');
}, },
id: function(obj, el) { id(obj, el) {
if ($(el).data('none') == null) { if ($(el).data('none') == null) {
return $(el).data('id'); return $(el).data('id');
} else { } else {
return ''; return '';
} }
}, },
clicked: function(glDropdownEvt) { clicked(glDropdownEvt) {
const { e } = glDropdownEvt; const { e } = glDropdownEvt;
let selected = glDropdownEvt.selectedObj; let selected = glDropdownEvt.selectedObj;
const inputField = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`); const inputField = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`);
......
/* eslint-disable no-var, object-shorthand */ /* eslint-disable no-var */
import $ from 'jquery'; import $ from 'jquery';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
...@@ -28,7 +28,7 @@ describe('MergeRequestTabs', function() { ...@@ -28,7 +28,7 @@ describe('MergeRequestTabs', function() {
beforeEach(function() { beforeEach(function() {
mrPageMock = initMrPage(); mrPageMock = initMrPage();
this.class = new MergeRequestTabs({ stubLocation: stubLocation }); this.class = new MergeRequestTabs({ stubLocation });
setLocation(); setLocation();
this.spies = { this.spies = {
...@@ -57,10 +57,10 @@ describe('MergeRequestTabs', function() { ...@@ -57,10 +57,10 @@ describe('MergeRequestTabs', function() {
metaKey: false, metaKey: false,
ctrlKey: false, ctrlKey: false,
which: 1, which: 1,
stopImmediatePropagation: function() {}, stopImmediatePropagation() {},
preventDefault: function() {}, preventDefault() {},
currentTarget: { currentTarget: {
getAttribute: function(attr) { getAttribute(attr) {
return attr === 'href' ? tabUrl : null; return attr === 'href' ? tabUrl : null;
}, },
}, },
......
/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, object-shorthand, vars-on-top */ /* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, vars-on-top */
import $ from 'jquery'; import $ from 'jquery';
import '~/gl_dropdown'; import '~/gl_dropdown';
...@@ -91,7 +91,7 @@ describe('Search autocomplete dropdown', () => { ...@@ -91,7 +91,7 @@ describe('Search autocomplete dropdown', () => {
'gitlab-ce': { 'gitlab-ce': {
issuesPath: projectIssuesPath, issuesPath: projectIssuesPath,
mrPath: projectMRsPath, mrPath: projectMRsPath,
projectName: projectName, projectName,
}, },
}); });
}; };
......
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