Commit 52910eb0 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'leipert-no-unused-vars' into 'master'

Fix all instances of no-unused-vars

See merge request gitlab-org/gitlab!16684
parents d07defde 42033203
/* eslint-disable class-methods-use-this, no-unused-vars */ /* eslint-disable class-methods-use-this */
import $ from 'jquery'; import $ from 'jquery';
...@@ -61,7 +61,7 @@ export default class TemplateSelector { ...@@ -61,7 +61,7 @@ export default class TemplateSelector {
return this.requestFile(item); return this.requestFile(item);
} }
requestFile(item) { requestFile() {
// This `requestFile` method is an abstract method that should // This `requestFile` method is an abstract method that should
// be added by all subclasses. // be added by all subclasses.
} }
......
/* eslint-disable func-names, no-var, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, one-var, no-unused-vars, no-return-assign, no-unused-expressions, no-sequences */ /* 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 */
import $ from 'jquery'; import $ from 'jquery';
...@@ -12,11 +12,8 @@ export default class ImageFile { ...@@ -12,11 +12,8 @@ export default class ImageFile {
this.requestImageInfo( this.requestImageInfo(
$('.two-up.view .frame.deleted img', this.file), $('.two-up.view .frame.deleted img', this.file),
(function(_this) { (function(_this) {
return function(deletedWidth, deletedHeight) { 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), function() {
width,
height,
) {
_this.initViewModes(); _this.initViewModes();
// Load two-up view after images are loaded // Load two-up view after images are loaded
...@@ -112,7 +109,7 @@ export default class ImageFile { ...@@ -112,7 +109,7 @@ export default class ImageFile {
maxHeight = 0; maxHeight = 0;
$('.frame', view) $('.frame', view)
.each( .each(
(function(_this) { (function() {
return function(index, frame) { return function(index, frame) {
var height, width; var height, width;
width = $(frame).width(); width = $(frame).width();
...@@ -196,13 +193,7 @@ export default class ImageFile { ...@@ -196,13 +193,7 @@ export default class ImageFile {
return $('.onion-skin.view', this.file).each( return $('.onion-skin.view', this.file).each(
(function(_this) { (function(_this) {
return function(index, view) { return function(index, view) {
var $frame, var $frame, $track, $dragger, $frameAdded, framePadding, ref;
$track,
$dragger,
$frameAdded,
framePadding,
ref,
dragging = false;
(ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref); (ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref);
$frame = $('.onion-skin-frame', view); $frame = $('.onion-skin-frame', view);
$frameAdded = $('.frame.added', view); $frameAdded = $('.frame.added', view);
......
/* eslint-disable func-names, no-underscore-dangle, no-var, one-var, vars-on-top, no-unused-vars, 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, 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 */
/* global fuzzaldrinPlus */
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
...@@ -66,12 +65,10 @@ GitLabDropdownInput = (function() { ...@@ -66,12 +65,10 @@ GitLabDropdownInput = (function() {
})(); })();
GitLabDropdownFilter = (function() { GitLabDropdownFilter = (function() {
var ARROW_KEY_CODES, BLUR_KEYCODES, HAS_VALUE_CLASS; var BLUR_KEYCODES, HAS_VALUE_CLASS;
BLUR_KEYCODES = [27, 40]; BLUR_KEYCODES = [27, 40];
ARROW_KEY_CODES = [38, 40];
HAS_VALUE_CLASS = 'has-value'; HAS_VALUE_CLASS = 'has-value';
function GitLabDropdownFilter(input, options) { function GitLabDropdownFilter(input, options) {
...@@ -877,9 +874,8 @@ GitLabDropdown = (function() { ...@@ -877,9 +874,8 @@ GitLabDropdown = (function() {
}; };
GitLabDropdown.prototype.addArrowKeyEvent = function() { GitLabDropdown.prototype.addArrowKeyEvent = function() {
var $input, ARROW_KEY_CODES, selector; var ARROW_KEY_CODES, selector;
ARROW_KEY_CODES = [38, 40]; ARROW_KEY_CODES = [38, 40];
$input = this.dropdown.find('.dropdown-input-field');
selector = SELECTABLE_CLASSES; selector = SELECTABLE_CLASSES;
if (this.dropdown.find('.dropdown-toggle-page').length) { if (this.dropdown.find('.dropdown-toggle-page').length) {
selector = '.dropdown-page-one ' + selector; selector = '.dropdown-page-one ' + selector;
......
/* eslint-disable no-var, one-var, no-unused-vars, consistent-return */ /* eslint-disable no-var, one-var, consistent-return */
import $ from 'jquery'; import $ from 'jquery';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import { addDelimiter } from './lib/utils/text_utility'; import { addDelimiter } from './lib/utils/text_utility';
import flash from './flash'; import flash from './flash';
import TaskList from './task_list';
import CreateMergeRequestDropdown from './create_merge_request_dropdown'; import CreateMergeRequestDropdown from './create_merge_request_dropdown';
import IssuablesHelper from './helpers/issuables_helper'; import IssuablesHelper from './helpers/issuables_helper';
import { __ } from './locale'; import { __ } from './locale';
......
/* eslint-disable class-methods-use-this, no-underscore-dangle, no-param-reassign, no-unused-vars, func-names */ /* eslint-disable class-methods-use-this, no-underscore-dangle, no-param-reassign, func-names */
import $ from 'jquery'; import $ from 'jquery';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
...@@ -50,7 +50,7 @@ export default class LabelManager { ...@@ -50,7 +50,7 @@ export default class LabelManager {
$(e.currentTarget).tooltip('hide'); $(e.currentTarget).tooltip('hide');
} }
toggleEmptyState($label, $btn, action) { toggleEmptyState() {
this.emptyState.classList.toggle( this.emptyState.classList.toggle(
'hidden', 'hidden',
Boolean(this.prioritizedLabels[0].querySelector(':scope > li')), Boolean(this.prioritizedLabels[0].querySelector(':scope > li')),
...@@ -61,7 +61,6 @@ export default class LabelManager { ...@@ -61,7 +61,6 @@ export default class LabelManager {
if (persistState == null) { if (persistState == null) {
persistState = true; persistState = true;
} }
const _this = this;
const url = $label.find('.js-toggle-priority').data('url'); const url = $label.find('.js-toggle-priority').data('url');
let $target = this.prioritizedLabels; let $target = this.prioritizedLabels;
let $from = this.otherLabels; let $from = this.otherLabels;
......
/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, no-unused-vars, 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, object-shorthand, 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 */
...@@ -26,7 +26,6 @@ export default class LabelsSelect { ...@@ -26,7 +26,6 @@ export default class LabelsSelect {
$els.each(function(i, dropdown) { $els.each(function(i, dropdown) {
var $block, var $block,
$colorPreview,
$dropdown, $dropdown,
$form, $form,
$loading, $loading,
...@@ -35,8 +34,6 @@ export default class LabelsSelect { ...@@ -35,8 +34,6 @@ export default class LabelsSelect {
$value, $value,
abilityName, abilityName,
defaultLabel, defaultLabel,
enableLabelCreateButton,
issueURLSplit,
issueUpdateURL, issueUpdateURL,
labelUrl, labelUrl,
namespacePath, namespacePath,
...@@ -47,16 +44,11 @@ export default class LabelsSelect { ...@@ -47,16 +44,11 @@ export default class LabelsSelect {
showNo, showNo,
$sidebarLabelTooltip, $sidebarLabelTooltip,
initialSelected, initialSelected,
$toggleText,
fieldName, fieldName,
useId,
propertyName,
showMenuAbove, showMenuAbove,
$container,
$dropdownContainer; $dropdownContainer;
$dropdown = $(dropdown); $dropdown = $(dropdown);
$dropdownContainer = $dropdown.closest('.labels-filter'); $dropdownContainer = $dropdown.closest('.labels-filter');
$toggleText = $dropdown.find('.dropdown-toggle-text');
namespacePath = $dropdown.data('namespacePath'); namespacePath = $dropdown.data('namespacePath');
projectPath = $dropdown.data('projectPath'); projectPath = $dropdown.data('projectPath');
issueUpdateURL = $dropdown.data('issueUpdate'); issueUpdateURL = $dropdown.data('issueUpdate');
...@@ -77,10 +69,6 @@ export default class LabelsSelect { ...@@ -77,10 +69,6 @@ export default class LabelsSelect {
$value = $block.find('.value'); $value = $block.find('.value');
$loading = $block.find('.block-loading').fadeOut(); $loading = $block.find('.block-loading').fadeOut();
fieldName = $dropdown.data('fieldName'); fieldName = $dropdown.data('fieldName');
useId = $dropdown.is(
'.js-issuable-form-dropdown, .js-filter-bulk-update, .js-label-sidebar-dropdown',
);
propertyName = useId ? 'id' : 'title';
initialSelected = $selectbox initialSelected = $selectbox
.find('input[name="' + $dropdown.data('fieldName') + '"]') .find('input[name="' + $dropdown.data('fieldName') + '"]')
.map(function() { .map(function() {
...@@ -124,7 +112,7 @@ export default class LabelsSelect { ...@@ -124,7 +112,7 @@ export default class LabelsSelect {
axios axios
.put(issueUpdateURL, data) .put(issueUpdateURL, data)
.then(({ data }) => { .then(({ data }) => {
var labelCount, template, labelTooltipTitle, labelTitles, formattedLabels; var labelCount, template, labelTooltipTitle, labelTitles;
$loading.fadeOut(); $loading.fadeOut();
$dropdown.trigger('loaded.gl.dropdown'); $dropdown.trigger('loaded.gl.dropdown');
$selectbox.hide(); $selectbox.hide();
...@@ -246,12 +234,10 @@ export default class LabelsSelect { ...@@ -246,12 +234,10 @@ export default class LabelsSelect {
renderRow: function(label) { renderRow: function(label) {
var linkEl, var linkEl,
listItemEl, listItemEl,
color,
colorEl, colorEl,
indeterminate, indeterminate,
removesAll, removesAll,
selectedClass, selectedClass,
spacing,
i, i,
marked, marked,
dropdownValue; dropdownValue;
...@@ -378,7 +364,7 @@ export default class LabelsSelect { ...@@ -378,7 +364,7 @@ export default class LabelsSelect {
} }
}, },
hidden: function() { hidden: function() {
var isIssueIndex, isMRIndex, page, selectedLabels; var isIssueIndex, isMRIndex, page;
page = $('body').attr('data-page'); page = $('body').attr('data-page');
isIssueIndex = page === 'projects:issues:index'; isIssueIndex = page === 'projects:issues:index';
isMRIndex = page === 'projects:merge_requests:index'; isMRIndex = page === 'projects:merge_requests:index';
...@@ -395,9 +381,6 @@ export default class LabelsSelect { ...@@ -395,9 +381,6 @@ export default class LabelsSelect {
} }
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) { if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) {
selectedLabels = $dropdown
.closest('form')
.find("input:hidden[name='" + $dropdown.data('fieldName') + "']");
Issuable.filterResults($dropdown.closest('form')); Issuable.filterResults($dropdown.closest('form'));
} else if ($dropdown.hasClass('js-filter-submit')) { } else if ($dropdown.hasClass('js-filter-submit')) {
$dropdown.closest('form').submit(); $dropdown.closest('form').submit();
...@@ -495,7 +478,7 @@ export default class LabelsSelect { ...@@ -495,7 +478,7 @@ export default class LabelsSelect {
} }
} }
}, },
opened: function(e) { opened: function() {
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, no-param-reassign, one-var, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, consistent-return, no-unused-vars */ /* eslint-disable func-names, no-var, no-param-reassign, one-var, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, consistent-return */
import $ from 'jquery'; import $ from 'jquery';
import { insertText } from '~/lib/utils/common_utils'; import { insertText } from '~/lib/utils/common_utils';
...@@ -157,7 +157,7 @@ export function insertMarkdownText({ ...@@ -157,7 +157,7 @@ export function insertMarkdownText({
if (tag === LINK_TAG_PATTERN) { if (tag === LINK_TAG_PATTERN) {
if (URL) { if (URL) {
try { try {
const ignoredUrl = new URL(selected); new URL(selected); // eslint-disable-line no-new
// valid url // valid url
tag = '[text]({text})'; tag = '[text]({text})';
select = 'text'; select = 'text';
......
/* eslint-disable one-var, no-unused-vars, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */ /* eslint-disable one-var, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */
/* global Issuable */ /* global Issuable */
/* global ListMilestone */ /* global ListMilestone */
...@@ -37,7 +37,6 @@ export default class MilestoneSelect { ...@@ -37,7 +37,6 @@ export default class MilestoneSelect {
selectedMilestone, selectedMilestone,
selectedMilestoneDefault; selectedMilestoneDefault;
const $dropdown = $(dropdown); const $dropdown = $(dropdown);
const projectId = $dropdown.data('projectId');
const milestonesUrl = $dropdown.data('milestones'); const milestonesUrl = $dropdown.data('milestones');
const issueUpdateURL = $dropdown.data('issueUpdate'); const issueUpdateURL = $dropdown.data('issueUpdate');
const showNo = $dropdown.data('showNo'); const showNo = $dropdown.data('showNo');
...@@ -48,7 +47,6 @@ export default class MilestoneSelect { ...@@ -48,7 +47,6 @@ export default class MilestoneSelect {
const useId = $dropdown.data('useId'); const useId = $dropdown.data('useId');
const defaultLabel = $dropdown.data('defaultLabel'); const defaultLabel = $dropdown.data('defaultLabel');
const defaultNo = $dropdown.data('defaultNo'); const defaultNo = $dropdown.data('defaultNo');
const issuableId = $dropdown.data('issuableId');
const abilityName = $dropdown.data('abilityName'); const abilityName = $dropdown.data('abilityName');
const $selectBox = $dropdown.closest('.selectbox'); const $selectBox = $dropdown.closest('.selectbox');
const $block = $selectBox.closest('.block'); const $block = $selectBox.closest('.block');
...@@ -121,7 +119,7 @@ export default class MilestoneSelect { ...@@ -121,7 +119,7 @@ export default class MilestoneSelect {
fields: ['title'], fields: ['title'],
}, },
selectable: true, selectable: true,
toggleLabel: (selected, el, e) => { toggleLabel: (selected, el) => {
if (selected && 'id' in selected && $(el).hasClass('is-active')) { if (selected && 'id' in selected && $(el).hasClass('is-active')) {
return selected.title; return selected.title;
} else { } else {
...@@ -153,7 +151,7 @@ export default class MilestoneSelect { ...@@ -153,7 +151,7 @@ export default class MilestoneSelect {
}, },
vue: $dropdown.hasClass('js-issue-board-sidebar'), vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: clickEvent => { clicked: clickEvent => {
const { $el, e } = clickEvent; const { e } = clickEvent;
let selected = clickEvent.selectedObj; let selected = clickEvent.selectedObj;
let data, modalStoreFilter; let data, modalStoreFilter;
......
/* eslint-disable func-names, no-var, one-var, no-loop-func, consistent-return, no-unused-vars, prefer-template, prefer-arrow-callback, camelcase */ /* eslint-disable func-names, no-var, one-var, no-loop-func, consistent-return, prefer-template, prefer-arrow-callback, camelcase */
import $ from 'jquery'; import $ from 'jquery';
import { __ } from '../locale'; import { __ } from '../locale';
import axios from '../lib/utils/axios_utils'; import axios from '../lib/utils/axios_utils';
import flash from '../flash';
import Raphael from './raphael'; import Raphael from './raphael';
export default (function() { export default (function() {
...@@ -104,7 +103,7 @@ export default (function() { ...@@ -104,7 +103,7 @@ export default (function() {
}; };
BranchGraph.prototype.buildGraph = function() { BranchGraph.prototype.buildGraph = function() {
var cuday, cumonth, day, j, len, mm, ref; var cuday, cumonth, day, len, mm, ref;
const { r } = this; const { r } = this;
cuday = 0; cuday = 0;
cumonth = ''; cumonth = '';
...@@ -178,7 +177,7 @@ export default (function() { ...@@ -178,7 +177,7 @@ export default (function() {
return $(element).scroll( return $(element).scroll(
(function(_this) { (function(_this) {
return function(event) { return function() {
return _this.renderPartialGraph(); return _this.renderPartialGraph();
}; };
})(this), })(this),
...@@ -214,7 +213,7 @@ export default (function() { ...@@ -214,7 +213,7 @@ export default (function() {
}; };
BranchGraph.prototype.appendLabel = function(x, y, commit) { BranchGraph.prototype.appendLabel = function(x, y, commit) {
var label, rect, shortrefs, text, textbox, triangle; var label, rect, shortrefs, text, textbox;
if (!commit.refs) { if (!commit.refs) {
return; return;
...@@ -239,7 +238,8 @@ export default (function() { ...@@ -239,7 +238,8 @@ export default (function() {
'fill-opacity': 0.5, 'fill-opacity': 0.5,
stroke: 'none', stroke: 'none',
}); });
triangle = r.path(['M', x - 5, y, 'L', x - 15, y - 4, 'L', x - 15, y + 4, 'Z']).attr({ // Generate the triangle right of the tag box
r.path(['M', x - 5, y, 'L', x - 15, y - 4, 'L', x - 15, y + 4, 'Z']).attr({
fill: '#000', fill: '#000',
'fill-opacity': 0.5, 'fill-opacity': 0.5,
stroke: 'none', stroke: 'none',
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
no-unused-expressions, one-var, default-case, no-unused-expressions, one-var, default-case,
prefer-template, consistent-return, no-alert, no-return-assign, prefer-template, consistent-return, no-alert, no-return-assign,
no-param-reassign, prefer-arrow-callback, no-else-return, vars-on-top, no-param-reassign, prefer-arrow-callback, no-else-return, vars-on-top,
no-unused-vars, no-shadow, no-useless-escape, class-methods-use-this */ no-shadow, no-useless-escape, class-methods-use-this */
/* global ResolveService */ /* global ResolveService */
/* global mrRefreshWidgetUrl */
/* /*
old_notes_spec.js is the spec for the legacy, jQuery notes application. It has nothing to do with the new, fancy Vue notes app. old_notes_spec.js is the spec for the legacy, jQuery notes application. It has nothing to do with the new, fancy Vue notes app.
...@@ -37,7 +36,6 @@ import { ...@@ -37,7 +36,6 @@ import {
isMetaKey, isMetaKey,
isInMRPage, isInMRPage,
} from './lib/utils/common_utils'; } from './lib/utils/common_utils';
import imageDiffHelper from './image_diff/helpers/index';
import { localTimeAgo } from './lib/utils/datetime_utility'; import { localTimeAgo } from './lib/utils/datetime_utility';
import { sprintf, s__, __ } from './locale'; import { sprintf, s__, __ } from './locale';
...@@ -683,7 +681,7 @@ export default class Notes { ...@@ -683,7 +681,7 @@ export default class Notes {
); );
} }
updateNoteError($parentTimeline) { updateNoteError() {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Flash( new Flash(
__('Your comment could not be updated! Please check your network connection and try again.'), __('Your comment could not be updated! Please check your network connection and try again.'),
...@@ -697,7 +695,6 @@ export default class Notes { ...@@ -697,7 +695,6 @@ export default class Notes {
*/ */
addDiscussionNote($form, note, isNewDiffComment) { addDiscussionNote($form, note, isNewDiffComment) {
if ($form.attr('data-resolve-all') != null) { if ($form.attr('data-resolve-all') != null) {
var projectPath = $form.data('projectPath');
var discussionId = $form.data('discussionId'); var discussionId = $form.data('discussionId');
var mergeRequestId = $form.data('noteableIid'); var mergeRequestId = $form.data('noteableIid');
...@@ -746,7 +743,6 @@ export default class Notes { ...@@ -746,7 +743,6 @@ export default class Notes {
if (currentContent === initialContent) { if (currentContent === initialContent) {
this.removeNoteEditForm($el); this.removeNoteEditForm($el);
} else { } else {
var $buttons = $el.find('.note-form-actions');
var isWidgetVisible = isInViewport($el.get(0)); var isWidgetVisible = isInViewport($el.get(0));
if (!isWidgetVisible) { if (!isWidgetVisible) {
...@@ -766,7 +762,7 @@ export default class Notes { ...@@ -766,7 +762,7 @@ export default class Notes {
* Replaces the note text with the note edit form * Replaces the note text with the note edit form
* Adds a data attribute to the form with the original content of the note for cancellations * Adds a data attribute to the form with the original content of the note for cancellations
*/ */
showEditForm(e, scrollTo, myLastNote) { showEditForm(e) {
e.preventDefault(); e.preventDefault();
var $target = $(e.target); var $target = $(e.target);
...@@ -850,16 +846,11 @@ export default class Notes { ...@@ -850,16 +846,11 @@ export default class Notes {
* Removes the whole discussion if the last note is being removed. * Removes the whole discussion if the last note is being removed.
*/ */
removeNote(e) { removeNote(e) {
var noteElId, noteId, dataNoteId, $note, lineHolder; var noteElId, $note;
$note = $(e.currentTarget).closest('.note'); $note = $(e.currentTarget).closest('.note');
noteElId = $note.attr('id'); noteElId = $note.attr('id');
noteId = $note.attr('data-note-id');
lineHolder = $(e.currentTarget)
.closest('.notes[data-discussion-id]')
.closest('.notes_holder')
.prev('.line_holder');
$(`.note[id="${noteElId}"]`).each( $(`.note[id="${noteElId}"]`).each(
(function(_this) { (function() {
// A same note appears in the "Discussion" and in the "Changes" tab, we have // A same note appears in the "Discussion" and in the "Changes" tab, we have
// to remove all. Using $('.note[id='noteId']') ensure we get all the notes, // to remove all. Using $('.note[id='noteId']') ensure we get all the notes,
// where $('#noteId') would return only one. // where $('#noteId') would return only one.
...@@ -1064,25 +1055,8 @@ export default class Notes { ...@@ -1064,25 +1055,8 @@ export default class Notes {
this.setupDiscussionNoteForm($link, newForm); this.setupDiscussionNoteForm($link, newForm);
} }
toggleDiffNote({ toggleDiffNote({ target, lineType, forceShow, showReplyInput = false }) {
target, var $link, addForm, hasNotes, newForm, noteForm, replyButton, row, rowCssToAdd;
lineType,
forceShow,
showReplyInput = false,
currentUsername,
currentUserAvatar,
currentUserFullname,
}) {
var $link,
addForm,
hasNotes,
newForm,
noteForm,
replyButton,
row,
rowCssToAdd,
targetContent,
isDiffCommentAvatar;
$link = $(target); $link = $(target);
row = $link.closest('tr'); row = $link.closest('tr');
const nextRow = row.next(); const nextRow = row.next();
...@@ -1515,7 +1489,7 @@ export default class Notes { ...@@ -1515,7 +1489,7 @@ export default class Notes {
let tempFormContent; let tempFormContent;
// Identify executed quick actions from `formContent` // Identify executed quick actions from `formContent`
const executedCommands = availableQuickActions.filter((command, index) => { const executedCommands = availableQuickActions.filter(command => {
const commandRegex = new RegExp(`/${command.name}`); const commandRegex = new RegExp(`/${command.name}`);
return commandRegex.test(formContent); return commandRegex.test(formContent);
}); });
...@@ -1840,8 +1814,6 @@ export default class Notes { ...@@ -1840,8 +1814,6 @@ export default class Notes {
const $noteBody = $editingNote.find('.js-task-list-container'); const $noteBody = $editingNote.find('.js-task-list-container');
const $noteBodyText = $noteBody.find('.note-text'); const $noteBodyText = $noteBody.find('.note-text');
const { formData, formContent, formAction } = this.getFormData($form); const { formData, formContent, formAction } = this.getFormData($form);
const $diffFile = $form.closest('.diff-file');
const $notesContainer = $form.closest('.notes');
// Cache original comment content // Cache original comment content
const cachedNoteBodyText = $noteBodyText.html(); const cachedNoteBodyText = $noteBodyText.html();
......
/* eslint-disable func-names, object-shorthand, no-var, one-var, camelcase, no-param-reassign, no-return-assign, prefer-arrow-callback, consistent-return, no-unused-vars, no-cond-assign, no-else-return */ /* 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 */
import _ from 'underscore'; import _ from 'underscore';
export default { export default {
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
_.each( _.each(
_.omit(log_entry, 'author_name', 'author_email'), _.omit(log_entry, 'author_name', 'author_email'),
(function(_this) { (function(_this) {
return function(value, key) { return function(value) {
if (_this.in_range(value.date, date_range)) { if (_this.in_range(value.date, date_range)) {
parsed_entry.dates[value.date] = value[field]; parsed_entry.dates[value.date] = value[field];
parsed_entry.commits += value.commits; parsed_entry.commits += value.commits;
......
/* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-unused-vars, 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, object-shorthand, one-var, consistent-return, class-methods-use-this */
import $ from 'jquery'; import $ from 'jquery';
import 'cropper'; import 'cropper';
import _ from 'underscore'; import _ from 'underscore';
(global => { (() => {
// Matches everything but the file name // Matches everything but the file name
const FILENAMEREGEX = /^.*[\\\/]/; const FILENAMEREGEX = /^.*[\\\/]/;
...@@ -69,7 +69,7 @@ import _ from 'underscore'; ...@@ -69,7 +69,7 @@ import _ from 'underscore';
this.modalCrop.on('shown.bs.modal', this.onModalShow); this.modalCrop.on('shown.bs.modal', this.onModalShow);
this.modalCrop.on('hidden.bs.modal', this.onModalHide); this.modalCrop.on('hidden.bs.modal', this.onModalHide);
this.uploadImageBtn.on('click', this.onUploadImageBtnClick); this.uploadImageBtn.on('click', this.onUploadImageBtnClick);
this.cropActionsBtn.on('click', function(e) { this.cropActionsBtn.on('click', function() {
var btn; var btn;
btn = this; btn = this;
return _this.onActionBtnClick(btn); return _this.onActionBtnClick(btn);
...@@ -128,10 +128,10 @@ import _ from 'underscore'; ...@@ -128,10 +128,10 @@ import _ from 'underscore';
} }
onActionBtnClick(btn) { onActionBtnClick(btn) {
var data, result; var data;
data = $(btn).data(); data = $(btn).data();
if (this.modalCropImg.data('cropper') && data.method) { if (this.modalCropImg.data('cropper') && data.method) {
return (result = this.modalCropImg.cropper(data.method, data.option)); return this.modalCropImg.cropper(data.method, data.option);
} }
} }
...@@ -151,12 +151,11 @@ import _ from 'underscore'; ...@@ -151,12 +151,11 @@ import _ from 'underscore';
} }
dataURLtoBlob(dataURL) { dataURLtoBlob(dataURL) {
var array, binary, i, len, v; var array, binary, i, len;
binary = atob(dataURL.split(',')[1]); binary = atob(dataURL.split(',')[1]);
array = []; array = [];
for (i = 0, len = binary.length; i < len; i += 1) { for (i = 0, len = binary.length; i < len; i += 1) {
v = binary[i];
array.push(binary.charCodeAt(i)); array.push(binary.charCodeAt(i));
} }
return new Blob([new Uint8Array(array)], { return new Blob([new Uint8Array(array)], {
......
/* eslint-disable func-names, no-var, consistent-return, one-var, no-cond-assign, prefer-template, no-unused-vars, no-return-assign */ /* eslint-disable func-names, no-var, consistent-return, one-var, no-cond-assign, prefer-template, no-return-assign */
import $ from 'jquery'; import $ from 'jquery';
import fuzzaldrinPlus from 'fuzzaldrin-plus'; import fuzzaldrinPlus from 'fuzzaldrin-plus';
...@@ -8,9 +8,8 @@ import { __ } from '~/locale'; ...@@ -8,9 +8,8 @@ import { __ } from '~/locale';
// highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> ) // highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> )
const highlighter = function(element, text, matches) { const highlighter = function(element, text, matches) {
var highlightText, j, lastIndex, len, matchIndex, matchedChars, unmatched; var j, lastIndex, len, matchIndex, matchedChars, unmatched;
lastIndex = 0; lastIndex = 0;
highlightText = '';
matchedChars = []; matchedChars = [];
for (j = 0, len = matches.length; j < len; j += 1) { for (j = 0, len = matches.length; j < len; j += 1) {
matchIndex = matches[j]; matchIndex = matches[j];
......
/* eslint-disable func-names, no-var, no-unused-vars, consistent-return, one-var, prefer-template, no-else-return, no-param-reassign */ /* eslint-disable func-names, no-var, consistent-return, one-var, prefer-template, no-else-return, no-param-reassign */
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
...@@ -7,7 +7,7 @@ import flash from './flash'; ...@@ -7,7 +7,7 @@ import flash from './flash';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import { sprintf, s__, __ } from './locale'; import { sprintf, s__, __ } from './locale';
function Sidebar(currentUser) { function Sidebar() {
this.toggleTodo = this.toggleTodo.bind(this); this.toggleTodo = this.toggleTodo.bind(this);
this.sidebar = $('aside'); this.sidebar = $('aside');
...@@ -15,9 +15,9 @@ function Sidebar(currentUser) { ...@@ -15,9 +15,9 @@ function Sidebar(currentUser) {
this.addEventListeners(); this.addEventListeners();
} }
Sidebar.initialize = function(currentUser) { Sidebar.initialize = function() {
if (!this.instance) { if (!this.instance) {
this.instance = new Sidebar(currentUser); this.instance = new Sidebar();
} }
}; };
...@@ -77,7 +77,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { ...@@ -77,7 +77,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) {
}; };
Sidebar.prototype.toggleTodo = function(e) { Sidebar.prototype.toggleTodo = function(e) {
var $btnText, $this, $todoLoading, ajaxType, url; var $this, ajaxType, url;
$this = $(e.currentTarget); $this = $(e.currentTarget);
ajaxType = $this.data('deletePath') ? 'delete' : 'post'; ajaxType = $this.data('deletePath') ? 'delete' : 'post';
...@@ -140,7 +140,7 @@ Sidebar.prototype.todoUpdateDone = function(data) { ...@@ -140,7 +140,7 @@ Sidebar.prototype.todoUpdateDone = function(data) {
}); });
}; };
Sidebar.prototype.sidebarDropdownLoading = function(e) { Sidebar.prototype.sidebarDropdownLoading = function() {
var $loading, $sidebarCollapsedIcon, i, img; var $loading, $sidebarCollapsedIcon, i, img;
$sidebarCollapsedIcon = $(this) $sidebarCollapsedIcon = $(this)
.closest('.block') .closest('.block')
...@@ -157,7 +157,7 @@ Sidebar.prototype.sidebarDropdownLoading = function(e) { ...@@ -157,7 +157,7 @@ Sidebar.prototype.sidebarDropdownLoading = function(e) {
} }
}; };
Sidebar.prototype.sidebarDropdownLoaded = function(e) { Sidebar.prototype.sidebarDropdownLoaded = function() {
var $sidebarCollapsedIcon, i, img; var $sidebarCollapsedIcon, i, img;
$sidebarCollapsedIcon = $(this) $sidebarCollapsedIcon = $(this)
.closest('.block') .closest('.block')
......
/* eslint-disable no-return-assign, one-var, no-var, no-unused-vars, 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, object-shorthand, 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';
import { s__, __, sprintf } from '~/locale'; import { s__, __ } from '~/locale';
import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper'; import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import DropdownUtils from './filtered_search/dropdown_utils';
import { import {
isInGroupsPage, isInGroupsPage,
isInProjectPage, isInProjectPage,
...@@ -142,7 +141,7 @@ export class SearchAutocomplete { ...@@ -142,7 +141,7 @@ export class SearchAutocomplete {
}); });
} }
getSearchText(selectedObject, el) { getSearchText(selectedObject) {
return selectedObject.id ? selectedObject.text : ''; return selectedObject.id ? selectedObject.text : '';
} }
...@@ -402,7 +401,7 @@ export class SearchAutocomplete { ...@@ -402,7 +401,7 @@ export class SearchAutocomplete {
return this.searchInput.val('').focus(); return this.searchInput.val('').focus();
} }
onSearchInputBlur(e) { onSearchInputBlur() {
this.isFocused = false; this.isFocused = false;
this.wrap.removeClass('search-active'); this.wrap.removeClass('search-active');
// If input is blank then restore state // If input is blank then restore state
......
/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, object-shorthand, no-shadow, no-unused-vars, 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, object-shorthand, 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 */
...@@ -405,7 +405,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -405,7 +405,7 @@ function UsersSelect(currentUser, els, options = {}) {
} }
}, },
defaultLabel: defaultLabel, defaultLabel: defaultLabel,
hidden: function(e) { hidden: function() {
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
emitSidebarEvent('sidebar.saveAssignees'); emitSidebarEvent('sidebar.saveAssignees');
} }
...@@ -442,7 +442,6 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -442,7 +442,6 @@ function UsersSelect(currentUser, els, options = {}) {
if (user.beforeDivider && user.name.toLowerCase() === 'unassigned') { if (user.beforeDivider && user.name.toLowerCase() === 'unassigned') {
// Unassigned selected // Unassigned selected
previouslySelected.each((index, element) => { previouslySelected.each((index, element) => {
const id = parseInt(element.value, 10);
element.remove(); element.remove();
}); });
emitSidebarEvent('sidebar.removeAllAssignees'); emitSidebarEvent('sidebar.removeAllAssignees');
...@@ -548,7 +547,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -548,7 +547,7 @@ function UsersSelect(currentUser, els, options = {}) {
}, },
updateLabel: $dropdown.data('dropdownTitle'), updateLabel: $dropdown.data('dropdownTitle'),
renderRow: function(user) { renderRow: function(user) {
var avatar, img, listClosingTags, listWithName, listWithUserName, 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;
......
/* eslint-disable func-names, prefer-arrow-callback, no-unused-vars, consistent-return, camelcase, class-methods-use-this */ /* eslint-disable func-names, prefer-arrow-callback, consistent-return, camelcase, class-methods-use-this */
// Zen Mode (full screen) textarea // Zen Mode (full screen) textarea
// //
...@@ -62,7 +62,7 @@ export default class ZenMode { ...@@ -62,7 +62,7 @@ export default class ZenMode {
$(document).on( $(document).on(
'zen_mode:leave', 'zen_mode:leave',
(function(_this) { (function(_this) {
return function(e) { return function() {
return _this.exit(); return _this.exit();
}; };
})(this), })(this),
......
/* eslint-disable prefer-arrow-callback, no-var, one-var, object-shorthand, consistent-return, no-unused-vars, func-names */ /* eslint-disable prefer-arrow-callback, no-var, one-var, object-shorthand, consistent-return, func-names */
import $ from 'jquery'; import $ from 'jquery';
import Api from 'ee/api'; import Api from 'ee/api';
...@@ -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(nomatch) { formatNoMatches: function() {
return __('Match not found; try refining your search query.'); return __('Match not found; try refining your search query.');
}, },
}); });
......
/* eslint-disable no-var, func-names, camelcase, no-unused-vars, object-shorthand, one-var, prefer-arrow-callback, prefer-template, no-else-return */ /* eslint-disable no-var, func-names, object-shorthand, one-var, prefer-arrow-callback, prefer-template, no-else-return */
import $ from 'jquery'; import $ from 'jquery';
import Api from '~/api'; import Api from '~/api';
...@@ -10,8 +10,6 @@ function AdminEmailSelect() { ...@@ -10,8 +10,6 @@ function AdminEmailSelect() {
$('.ajax-admin-email-select').each( $('.ajax-admin-email-select').each(
(function(_this) { (function(_this) {
return function(i, select) { return function(i, select) {
var skip_ldap;
skip_ldap = $(select).hasClass('skip_ldap');
return $(select).select2({ return $(select).select2({
placeholder: __('Select group or project'), placeholder: __('Select group or project'),
multiple: $(select).hasClass('multiselect'), multiple: $(select).hasClass('multiselect'),
......
/* eslint-disable prefer-arrow-callback, one-var, no-var, object-shorthand, no-shadow, no-unused-vars, no-else-return, func-names */ /* eslint-disable prefer-arrow-callback, one-var, no-var, object-shorthand, no-shadow, no-else-return, func-names */
import $ from 'jquery'; import $ from 'jquery';
import '~/gl_dropdown'; import '~/gl_dropdown';
...@@ -7,23 +7,12 @@ function WeightSelect(els, options = {}) { ...@@ -7,23 +7,12 @@ function WeightSelect(els, options = {}) {
const $els = $(els || '.js-weight-select'); const $els = $(els || '.js-weight-select');
$els.each(function(i, dropdown) { $els.each(function(i, dropdown) {
var $block, var $block, $dropdown, $selectbox, $value;
$dropdown,
$loading,
$selectbox,
$sidebarCollapsedValue,
$value,
abilityName,
updateUrl,
updateWeight;
$dropdown = $(dropdown); $dropdown = $(dropdown);
updateUrl = $dropdown.data('issueUpdate');
$selectbox = $dropdown.closest('.selectbox'); $selectbox = $dropdown.closest('.selectbox');
$block = $selectbox.closest('.block'); $block = $selectbox.closest('.block');
$sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon span');
$value = $block.find('.value'); $value = $block.find('.value');
abilityName = $dropdown.data('abilityName'); $block.find('.block-loading').fadeOut();
$loading = $block.find('.block-loading').fadeOut();
const fieldName = options.fieldName || $dropdown.data('fieldName'); const fieldName = options.fieldName || $dropdown.data('fieldName');
const inputField = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`); const inputField = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`);
...@@ -37,7 +26,7 @@ function WeightSelect(els, options = {}) { ...@@ -37,7 +26,7 @@ function WeightSelect(els, options = {}) {
toggleLabel: function(selected, el) { toggleLabel: function(selected, el) {
return $(el).data('id'); return $(el).data('id');
}, },
hidden: function(e) { hidden: function() {
$selectbox.hide(); $selectbox.hide();
return $value.css('display', ''); return $value.css('display', '');
}, },
......
/* eslint-disable no-unused-vars */
/* global ListIssue */ /* global ListIssue */
import Vue from 'vue';
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';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
...@@ -190,7 +188,7 @@ describe('Store', () => { ...@@ -190,7 +188,7 @@ describe('Store', () => {
it('moves the position of lists', () => { it('moves the position of lists', () => {
const listOne = boardsStore.addList(listObj); const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate); boardsStore.addList(listObjDuplicate);
expect(boardsStore.state.lists.length).toBe(2); expect(boardsStore.state.lists.length).toBe(2);
......
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