resolve all prefer-const eslint violations
This commit is contained in:
parent
0b3f00492b
commit
83ecc02daa
15 changed files with 44 additions and 47 deletions
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable comma-dangle, object-shorthand, func-names, space-before-function-paren, arrow-parens, no-unused-vars, class-methods-use-this, no-var, consistent-return, prefer-const, no-param-reassign, space-in-parens, max-len */
|
||||
/* eslint-disable comma-dangle, object-shorthand, func-names, space-before-function-paren, arrow-parens, no-unused-vars, class-methods-use-this, no-var, consistent-return, no-param-reassign, space-in-parens, max-len */
|
||||
|
||||
((global) => {
|
||||
class TemplateSelector {
|
||||
|
@ -74,7 +74,7 @@
|
|||
if (!file) return;
|
||||
|
||||
const oldValue = this.editor.getValue();
|
||||
let newValue = file.content;
|
||||
const newValue = file.content;
|
||||
|
||||
this.editor.setValue(newValue, 1);
|
||||
if (!skipFocus) this.editor.focus();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable no-unused-vars, no-mixed-operators, prefer-const, comma-dangle */
|
||||
/* eslint-disable no-unused-vars, no-mixed-operators, comma-dangle */
|
||||
/* global DocumentTouch */
|
||||
|
||||
((w) => {
|
||||
|
@ -19,7 +19,7 @@
|
|||
gl.issueBoards.touchEnabled = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
|
||||
|
||||
gl.issueBoards.getBoardSortableDefaultOptions = (obj) => {
|
||||
let defaultSortOptions = {
|
||||
const defaultSortOptions = {
|
||||
animation: 200,
|
||||
forceFallback: true,
|
||||
fallbackClass: 'is-dragging',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren, no-underscore-dangle, class-methods-use-this, consistent-return, prefer-const, space-in-parens, no-shadow, no-param-reassign, max-len, no-unused-vars */
|
||||
/* eslint-disable space-before-function-paren, no-underscore-dangle, class-methods-use-this, consistent-return, space-in-parens, no-shadow, no-param-reassign, max-len, no-unused-vars */
|
||||
/* global ListIssue */
|
||||
/* global ListLabel */
|
||||
|
||||
|
@ -66,7 +66,7 @@ class List {
|
|||
|
||||
getIssues (emptyIssues = true) {
|
||||
const filters = this.filters;
|
||||
let data = { page: this.page };
|
||||
const data = { page: this.page };
|
||||
|
||||
Object.keys(filters).forEach((key) => { data[key] = filters[key]; });
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren, comma-dangle, no-param-reassign, camelcase, prefer-const, max-len, no-unused-vars */
|
||||
/* eslint-disable space-before-function-paren, comma-dangle, no-param-reassign, camelcase, max-len, no-unused-vars */
|
||||
/* global Vue */
|
||||
|
||||
class BoardService {
|
||||
|
@ -47,7 +47,7 @@ class BoardService {
|
|||
}
|
||||
|
||||
getIssuesForList (id, filter = {}) {
|
||||
let data = { id };
|
||||
const data = { id };
|
||||
Object.keys(filter).forEach((key) => { data[key] = filter[key]; });
|
||||
|
||||
return this.issues.get(data);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable object-shorthand, func-names, camelcase, prefer-const, no-restricted-syntax, guard-for-in, comma-dangle, max-len, no-param-reassign */
|
||||
/* eslint-disable object-shorthand, func-names, camelcase, no-restricted-syntax, guard-for-in, comma-dangle, max-len, no-param-reassign */
|
||||
/* global Vue */
|
||||
/* global DiscussionModel */
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
},
|
||||
unresolvedDiscussionIds: function () {
|
||||
let ids = [];
|
||||
const ids = [];
|
||||
|
||||
for (const discussionId in this.state) {
|
||||
const discussion = this.state[discussionId];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, prefer-const, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */
|
||||
/* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */
|
||||
|
||||
(function(global) {
|
||||
class DueDateSelect {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable no-param-reassign, func-names, no-var, camelcase, no-unused-vars, object-shorthand, space-before-function-paren, no-return-assign, comma-dangle, consistent-return, one-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, prefer-const, wrap-iife, max-len */
|
||||
/* eslint-disable no-param-reassign, func-names, no-var, camelcase, no-unused-vars, object-shorthand, space-before-function-paren, no-return-assign, comma-dangle, consistent-return, one-var, one-var-declaration-per-line, quotes, prefer-template, prefer-arrow-callback, wrap-iife, max-len */
|
||||
/* global Issuable */
|
||||
/* global Turbolinks */
|
||||
|
||||
|
@ -151,7 +151,7 @@
|
|||
this.issuableBulkActions.setOriginalDropdownData();
|
||||
|
||||
if ($checkedIssues.length > 0) {
|
||||
let ids = $.map($checkedIssues, function(value) {
|
||||
const ids = $.map($checkedIssues, function(value) {
|
||||
return $(value).data('id');
|
||||
});
|
||||
$updateIssuesIds.val(ids);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable comma-dangle, quote-props, no-useless-computed-key, object-shorthand, prefer-const, no-new, no-param-reassign, max-len */
|
||||
/* eslint-disable comma-dangle, quote-props, no-useless-computed-key, object-shorthand, no-new, no-param-reassign, max-len */
|
||||
/* global Vue */
|
||||
/* global ace */
|
||||
/* global Flash */
|
||||
|
@ -50,8 +50,8 @@
|
|||
|
||||
$.get(this.file.content_path)
|
||||
.done((file) => {
|
||||
let content = this.$el.querySelector('pre');
|
||||
let fileContent = document.createTextNode(file.content);
|
||||
const content = this.$el.querySelector('pre');
|
||||
const fileContent = document.createTextNode(file.content);
|
||||
|
||||
content.textContent = fileContent.textContent;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable comma-dangle, object-shorthand, no-param-reassign, camelcase, prefer-const, no-nested-ternary, no-continue, max-len */
|
||||
/* eslint-disable comma-dangle, object-shorthand, no-param-reassign, camelcase, no-nested-ternary, no-continue, max-len */
|
||||
/* global Cookies */
|
||||
/* global Vue */
|
||||
|
||||
|
@ -251,7 +251,7 @@
|
|||
},
|
||||
|
||||
checkLineLengths(linesObj) {
|
||||
let { left, right } = linesObj;
|
||||
const { left, right } = linesObj;
|
||||
|
||||
if (left.length !== right.length) {
|
||||
if (left.length > right.length) {
|
||||
|
@ -316,11 +316,11 @@
|
|||
let unresolved = 0;
|
||||
|
||||
for (let i = 0, l = files.length; i < l; i += 1) {
|
||||
let file = files[i];
|
||||
const file = files[i];
|
||||
|
||||
if (file.resolveMode === INTERACTIVE_RESOLVE_MODE) {
|
||||
let numberConflicts = 0;
|
||||
let resolvedConflicts = Object.keys(file.resolutionData).length;
|
||||
const resolvedConflicts = Object.keys(file.resolutionData).length;
|
||||
|
||||
// We only check for conflicts type 'text'
|
||||
// since conflicts `text_editor` can´t be resolved in interactive mode
|
||||
|
@ -364,9 +364,7 @@
|
|||
};
|
||||
|
||||
this.state.conflictsData.files.forEach((file) => {
|
||||
let addFile;
|
||||
|
||||
addFile = {
|
||||
const addFile = {
|
||||
old_path: file.old_path,
|
||||
new_path: file.new_path
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable wrap-iife, func-names, space-before-function-paren, object-shorthand, comma-dangle, one-var, one-var-declaration-per-line, no-restricted-syntax, prefer-const, max-len, no-param-reassign */
|
||||
/* eslint-disable wrap-iife, func-names, space-before-function-paren, object-shorthand, comma-dangle, one-var, one-var-declaration-per-line, no-restricted-syntax, max-len, no-param-reassign */
|
||||
|
||||
(function(global) {
|
||||
class ProjectLabelSubscription {
|
||||
|
@ -38,8 +38,8 @@
|
|||
this.$buttons.attr('data-status', newStatus);
|
||||
this.$buttons.find('> span').text(newAction);
|
||||
|
||||
for (let button of this.$buttons) {
|
||||
let $button = $(button);
|
||||
for (const button of this.$buttons) {
|
||||
const $button = $(button);
|
||||
|
||||
if ($button.attr('data-original-title')) {
|
||||
$button.tooltip('hide').attr('data-original-title', newAction).tooltip('fixTitle');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable prefer-const, comma-dangle, max-len, no-useless-return, no-param-reassign, max-len */
|
||||
/* eslint-disable comma-dangle, max-len, no-useless-return, no-param-reassign, max-len */
|
||||
/* global Api */
|
||||
|
||||
/*= require ../blob/template_selector */
|
||||
|
@ -12,7 +12,7 @@
|
|||
this.issuableType = this.wrapper.data('issuable-type');
|
||||
this.titleInput = $(`#${this.issuableType}_title`);
|
||||
|
||||
let initialQuery = {
|
||||
const initialQuery = {
|
||||
name: this.dropdown.data('selected')
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable no-new, comma-dangle, class-methods-use-this, prefer-const, no-param-reassign */
|
||||
/* eslint-disable no-new, comma-dangle, class-methods-use-this, no-param-reassign */
|
||||
|
||||
((global) => {
|
||||
class IssuableTemplateSelectors {
|
||||
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
|
||||
initEditor() {
|
||||
let editor = $('.markdown-area');
|
||||
const editor = $('.markdown-area');
|
||||
// Proxy ace-editor's .setValue to jQuery's .val
|
||||
editor.setValue = editor.val;
|
||||
editor.getValue = editor.val;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable no-unused-expressions, prefer-const, no-prototype-builtins, no-new, no-shadow, max-len */
|
||||
/* eslint-disable no-unused-expressions, no-prototype-builtins, no-new, no-shadow, max-len */
|
||||
|
||||
/*= require js.cookie.js */
|
||||
/*= require jquery.endless-scroll.js */
|
||||
|
@ -24,12 +24,12 @@
|
|||
}];
|
||||
|
||||
function getEventName(index) {
|
||||
let filter = filters[index];
|
||||
const filter = filters[index];
|
||||
return filter.hasOwnProperty('name') ? filter.name : filter.id;
|
||||
}
|
||||
|
||||
function getSelector(index) {
|
||||
let filter = filters[index];
|
||||
const filter = filters[index];
|
||||
return `#${filter.id}_event_filter`;
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@
|
|||
|
||||
for (let x = 0; x < filters.length; x += 1) {
|
||||
((x) => {
|
||||
let shouldHighlight = i === x;
|
||||
let testName = shouldHighlight ? 'should highlight' : 'should not highlight';
|
||||
const shouldHighlight = i === x;
|
||||
const testName = shouldHighlight ? 'should highlight' : 'should not highlight';
|
||||
|
||||
it(`${testName} ${getEventName(x)}`, () => {
|
||||
expect($(getSelector(x)).parent().hasClass('active')).toEqual(shouldHighlight);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable comma-dangle, prefer-const, no-param-reassign, no-unused-expressions, max-len */
|
||||
/* eslint-disable comma-dangle, no-param-reassign, no-unused-expressions, max-len */
|
||||
/* global Turbolinks */
|
||||
|
||||
/*= require jquery */
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
let remoteCallback;
|
||||
|
||||
let navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
|
||||
const navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
|
||||
i = i || 0;
|
||||
if (!i) direction = direction.toUpperCase();
|
||||
$('body').trigger({
|
||||
|
@ -38,7 +38,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
let remoteMock = function remoteMock(data, term, callback) {
|
||||
const remoteMock = function remoteMock(data, term, callback) {
|
||||
remoteCallback = callback.bind({}, data);
|
||||
};
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
|||
|
||||
it('should select a following item on DOWN keypress', () => {
|
||||
expect($(FOCUSED_ITEM_SELECTOR, this.$dropdownMenuElement).length).toBe(0);
|
||||
let randomIndex = (Math.floor(Math.random() * (this.projectsData.length - 1)) + 0);
|
||||
const randomIndex = (Math.floor(Math.random() * (this.projectsData.length - 1)) + 0);
|
||||
navigateWithKeys('down', randomIndex, () => {
|
||||
expect($(FOCUSED_ITEM_SELECTOR, this.$dropdownMenuElement).length).toBe(1);
|
||||
expect($(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement)).toHaveClass('is-focused');
|
||||
|
@ -100,7 +100,7 @@
|
|||
expect($(FOCUSED_ITEM_SELECTOR, this.$dropdownMenuElement).length).toBe(0);
|
||||
navigateWithKeys('down', (this.projectsData.length - 1), () => {
|
||||
expect($(FOCUSED_ITEM_SELECTOR, this.$dropdownMenuElement).length).toBe(1);
|
||||
let randomIndex = (Math.floor(Math.random() * (this.projectsData.length - 2)) + 0);
|
||||
const randomIndex = (Math.floor(Math.random() * (this.projectsData.length - 2)) + 0);
|
||||
navigateWithKeys('up', randomIndex, () => {
|
||||
expect($(FOCUSED_ITEM_SELECTOR, this.$dropdownMenuElement).length).toBe(1);
|
||||
expect($(`${ITEM_SELECTOR}:eq(${((this.projectsData.length - 2) - randomIndex)}) a`, this.$dropdownMenuElement)).toHaveClass('is-focused');
|
||||
|
@ -110,14 +110,14 @@
|
|||
|
||||
it('should click the selected item on ENTER keypress', () => {
|
||||
expect(this.dropdownContainerElement).toHaveClass('open');
|
||||
let randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0;
|
||||
const randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0;
|
||||
navigateWithKeys('down', randomIndex, () => {
|
||||
spyOn(Turbolinks, 'visit').and.stub();
|
||||
navigateWithKeys('enter', null, () => {
|
||||
expect(this.dropdownContainerElement).not.toHaveClass('open');
|
||||
let link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement);
|
||||
const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement);
|
||||
expect(link).toHaveClass('is-active');
|
||||
let linkedLocation = link.attr('href');
|
||||
const linkedLocation = link.attr('href');
|
||||
if (linkedLocation && linkedLocation !== '#') expect(Turbolinks.visit).toHaveBeenCalledWith(linkedLocation);
|
||||
});
|
||||
});
|
||||
|
@ -171,9 +171,8 @@
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
it('should still have input value on close and restore', () => {
|
||||
let $searchInput = $(SEARCH_INPUT_SELECTOR);
|
||||
const $searchInput = $(SEARCH_INPUT_SELECTOR);
|
||||
initDropDown.call(this, false, true);
|
||||
$searchInput
|
||||
.trigger('focus')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable no-new, prefer-const */
|
||||
/* eslint-disable no-new */
|
||||
/* global IssuableContext */
|
||||
/* global LabelsSelect */
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
LABELS_DATA.push({ id: i, title: `test ${i}`, color: '#5CB85C' });
|
||||
}
|
||||
} else if (req.url === '/root/test/issues/2.json') {
|
||||
let tmp = [];
|
||||
const tmp = [];
|
||||
for (let i = 0; i < saveLabelCount; i += 1) {
|
||||
tmp.push({ id: i, title: `test ${i}`, color: '#5CB85C' });
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue