diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-16 12:06:26 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-16 12:06:26 +0000 |
commit | d2798d607e11e0ebae83ae909404834388733428 (patch) | |
tree | 096b7f4d4bdb315d28cdcd4d6db4e80911112e9c /app/assets | |
parent | d8211a0ed119eada7d292e974a8fc7b0cd982d3c (diff) | |
download | gitlab-ce-d2798d607e11e0ebae83ae909404834388733428.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/blob/template_selector.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/commit/image_file.js | 19 | ||||
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 10 | ||||
-rw-r--r-- | app/assets/javascripts/issue.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/label_manager.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js | 25 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/text_markdown.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/milestone_select.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/network/branch_graph.js | 12 | ||||
-rw-r--r-- | app/assets/javascripts/notes.js | 44 | ||||
-rw-r--r-- | app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/profile/gl_crop.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/project_find_file.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/right_sidebar.js | 14 | ||||
-rw-r--r-- | app/assets/javascripts/search_autocomplete.js | 9 | ||||
-rw-r--r-- | app/assets/javascripts/users_select.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/zen_mode.js | 4 |
17 files changed, 62 insertions, 128 deletions
diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js index 37e348d93d3..9e69c7d7164 100644 --- a/app/assets/javascripts/blob/template_selector.js +++ b/app/assets/javascripts/blob/template_selector.js @@ -1,4 +1,4 @@ -/* eslint-disable class-methods-use-this, no-unused-vars */ +/* eslint-disable class-methods-use-this */ import $ from 'jquery'; @@ -61,7 +61,7 @@ export default class TemplateSelector { return this.requestFile(item); } - requestFile(item) { + requestFile() { // This `requestFile` method is an abstract method that should // be added by all subclasses. } diff --git a/app/assets/javascripts/commit/image_file.js b/app/assets/javascripts/commit/image_file.js index bc666aef54b..9454f760df8 100644 --- a/app/assets/javascripts/commit/image_file.js +++ b/app/assets/javascripts/commit/image_file.js @@ -1,4 +1,4 @@ -/* 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'; @@ -12,11 +12,8 @@ export default class ImageFile { this.requestImageInfo( $('.two-up.view .frame.deleted img', this.file), (function(_this) { - return function(deletedWidth, deletedHeight) { - return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function( - width, - height, - ) { + return function() { + return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function() { _this.initViewModes(); // Load two-up view after images are loaded @@ -112,7 +109,7 @@ export default class ImageFile { maxHeight = 0; $('.frame', view) .each( - (function(_this) { + (function() { return function(index, frame) { var height, width; width = $(frame).width(); @@ -196,13 +193,7 @@ export default class ImageFile { return $('.onion-skin.view', this.file).each( (function(_this) { return function(index, view) { - var $frame, - $track, - $dragger, - $frameAdded, - framePadding, - ref, - dragging = false; + var $frame, $track, $dragger, $frameAdded, framePadding, ref; (ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref); $frame = $('.onion-skin-frame', view); $frameAdded = $('.frame.added', view); diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 515402fc506..f49246cf07b 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -1,5 +1,4 @@ -/* 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 */ -/* global fuzzaldrinPlus */ +/* 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 */ import $ from 'jquery'; import _ from 'underscore'; @@ -66,12 +65,10 @@ GitLabDropdownInput = (function() { })(); GitLabDropdownFilter = (function() { - var ARROW_KEY_CODES, BLUR_KEYCODES, HAS_VALUE_CLASS; + var BLUR_KEYCODES, HAS_VALUE_CLASS; BLUR_KEYCODES = [27, 40]; - ARROW_KEY_CODES = [38, 40]; - HAS_VALUE_CLASS = 'has-value'; function GitLabDropdownFilter(input, options) { @@ -877,9 +874,8 @@ GitLabDropdown = (function() { }; GitLabDropdown.prototype.addArrowKeyEvent = function() { - var $input, ARROW_KEY_CODES, selector; + var ARROW_KEY_CODES, selector; ARROW_KEY_CODES = [38, 40]; - $input = this.dropdown.find('.dropdown-input-field'); selector = SELECTABLE_CLASSES; if (this.dropdown.find('.dropdown-toggle-page').length) { selector = '.dropdown-page-one ' + selector; diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index db4607ca58d..a9e086fade8 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -1,10 +1,9 @@ -/* eslint-disable no-var, one-var, no-unused-vars, consistent-return */ +/* eslint-disable no-var, one-var, consistent-return */ import $ from 'jquery'; import axios from './lib/utils/axios_utils'; import { addDelimiter } from './lib/utils/text_utility'; import flash from './flash'; -import TaskList from './task_list'; import CreateMergeRequestDropdown from './create_merge_request_dropdown'; import IssuablesHelper from './helpers/issuables_helper'; import { __ } from './locale'; diff --git a/app/assets/javascripts/label_manager.js b/app/assets/javascripts/label_manager.js index 7064731a5ea..5dcc719f7c3 100644 --- a/app/assets/javascripts/label_manager.js +++ b/app/assets/javascripts/label_manager.js @@ -1,4 +1,4 @@ -/* 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 Sortable from 'sortablejs'; @@ -50,7 +50,7 @@ export default class LabelManager { $(e.currentTarget).tooltip('hide'); } - toggleEmptyState($label, $btn, action) { + toggleEmptyState() { this.emptyState.classList.toggle( 'hidden', Boolean(this.prioritizedLabels[0].querySelector(':scope > li')), @@ -61,7 +61,6 @@ export default class LabelManager { if (persistState == null) { persistState = true; } - const _this = this; const url = $label.find('.js-toggle-priority').data('url'); let $target = this.prioritizedLabels; let $from = this.otherLabels; diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index 177aa02b8e0..8cc3bc8373f 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -1,4 +1,4 @@ -/* 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 ListLabel */ @@ -26,7 +26,6 @@ export default class LabelsSelect { $els.each(function(i, dropdown) { var $block, - $colorPreview, $dropdown, $form, $loading, @@ -35,8 +34,6 @@ export default class LabelsSelect { $value, abilityName, defaultLabel, - enableLabelCreateButton, - issueURLSplit, issueUpdateURL, labelUrl, namespacePath, @@ -47,16 +44,11 @@ export default class LabelsSelect { showNo, $sidebarLabelTooltip, initialSelected, - $toggleText, fieldName, - useId, - propertyName, showMenuAbove, - $container, $dropdownContainer; $dropdown = $(dropdown); $dropdownContainer = $dropdown.closest('.labels-filter'); - $toggleText = $dropdown.find('.dropdown-toggle-text'); namespacePath = $dropdown.data('namespacePath'); projectPath = $dropdown.data('projectPath'); issueUpdateURL = $dropdown.data('issueUpdate'); @@ -77,10 +69,6 @@ export default class LabelsSelect { $value = $block.find('.value'); $loading = $block.find('.block-loading').fadeOut(); 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 .find('input[name="' + $dropdown.data('fieldName') + '"]') .map(function() { @@ -124,7 +112,7 @@ export default class LabelsSelect { axios .put(issueUpdateURL, data) .then(({ data }) => { - var labelCount, template, labelTooltipTitle, labelTitles, formattedLabels; + var labelCount, template, labelTooltipTitle, labelTitles; $loading.fadeOut(); $dropdown.trigger('loaded.gl.dropdown'); $selectbox.hide(); @@ -246,12 +234,10 @@ export default class LabelsSelect { renderRow: function(label) { var linkEl, listItemEl, - color, colorEl, indeterminate, removesAll, selectedClass, - spacing, i, marked, dropdownValue; @@ -378,7 +364,7 @@ export default class LabelsSelect { } }, hidden: function() { - var isIssueIndex, isMRIndex, page, selectedLabels; + var isIssueIndex, isMRIndex, page; page = $('body').attr('data-page'); isIssueIndex = page === 'projects:issues:index'; isMRIndex = page === 'projects:merge_requests:index'; @@ -395,9 +381,6 @@ export default class LabelsSelect { } if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) { - selectedLabels = $dropdown - .closest('form') - .find("input:hidden[name='" + $dropdown.data('fieldName') + "']"); Issuable.filterResults($dropdown.closest('form')); } else if ($dropdown.hasClass('js-filter-submit')) { $dropdown.closest('form').submit(); @@ -495,7 +478,7 @@ export default class LabelsSelect { } } }, - opened: function(e) { + opened: function() { if ($dropdown.hasClass('js-issue-board-sidebar')) { const previousSelection = $dropdown.attr('data-selected'); this.selected = previousSelection ? previousSelection.split(',') : []; diff --git a/app/assets/javascripts/lib/utils/text_markdown.js b/app/assets/javascripts/lib/utils/text_markdown.js index b7922e29bb0..7873eaf059f 100644 --- a/app/assets/javascripts/lib/utils/text_markdown.js +++ b/app/assets/javascripts/lib/utils/text_markdown.js @@ -1,4 +1,4 @@ -/* 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 { insertText } from '~/lib/utils/common_utils'; @@ -157,7 +157,7 @@ export function insertMarkdownText({ if (tag === LINK_TAG_PATTERN) { if (URL) { try { - const ignoredUrl = new URL(selected); + new URL(selected); // eslint-disable-line no-new // valid url tag = '[text]({text})'; select = 'text'; diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index 8f077685b07..9c0d55326ee 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -1,4 +1,4 @@ -/* 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 ListMilestone */ @@ -37,7 +37,6 @@ export default class MilestoneSelect { selectedMilestone, selectedMilestoneDefault; const $dropdown = $(dropdown); - const projectId = $dropdown.data('projectId'); const milestonesUrl = $dropdown.data('milestones'); const issueUpdateURL = $dropdown.data('issueUpdate'); const showNo = $dropdown.data('showNo'); @@ -48,7 +47,6 @@ export default class MilestoneSelect { const useId = $dropdown.data('useId'); const defaultLabel = $dropdown.data('defaultLabel'); const defaultNo = $dropdown.data('defaultNo'); - const issuableId = $dropdown.data('issuableId'); const abilityName = $dropdown.data('abilityName'); const $selectBox = $dropdown.closest('.selectbox'); const $block = $selectBox.closest('.block'); @@ -121,7 +119,7 @@ export default class MilestoneSelect { fields: ['title'], }, selectable: true, - toggleLabel: (selected, el, e) => { + toggleLabel: (selected, el) => { if (selected && 'id' in selected && $(el).hasClass('is-active')) { return selected.title; } else { @@ -153,7 +151,7 @@ export default class MilestoneSelect { }, vue: $dropdown.hasClass('js-issue-board-sidebar'), clicked: clickEvent => { - const { $el, e } = clickEvent; + const { e } = clickEvent; let selected = clickEvent.selectedObj; let data, modalStoreFilter; diff --git a/app/assets/javascripts/network/branch_graph.js b/app/assets/javascripts/network/branch_graph.js index d1fa9f5e2a2..fcfc2570b3d 100644 --- a/app/assets/javascripts/network/branch_graph.js +++ b/app/assets/javascripts/network/branch_graph.js @@ -1,9 +1,8 @@ -/* 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 '../locale'; import axios from '../lib/utils/axios_utils'; -import flash from '../flash'; import Raphael from './raphael'; export default (function() { @@ -104,7 +103,7 @@ export default (function() { }; BranchGraph.prototype.buildGraph = function() { - var cuday, cumonth, day, j, len, mm, ref; + var cuday, cumonth, day, len, mm, ref; const { r } = this; cuday = 0; cumonth = ''; @@ -178,7 +177,7 @@ export default (function() { return $(element).scroll( (function(_this) { - return function(event) { + return function() { return _this.renderPartialGraph(); }; })(this), @@ -214,7 +213,7 @@ export default (function() { }; BranchGraph.prototype.appendLabel = function(x, y, commit) { - var label, rect, shortrefs, text, textbox, triangle; + var label, rect, shortrefs, text, textbox; if (!commit.refs) { return; @@ -239,7 +238,8 @@ export default (function() { 'fill-opacity': 0.5, 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-opacity': 0.5, stroke: 'none', diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 9cc31e26648..9cc56b34c75 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -2,10 +2,9 @@ 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-unused-vars, no-shadow, no-useless-escape, class-methods-use-this */ +no-shadow, no-useless-escape, class-methods-use-this */ /* 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. @@ -37,7 +36,6 @@ import { isMetaKey, isInMRPage, } from './lib/utils/common_utils'; -import imageDiffHelper from './image_diff/helpers/index'; import { localTimeAgo } from './lib/utils/datetime_utility'; import { sprintf, s__, __ } from './locale'; @@ -683,7 +681,7 @@ export default class Notes { ); } - updateNoteError($parentTimeline) { + updateNoteError() { // eslint-disable-next-line no-new new Flash( __('Your comment could not be updated! Please check your network connection and try again.'), @@ -697,7 +695,6 @@ export default class Notes { */ addDiscussionNote($form, note, isNewDiffComment) { if ($form.attr('data-resolve-all') != null) { - var projectPath = $form.data('projectPath'); var discussionId = $form.data('discussionId'); var mergeRequestId = $form.data('noteableIid'); @@ -746,7 +743,6 @@ export default class Notes { if (currentContent === initialContent) { this.removeNoteEditForm($el); } else { - var $buttons = $el.find('.note-form-actions'); var isWidgetVisible = isInViewport($el.get(0)); if (!isWidgetVisible) { @@ -766,7 +762,7 @@ export default class Notes { * 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 */ - showEditForm(e, scrollTo, myLastNote) { + showEditForm(e) { e.preventDefault(); var $target = $(e.target); @@ -850,16 +846,11 @@ export default class Notes { * Removes the whole discussion if the last note is being removed. */ removeNote(e) { - var noteElId, noteId, dataNoteId, $note, lineHolder; + var noteElId, $note; $note = $(e.currentTarget).closest('.note'); 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( - (function(_this) { + (function() { // 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, // where $('#noteId') would return only one. @@ -1064,25 +1055,8 @@ export default class Notes { this.setupDiscussionNoteForm($link, newForm); } - toggleDiffNote({ - target, - lineType, - forceShow, - showReplyInput = false, - currentUsername, - currentUserAvatar, - currentUserFullname, - }) { - var $link, - addForm, - hasNotes, - newForm, - noteForm, - replyButton, - row, - rowCssToAdd, - targetContent, - isDiffCommentAvatar; + toggleDiffNote({ target, lineType, forceShow, showReplyInput = false }) { + var $link, addForm, hasNotes, newForm, noteForm, replyButton, row, rowCssToAdd; $link = $(target); row = $link.closest('tr'); const nextRow = row.next(); @@ -1515,7 +1489,7 @@ export default class Notes { let tempFormContent; // Identify executed quick actions from `formContent` - const executedCommands = availableQuickActions.filter((command, index) => { + const executedCommands = availableQuickActions.filter(command => { const commandRegex = new RegExp(`/${command.name}`); return commandRegex.test(formContent); }); @@ -1840,8 +1814,6 @@ export default class Notes { const $noteBody = $editingNote.find('.js-task-list-container'); const $noteBodyText = $noteBody.find('.note-text'); const { formData, formContent, formAction } = this.getFormData($form); - const $diffFile = $form.closest('.diff-file'); - const $notesContainer = $form.closest('.notes'); // Cache original comment content const cachedNoteBodyText = $noteBodyText.html(); diff --git a/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js b/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js index 988ae164955..ec3919dd073 100644 --- a/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js +++ b/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js @@ -1,4 +1,4 @@ -/* 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'; export default { @@ -126,7 +126,7 @@ export default { _.each( _.omit(log_entry, 'author_name', 'author_email'), (function(_this) { - return function(value, key) { + return function(value) { if (_this.in_range(value.date, date_range)) { parsed_entry.dates[value.date] = value[field]; parsed_entry.commits += value.commits; diff --git a/app/assets/javascripts/profile/gl_crop.js b/app/assets/javascripts/profile/gl_crop.js index befe91c332f..6a07ccc7586 100644 --- a/app/assets/javascripts/profile/gl_crop.js +++ b/app/assets/javascripts/profile/gl_crop.js @@ -1,10 +1,10 @@ -/* 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 'cropper'; import _ from 'underscore'; -(global => { +(() => { // Matches everything but the file name const FILENAMEREGEX = /^.*[\\\/]/; @@ -69,7 +69,7 @@ import _ from 'underscore'; this.modalCrop.on('shown.bs.modal', this.onModalShow); this.modalCrop.on('hidden.bs.modal', this.onModalHide); this.uploadImageBtn.on('click', this.onUploadImageBtnClick); - this.cropActionsBtn.on('click', function(e) { + this.cropActionsBtn.on('click', function() { var btn; btn = this; return _this.onActionBtnClick(btn); @@ -128,10 +128,10 @@ import _ from 'underscore'; } onActionBtnClick(btn) { - var data, result; + var data; data = $(btn).data(); 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'; } dataURLtoBlob(dataURL) { - var array, binary, i, len, v; + var array, binary, i, len; binary = atob(dataURL.split(',')[1]); array = []; for (i = 0, len = binary.length; i < len; i += 1) { - v = binary[i]; array.push(binary.charCodeAt(i)); } return new Blob([new Uint8Array(array)], { diff --git a/app/assets/javascripts/project_find_file.js b/app/assets/javascripts/project_find_file.js index 765cb868f80..e73a828c0ae 100644 --- a/app/assets/javascripts/project_find_file.js +++ b/app/assets/javascripts/project_find_file.js @@ -1,4 +1,4 @@ -/* 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 fuzzaldrinPlus from 'fuzzaldrin-plus'; @@ -8,9 +8,8 @@ import { __ } from '~/locale'; // highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> ) const highlighter = function(element, text, matches) { - var highlightText, j, lastIndex, len, matchIndex, matchedChars, unmatched; + var j, lastIndex, len, matchIndex, matchedChars, unmatched; lastIndex = 0; - highlightText = ''; matchedChars = []; for (j = 0, len = matches.length; j < len; j += 1) { matchIndex = matches[j]; diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 40a2158de78..0cc7a22325b 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -1,4 +1,4 @@ -/* 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 'underscore'; @@ -7,7 +7,7 @@ import flash from './flash'; import axios from './lib/utils/axios_utils'; import { sprintf, s__, __ } from './locale'; -function Sidebar(currentUser) { +function Sidebar() { this.toggleTodo = this.toggleTodo.bind(this); this.sidebar = $('aside'); @@ -15,9 +15,9 @@ function Sidebar(currentUser) { this.addEventListeners(); } -Sidebar.initialize = function(currentUser) { +Sidebar.initialize = function() { if (!this.instance) { - this.instance = new Sidebar(currentUser); + this.instance = new Sidebar(); } }; @@ -77,7 +77,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { }; Sidebar.prototype.toggleTodo = function(e) { - var $btnText, $this, $todoLoading, ajaxType, url; + var $this, ajaxType, url; $this = $(e.currentTarget); ajaxType = $this.data('deletePath') ? 'delete' : 'post'; @@ -140,7 +140,7 @@ Sidebar.prototype.todoUpdateDone = function(data) { }); }; -Sidebar.prototype.sidebarDropdownLoading = function(e) { +Sidebar.prototype.sidebarDropdownLoading = function() { var $loading, $sidebarCollapsedIcon, i, img; $sidebarCollapsedIcon = $(this) .closest('.block') @@ -157,7 +157,7 @@ Sidebar.prototype.sidebarDropdownLoading = function(e) { } }; -Sidebar.prototype.sidebarDropdownLoaded = function(e) { +Sidebar.prototype.sidebarDropdownLoaded = function() { var $sidebarCollapsedIcon, i, img; $sidebarCollapsedIcon = $(this) .closest('.block') diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 510a2441924..f02c55c3d5b 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -1,11 +1,10 @@ -/* 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 { escape, throttle } from 'underscore'; -import { s__, __, sprintf } from '~/locale'; +import { s__, __ } from '~/locale'; import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper'; import axios from './lib/utils/axios_utils'; -import DropdownUtils from './filtered_search/dropdown_utils'; import { isInGroupsPage, isInProjectPage, @@ -142,7 +141,7 @@ export class SearchAutocomplete { }); } - getSearchText(selectedObject, el) { + getSearchText(selectedObject) { return selectedObject.id ? selectedObject.text : ''; } @@ -402,7 +401,7 @@ export class SearchAutocomplete { return this.searchInput.val('').focus(); } - onSearchInputBlur(e) { + onSearchInputBlur() { this.isFocused = false; this.wrap.removeClass('search-active'); // If input is blank then restore state diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index 57efde7f027..4b3c42ae848 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -1,4 +1,4 @@ -/* 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 emitSidebarEvent */ @@ -405,7 +405,7 @@ function UsersSelect(currentUser, els, options = {}) { } }, defaultLabel: defaultLabel, - hidden: function(e) { + hidden: function() { if ($dropdown.hasClass('js-multiselect')) { emitSidebarEvent('sidebar.saveAssignees'); } @@ -442,7 +442,6 @@ function UsersSelect(currentUser, els, options = {}) { if (user.beforeDivider && user.name.toLowerCase() === 'unassigned') { // Unassigned selected previouslySelected.each((index, element) => { - const id = parseInt(element.value, 10); element.remove(); }); emitSidebarEvent('sidebar.removeAllAssignees'); @@ -548,7 +547,7 @@ function UsersSelect(currentUser, els, options = {}) { }, updateLabel: $dropdown.data('dropdownTitle'), renderRow: function(user) { - var avatar, img, listClosingTags, listWithName, listWithUserName, username; + var avatar, img, username; username = user.username ? '@' + user.username : ''; avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url; diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index e98c4d7bf7a..5438572eadf 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -1,4 +1,4 @@ -/* 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 // @@ -62,7 +62,7 @@ export default class ZenMode { $(document).on( 'zen_mode:leave', (function(_this) { - return function(e) { + return function() { return _this.exit(); }; })(this), |