Commit 0e6e345f authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 19 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -517,39 +517,6 @@ app/assets/javascripts/lib/utils/text_markdown.js ...@@ -517,39 +517,6 @@ app/assets/javascripts/lib/utils/text_markdown.js
app/assets/javascripts/lib/utils/text_utility.js app/assets/javascripts/lib/utils/text_utility.js
app/assets/javascripts/lib/utils/type_utility.js app/assets/javascripts/lib/utils/type_utility.js
## zen-robinson
app/assets/javascripts/lib/utils/unit_format/formatter_factory.js
app/assets/javascripts/lib/utils/url_utility.js
app/assets/javascripts/line_highlighter.js
app/assets/javascripts/locale/ensure_single_line.js
app/assets/javascripts/locale/index.js
app/assets/javascripts/locale/sprintf.js
app/assets/javascripts/logs/components/log_advanced_filters.vue
app/assets/javascripts/logs/logs_tracking_helper.js
app/assets/javascripts/logs/stores/actions.js
app/assets/javascripts/logs/stores/getters.js
app/assets/javascripts/logs/utils.js
app/assets/javascripts/main.js
app/assets/javascripts/manual_ordering.js
app/assets/javascripts/member_expiration_date.js
app/assets/javascripts/members.js
app/assets/javascripts/members/components/avatars/user_avatar.vue
app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue
app/assets/javascripts/members/store/index.js
app/assets/javascripts/members/utils.js
app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js
app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js
app/assets/javascripts/merge_conflicts/merge_conflict_store.js
app/assets/javascripts/merge_request.js
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/milestone.js
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestones/components/milestone_combobox.vue
app/assets/javascripts/milestones/stores/actions.js
app/assets/javascripts/milestones/stores/mutations.js
## inspiring-lovelace ## inspiring-lovelace
app/assets/javascripts/mini_pipeline_graph_dropdown.js app/assets/javascripts/mini_pipeline_graph_dropdown.js
app/assets/javascripts/mirrors/mirror_repos.js app/assets/javascripts/mirrors/mirror_repos.js
......
...@@ -106,7 +106,7 @@ export const scaledSIFormatter = (unit = '', prefixOffset = 0) => { ...@@ -106,7 +106,7 @@ export const scaledSIFormatter = (unit = '', prefixOffset = 0) => {
const multiplicative = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; const multiplicative = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
const symbols = [...fractional, '', ...multiplicative]; const symbols = [...fractional, '', ...multiplicative];
const units = symbols.slice(fractional.length + prefixOffset).map(prefix => { const units = symbols.slice(fractional.length + prefixOffset).map((prefix) => {
return `${prefix}${unit}`; return `${prefix}${unit}`;
}); });
...@@ -126,7 +126,7 @@ export const scaledBinaryFormatter = (unit = '', prefixOffset = 0) => { ...@@ -126,7 +126,7 @@ export const scaledBinaryFormatter = (unit = '', prefixOffset = 0) => {
const multiplicative = ['Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi']; const multiplicative = ['Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
const symbols = ['', ...multiplicative]; const symbols = ['', ...multiplicative];
const units = symbols.slice(prefixOffset).map(prefix => { const units = symbols.slice(prefixOffset).map((prefix) => {
return `${prefix}${unit}`; return `${prefix}${unit}`;
}); });
......
...@@ -112,13 +112,13 @@ export function mergeUrlParams(params, url, options = {}) { ...@@ -112,13 +112,13 @@ export function mergeUrlParams(params, url, options = {}) {
const mergedKeys = sort ? Object.keys(merged).sort() : Object.keys(merged); const mergedKeys = sort ? Object.keys(merged).sort() : Object.keys(merged);
const newQuery = mergedKeys const newQuery = mergedKeys
.filter(key => merged[key] !== null) .filter((key) => merged[key] !== null)
.map(key => { .map((key) => {
let value = merged[key]; let value = merged[key];
const encodedKey = encodeURIComponent(key); const encodedKey = encodeURIComponent(key);
if (spreadArrays && Array.isArray(value)) { if (spreadArrays && Array.isArray(value)) {
value = merged[key] value = merged[key]
.map(arrayValue => encodeURIComponent(arrayValue)) .map((arrayValue) => encodeURIComponent(arrayValue))
.join(`&${encodedKey}[]=`); .join(`&${encodedKey}[]=`);
return `${encodedKey}[]=${value}`; return `${encodedKey}[]=${value}`;
} }
...@@ -150,11 +150,11 @@ export function removeParams(params, url = window.location.href, skipEncoding = ...@@ -150,11 +150,11 @@ export function removeParams(params, url = window.location.href, skipEncoding =
return url; return url;
} }
const removableParams = skipEncoding ? params : params.map(param => encodeURIComponent(param)); const removableParams = skipEncoding ? params : params.map((param) => encodeURIComponent(param));
const updatedQuery = query const updatedQuery = query
.split('&') .split('&')
.filter(paramPair => { .filter((paramPair) => {
const [foundParam] = paramPair.split('='); const [foundParam] = paramPair.split('=');
return removableParams.indexOf(foundParam) < 0; return removableParams.indexOf(foundParam) < 0;
}) })
...@@ -237,7 +237,7 @@ export function redirectTo(url) { ...@@ -237,7 +237,7 @@ export function redirectTo(url) {
return window.location.assign(url); return window.location.assign(url);
} }
export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); export const escapeFileUrl = (fileUrl) => encodeURIComponent(fileUrl).replace(/%2F/g, '/');
export function webIDEUrl(route = undefined) { export function webIDEUrl(route = undefined) {
let returnUrl = `${gon.relative_url_root || ''}/-/ide/`; let returnUrl = `${gon.relative_url_root || ''}/-/ide/`;
...@@ -396,7 +396,7 @@ export function queryToObject(query, options = {}) { ...@@ -396,7 +396,7 @@ export function queryToObject(query, options = {}) {
*/ */
export function objectToQuery(obj) { export function objectToQuery(obj) {
return Object.keys(obj) return Object.keys(obj)
.map(k => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`) .map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`)
.join('&'); .join('&');
} }
...@@ -420,7 +420,7 @@ export const setUrlParams = ( ...@@ -420,7 +420,7 @@ export const setUrlParams = (
const queryString = urlObj.search; const queryString = urlObj.search;
const searchParams = clearParams ? new URLSearchParams('') : new URLSearchParams(queryString); const searchParams = clearParams ? new URLSearchParams('') : new URLSearchParams(queryString);
Object.keys(params).forEach(key => { Object.keys(params).forEach((key) => {
if (params[key] === null || params[key] === undefined) { if (params[key] === null || params[key] === undefined) {
searchParams.delete(key); searchParams.delete(key);
} else if (Array.isArray(params[key])) { } else if (Array.isArray(params[key])) {
......
...@@ -55,7 +55,7 @@ LineHighlighter.prototype.bindEvents = function () { ...@@ -55,7 +55,7 @@ LineHighlighter.prototype.bindEvents = function () {
$fileHolder.on('click', 'a[data-line-number]', this.clickHandler); $fileHolder.on('click', 'a[data-line-number]', this.clickHandler);
$fileHolder.on('highlight:line', this.highlightHash); $fileHolder.on('highlight:line', this.highlightHash);
window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash)); window.addEventListener('hashchange', (e) => this.highlightHash(e.target.location.hash));
}; };
LineHighlighter.prototype.highlightHash = function (newHash) { LineHighlighter.prototype.highlightHash = function (newHash) {
......
...@@ -18,7 +18,7 @@ module.exports = function ensureSingleLine(str) { ...@@ -18,7 +18,7 @@ module.exports = function ensureSingleLine(str) {
if (str.includes('\n') || str.includes('\r')) { if (str.includes('\n') || str.includes('\r')) {
return str return str
.split(SPLIT_REGEX) .split(SPLIT_REGEX)
.filter(s => s !== '') .filter((s) => s !== '')
.join(' '); .join(' ');
} }
return str; return str;
......
...@@ -11,7 +11,7 @@ delete window.translations; ...@@ -11,7 +11,7 @@ delete window.translations;
@param text The text to be translated @param text The text to be translated
@returns {String} The translated text @returns {String} The translated text
*/ */
const gettext = text => locale.gettext(ensureSingleLine(text)); const gettext = (text) => locale.gettext(ensureSingleLine(text));
/** /**
Translate the text with a number Translate the text with a number
...@@ -56,7 +56,7 @@ const pgettext = (keyOrContext, key) => { ...@@ -56,7 +56,7 @@ const pgettext = (keyOrContext, key) => {
@param formatOptions for available options, please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat @param formatOptions for available options, please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
@returns {Intl.DateTimeFormat} @returns {Intl.DateTimeFormat}
*/ */
const createDateTimeFormat = formatOptions => Intl.DateTimeFormat(languageCode(), formatOptions); const createDateTimeFormat = (formatOptions) => Intl.DateTimeFormat(languageCode(), formatOptions);
export { languageCode }; export { languageCode };
export { gettext as __ }; export { gettext as __ };
......
...@@ -15,7 +15,7 @@ export default (input, parameters, escapeParameters = true) => { ...@@ -15,7 +15,7 @@ export default (input, parameters, escapeParameters = true) => {
let output = input; let output = input;
if (parameters) { if (parameters) {
Object.keys(parameters).forEach(parameterName => { Object.keys(parameters).forEach((parameterName) => {
const parameterValue = parameters[parameterName]; const parameterValue = parameters[parameterName];
const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue; const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue;
output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue); output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue);
......
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
*/ */
podOptions() { podOptions() {
if (this.pods.options.length) { if (this.pods.options.length) {
return this.pods.options.map(podName => ({ value: podName, title: podName })); return this.pods.options.map((podName) => ({ value: podName, title: podName }));
} }
return null; return null;
}, },
......
...@@ -8,7 +8,7 @@ import Tracking from '~/tracking'; ...@@ -8,7 +8,7 @@ import Tracking from '~/tracking';
* 3. Change the time range * 3. Change the time range
* 4. Use the search bar * 4. Use the search bar
*/ */
const trackLogs = label => const trackLogs = (label) =>
Tracking.event(document.body.dataset.page, 'logs_view', { Tracking.event(document.body.dataset.page, 'logs_view', {
label, label,
property: 'count', property: 'count',
......
...@@ -11,14 +11,14 @@ const requestUntilData = (url, params) => ...@@ -11,14 +11,14 @@ const requestUntilData = (url, params) =>
backOff((next, stop) => { backOff((next, stop) => {
axios axios
.get(url, { params }) .get(url, { params })
.then(res => { .then((res) => {
if (res.status === httpStatusCodes.ACCEPTED) { if (res.status === httpStatusCodes.ACCEPTED) {
next(); next();
return; return;
} }
stop(res); stop(res);
}) })
.catch(err => { .catch((err) => {
stop(err); stop(err);
}); });
}); });
...@@ -66,12 +66,12 @@ const requestLogsUntilData = ({ commit, state }) => { ...@@ -66,12 +66,12 @@ const requestLogsUntilData = ({ commit, state }) => {
const filtersToParams = (filters = []) => { const filtersToParams = (filters = []) => {
// Strings become part of the `search` // Strings become part of the `search`
const search = filters const search = filters
.filter(f => typeof f === 'string') .filter((f) => typeof f === 'string')
.join(' ') .join(' ')
.trim(); .trim();
// null podName to show all pods // null podName to show all pods
const podName = filters.find(f => f?.type === TOKEN_TYPE_POD_NAME)?.value?.data ?? null; const podName = filters.find((f) => f?.type === TOKEN_TYPE_POD_NAME)?.value?.data ?? null;
return { search, podName }; return { search, podName };
}; };
......
...@@ -3,9 +3,9 @@ import { formatDate } from '../utils'; ...@@ -3,9 +3,9 @@ import { formatDate } from '../utils';
const mapTrace = ({ timestamp = null, pod = '', message = '' }) => const mapTrace = ({ timestamp = null, pod = '', message = '' }) =>
[timestamp ? formatDate(timestamp) : '', pod, message].join(' | '); [timestamp ? formatDate(timestamp) : '', pod, message].join(' | ');
export const trace = state => state.logs.lines.map(mapTrace).join('\n'); export const trace = (state) => state.logs.lines.map(mapTrace).join('\n');
export const showAdvancedFilters = state => { export const showAdvancedFilters = (state) => {
if (state.environments.current) { if (state.environments.current) {
const environment = state.environments.options.find( const environment = state.environments.options.find(
({ name }) => name === state.environments.current, ({ name }) => name === state.environments.current,
......
...@@ -22,4 +22,4 @@ export const getTimeRange = (seconds = 0) => { ...@@ -22,4 +22,4 @@ export const getTimeRange = (seconds = 0) => {
}; };
}; };
export const formatDate = timestamp => dateFormat(timestamp, dateFormatMask); export const formatDate = (timestamp) => dateFormat(timestamp, dateFormatMask);
...@@ -298,7 +298,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -298,7 +298,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (flashContainer && flashContainer.children.length) { if (flashContainer && flashContainer.children.length) {
flashContainer flashContainer
.querySelectorAll('.flash-alert, .flash-notice, .flash-success') .querySelectorAll('.flash-alert, .flash-notice, .flash-success')
.forEach(flashEl => { .forEach((flashEl) => {
removeFlashClickListener(flashEl); removeFlashClickListener(flashEl);
}); });
} }
......
...@@ -39,7 +39,7 @@ const initManualOrdering = (draggableSelector = 'li.issue') => { ...@@ -39,7 +39,7 @@ const initManualOrdering = (draggableSelector = 'li.issue') => {
onStart: () => { onStart: () => {
sortableStart(); sortableStart();
}, },
onUpdate: event => { onUpdate: (event) => {
const el = event.item; const el = event.item;
const url = el.getAttribute('url') || el.dataset.url; const url = el.getAttribute('url') || el.dataset.url;
......
...@@ -24,8 +24,8 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d ...@@ -24,8 +24,8 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d
format: 'yyyy-mm-dd', format: 'yyyy-mm-dd',
minDate: new Date(), minDate: new Date(),
container: $input.parent().get(0), container: $input.parent().get(0),
parse: dateString => parsePikadayDate(dateString), parse: (dateString) => parsePikadayDate(dateString),
toString: date => pikadayToString(date), toString: (date) => pikadayToString(date),
onSelect(dateText) { onSelect(dateText) {
$input.val(calendar.toString(dateText)); $input.val(calendar.toString(dateText));
......
...@@ -46,7 +46,7 @@ export default class Members { ...@@ -46,7 +46,7 @@ export default class Members {
return $el.data('id'); return $el.data('id');
}, },
toggleLabel: (selected, $el) => this.dropdownToggleLabel(selected, $el, $btn), toggleLabel: (selected, $el) => this.dropdownToggleLabel(selected, $el, $btn),
clicked: options => this.dropdownClicked(options), clicked: (options) => this.dropdownClicked(options),
}); });
}); });
} }
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
return this.member.user; return this.member.user;
}, },
badges() { badges() {
return generateBadges(this.member, this.isCurrentUser).filter(badge => badge.show); return generateBadges(this.member, this.isCurrentUser).filter((badge) => badge.show);
}, },
statusEmoji() { statusEmoji() {
return this.user?.status?.emoji; return this.user?.status?.emoji;
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
computed: { computed: {
...mapState(['sourceId', 'filteredSearchBar', 'canManageMembers']), ...mapState(['sourceId', 'filteredSearchBar', 'canManageMembers']),
tokens() { tokens() {
return this.$options.availableTokens.filter(token => { return this.$options.availableTokens.filter((token) => {
if ( if (
Object.prototype.hasOwnProperty.call(token, 'requiredPermissions') && Object.prototype.hasOwnProperty.call(token, 'requiredPermissions') &&
!this[token.requiredPermissions] !this[token.requiredPermissions]
...@@ -61,8 +61,8 @@ export default { ...@@ -61,8 +61,8 @@ export default {
const query = queryToObject(window.location.search); const query = queryToObject(window.location.search);
const tokens = this.tokens const tokens = this.tokens
.filter(token => query[token.type]) .filter((token) => query[token.type])
.map(token => ({ .map((token) => ({
type: token.type, type: token.type,
value: { value: {
data: query[token.type], data: query[token.type],
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
return parseSortParam(this.tableSortableFields); return parseSortParam(this.tableSortableFields);
}, },
activeOption() { activeOption() {
return FIELDS.find(field => field.key === this.sort.sortByKey); return FIELDS.find((field) => field.key === this.sort.sortByKey);
}, },
activeOptionLabel() { activeOptionLabel() {
return this.activeOption?.label; return this.activeOption?.label;
...@@ -23,8 +23,9 @@ export default { ...@@ -23,8 +23,9 @@ export default {
return !this.sort.sortDesc; return !this.sort.sortDesc;
}, },
filteredOptions() { filteredOptions() {
return FIELDS.filter(field => this.tableSortableFields.includes(field.key) && field.sort).map( return FIELDS.filter(
field => ({ (field) => this.tableSortableFields.includes(field.key) && field.sort,
).map((field) => ({
key: field.key, key: field.key,
label: field.label, label: field.label,
href: buildSortHref({ href: buildSortHref({
...@@ -33,8 +34,7 @@ export default { ...@@ -33,8 +34,7 @@ export default {
filteredSearchBarTokens: this.filteredSearchBar.tokens, filteredSearchBarTokens: this.filteredSearchBar.tokens,
filteredSearchBarSearchParam: this.filteredSearchBar.searchParam, filteredSearchBarSearchParam: this.filteredSearchBar.searchParam,
}), }),
}), }));
);
}, },
}, },
methods: { methods: {
......
...@@ -2,7 +2,7 @@ import createState from 'ee_else_ce/members/store/state'; ...@@ -2,7 +2,7 @@ import createState from 'ee_else_ce/members/store/state';
import mutations from 'ee_else_ce/members/store/mutations'; import mutations from 'ee_else_ce/members/store/mutations';
import * as actions from 'ee_else_ce/members/store/actions'; import * as actions from 'ee_else_ce/members/store/actions';
export default initialState => ({ export default (initialState) => ({
state: createState(initialState), state: createState(initialState),
actions, actions,
mutations, mutations,
......
...@@ -21,7 +21,7 @@ export const generateBadges = (member, isCurrentUser) => [ ...@@ -21,7 +21,7 @@ export const generateBadges = (member, isCurrentUser) => [
}, },
]; ];
export const isGroup = member => { export const isGroup = (member) => {
return Boolean(member.sharedWithGroup); return Boolean(member.sharedWithGroup);
}; };
...@@ -37,7 +37,7 @@ export const canRemove = (member, sourceId) => { ...@@ -37,7 +37,7 @@ export const canRemove = (member, sourceId) => {
return isDirectMember(member, sourceId) && member.canRemove; return isDirectMember(member, sourceId) && member.canRemove;
}; };
export const canResend = member => { export const canResend = (member) => {
return Boolean(member.invite?.canResend); return Boolean(member.invite?.canResend);
}; };
...@@ -47,11 +47,11 @@ export const canUpdate = (member, currentUserId, sourceId) => { ...@@ -47,11 +47,11 @@ export const canUpdate = (member, currentUserId, sourceId) => {
); );
}; };
export const parseSortParam = sortableFields => { export const parseSortParam = (sortableFields) => {
const sortParam = getParameterByName('sort'); const sortParam = getParameterByName('sort');
const sortedField = FIELDS.filter(field => sortableFields.includes(field.key)).find( const sortedField = FIELDS.filter((field) => sortableFields.includes(field.key)).find(
field => field.sort?.asc === sortParam || field.sort?.desc === sortParam, (field) => field.sort?.asc === sortParam || field.sort?.desc === sortParam,
); );
if (!sortedField) { if (!sortedField) {
...@@ -70,7 +70,7 @@ export const buildSortHref = ({ ...@@ -70,7 +70,7 @@ export const buildSortHref = ({
filteredSearchBarTokens, filteredSearchBarTokens,
filteredSearchBarSearchParam, filteredSearchBarSearchParam,
}) => { }) => {
const sortDefinition = FIELDS.find(field => field.key === sortBy)?.sort; const sortDefinition = FIELDS.find((field) => field.key === sortBy)?.sort;
if (!sortDefinition) { if (!sortDefinition) {
return ''; return '';
......
...@@ -6,7 +6,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -6,7 +6,7 @@ import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as flash } from '~/flash'; import { deprecatedCreateFlash as flash } from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.diffFileEditor = Vue.extend({ global.mergeConflicts.diffFileEditor = Vue.extend({
......
...@@ -4,7 +4,7 @@ import Vue from 'vue'; ...@@ -4,7 +4,7 @@ import Vue from 'vue';
import actionsMixin from '../mixins/line_conflict_actions'; import actionsMixin from '../mixins/line_conflict_actions';
import utilsMixin from '../mixins/line_conflict_utils'; import utilsMixin from '../mixins/line_conflict_utils';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.inlineConflictLines = Vue.extend({ global.mergeConflicts.inlineConflictLines = Vue.extend({
......
...@@ -4,7 +4,7 @@ import Vue from 'vue'; ...@@ -4,7 +4,7 @@ import Vue from 'vue';
import actionsMixin from '../mixins/line_conflict_actions'; import actionsMixin from '../mixins/line_conflict_actions';
import utilsMixin from '../mixins/line_conflict_utils'; import utilsMixin from '../mixins/line_conflict_utils';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.parallelConflictLines = Vue.extend({ global.mergeConflicts.parallelConflictLines = Vue.extend({
......
...@@ -5,7 +5,7 @@ import Vue from 'vue'; ...@@ -5,7 +5,7 @@ import Vue from 'vue';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
const diffViewType = Cookies.get('diff_view'); const diffViewType = Cookies.get('diff_view');
...@@ -48,7 +48,7 @@ import { s__ } from '~/locale'; ...@@ -48,7 +48,7 @@ import { s__ } from '~/locale';
}, },
decorateFiles(files) { decorateFiles(files) {
files.forEach(file => { files.forEach((file) => {
file.content = ''; file.content = '';
file.resolutionData = {}; file.resolutionData = {};
file.promptDiscardConfirmation = false; file.promptDiscardConfirmation = false;
...@@ -72,7 +72,7 @@ import { s__ } from '~/locale'; ...@@ -72,7 +72,7 @@ import { s__ } from '~/locale';
setInlineLine(file) { setInlineLine(file) {
file.inlineLines = []; file.inlineLines = [];
file.sections.forEach(section => { file.sections.forEach((section) => {
let currentLineType = 'new'; let currentLineType = 'new';
const { conflict, lines, id } = section; const { conflict, lines, id } = section;
...@@ -80,7 +80,7 @@ import { s__ } from '~/locale'; ...@@ -80,7 +80,7 @@ import { s__ } from '~/locale';
file.inlineLines.push(this.getHeadHeaderLine(id)); file.inlineLines.push(this.getHeadHeaderLine(id));
} }
lines.forEach(line => { lines.forEach((line) => {
const { type } = line; const { type } = line;
if ((type === 'new' || type === 'old') && currentLineType !== type) { if ((type === 'new' || type === 'old') && currentLineType !== type) {
...@@ -102,7 +102,7 @@ import { s__ } from '~/locale'; ...@@ -102,7 +102,7 @@ import { s__ } from '~/locale';
file.parallelLines = []; file.parallelLines = [];
const linesObj = { left: [], right: [] }; const linesObj = { left: [], right: [] };
file.sections.forEach(section => { file.sections.forEach((section) => {
const { conflict, lines, id } = section; const { conflict, lines, id } = section;
if (conflict) { if (conflict) {
...@@ -110,7 +110,7 @@ import { s__ } from '~/locale'; ...@@ -110,7 +110,7 @@ import { s__ } from '~/locale';
linesObj.right.push(this.getHeadHeaderLine(id)); linesObj.right.push(this.getHeadHeaderLine(id));
} }
lines.forEach(line => { lines.forEach((line) => {
const { type } = line; const { type } = line;
if (conflict) { if (conflict) {
...@@ -156,9 +156,9 @@ import { s__ } from '~/locale'; ...@@ -156,9 +156,9 @@ import { s__ } from '~/locale';
const { files } = this.state.conflictsData; const { files } = this.state.conflictsData;
let count = 0; let count = 0;
files.forEach(file => { files.forEach((file) => {
if (file.type === CONFLICT_TYPES.TEXT) { if (file.type === CONFLICT_TYPES.TEXT) {
file.sections.forEach(section => { file.sections.forEach((section) => {
if (section.conflict) { if (section.conflict) {
count += 1; count += 1;
} }
...@@ -287,14 +287,14 @@ import { s__ } from '~/locale'; ...@@ -287,14 +287,14 @@ import { s__ } from '~/locale';
}, },
restoreFileLinesState(file) { restoreFileLinesState(file) {
file.inlineLines.forEach(line => { file.inlineLines.forEach((line) => {
if (line.hasConflict || line.isHeader) { if (line.hasConflict || line.isHeader) {
line.isSelected = false; line.isSelected = false;
line.isUnselected = false; line.isUnselected = false;
} }
}); });
file.parallelLines.forEach(lines => { file.parallelLines.forEach((lines) => {
const left = lines[0]; const left = lines[0];
const right = lines[1]; const right = lines[1];
const isLeftMatch = left.hasConflict || left.isHeader; const isLeftMatch = left.hasConflict || left.isHeader;
...@@ -362,7 +362,7 @@ import { s__ } from '~/locale'; ...@@ -362,7 +362,7 @@ import { s__ } from '~/locale';
files: [], files: [],
}; };
this.state.conflictsData.files.forEach(file => { this.state.conflictsData.files.forEach((file) => {
const addFile = { const addFile = {
old_path: file.old_path, old_path: file.old_path,
new_path: file.new_path, new_path: file.new_path,
...@@ -388,13 +388,13 @@ import { s__ } from '~/locale'; ...@@ -388,13 +388,13 @@ import { s__ } from '~/locale';
handleSelected(file, sectionId, selection) { handleSelected(file, sectionId, selection) {
Vue.set(file.resolutionData, sectionId, selection); Vue.set(file.resolutionData, sectionId, selection);
file.inlineLines.forEach(line => { file.inlineLines.forEach((line) => {
if (line.id === sectionId && (line.hasConflict || line.isHeader)) { if (line.id === sectionId && (line.hasConflict || line.isHeader)) {
this.markLine(line, selection); this.markLine(line, selection);
} }
}); });
file.parallelLines.forEach(lines => { file.parallelLines.forEach((lines) => {
const left = lines[0]; const left = lines[0];
const right = lines[1]; const right = lines[1];
const hasSameId = right.id === sectionId || left.id === sectionId; const hasSameId = right.id === sectionId || left.id === sectionId;
...@@ -426,7 +426,7 @@ import { s__ } from '~/locale'; ...@@ -426,7 +426,7 @@ import { s__ } from '~/locale';
}, },
fileTextTypePresent() { fileTextTypePresent() {
return this.state.conflictsData.files.some(f => f.type === CONFLICT_TYPES.TEXT); return this.state.conflictsData.files.some((f) => f.type === CONFLICT_TYPES.TEXT);
}, },
}; };
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
...@@ -31,7 +31,7 @@ function MergeRequest(opts) { ...@@ -31,7 +31,7 @@ function MergeRequest(opts) {
fieldName: 'description', fieldName: 'description',
selector: '.detail-page-description', selector: '.detail-page-description',
lockVersion: this.$el.data('lockVersion'), lockVersion: this.$el.data('lockVersion'),
onSuccess: result => { onSuccess: (result) => {
document.querySelector('#task_status').innerText = result.task_status; document.querySelector('#task_status').innerText = result.task_status;
document.querySelector('#task_status_short').innerText = result.task_status_short; document.querySelector('#task_status_short').innerText = result.task_status_short;
}, },
...@@ -69,8 +69,8 @@ MergeRequest.prototype.initMRBtnListeners = function () { ...@@ -69,8 +69,8 @@ MergeRequest.prototype.initMRBtnListeners = function () {
const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
if (draftToggles.length) { if (draftToggles.length) {
draftToggles.forEach(draftToggle => { draftToggles.forEach((draftToggle) => {
draftToggle.addEventListener('click', e => { draftToggle.addEventListener('click', (e) => {
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
...@@ -127,7 +127,7 @@ MergeRequest.prototype.submitNoteForm = function (form, $button) { ...@@ -127,7 +127,7 @@ MergeRequest.prototype.submitNoteForm = function (form, $button) {
}; };
MergeRequest.prototype.initCommitMessageListeners = function () { MergeRequest.prototype.initCommitMessageListeners = function () {
$(document).on('click', 'a.js-with-description-link', e => { $(document).on('click', 'a.js-with-description-link', (e) => {
const textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
...@@ -136,7 +136,7 @@ MergeRequest.prototype.initCommitMessageListeners = function () { ...@@ -136,7 +136,7 @@ MergeRequest.prototype.initCommitMessageListeners = function () {
$('.js-without-description-hint').show(); $('.js-without-description-hint').show();
}); });
$(document).on('click', 'a.js-without-description-link', e => { $(document).on('click', 'a.js-without-description-link', (e) => {
const textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
...@@ -180,7 +180,7 @@ MergeRequest.toggleDraftStatus = function (title, isReady) { ...@@ -180,7 +180,7 @@ MergeRequest.toggleDraftStatus = function (title, isReady) {
const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
if (draftToggles.length) { if (draftToggles.length) {
draftToggles.forEach(el => { draftToggles.forEach((el) => {
const draftToggle = el; const draftToggle = el;
const url = setUrlParams( const url = setUrlParams(
{ 'merge_request[wip_event]': isReady ? 'wip' : 'unwip' }, { 'merge_request[wip_event]': isReady ? 'wip' : 'unwip' },
......
...@@ -128,7 +128,7 @@ export default class MergeRequestTabs { ...@@ -128,7 +128,7 @@ export default class MergeRequestTabs {
bindEvents() { bindEvents() {
$('.merge-request-tabs a[data-toggle="tabvue"]').on('click', this.clickTab); $('.merge-request-tabs a[data-toggle="tabvue"]').on('click', this.clickTab);
window.addEventListener('popstate', event => { window.addEventListener('popstate', (event) => {
if (event.state && event.state.action) { if (event.state && event.state.action) {
this.tabShown(event.state.action, event.target.location); this.tabShown(event.state.action, event.target.location);
this.currentAction = event.state.action; this.currentAction = event.state.action;
...@@ -177,14 +177,14 @@ export default class MergeRequestTabs { ...@@ -177,14 +177,14 @@ export default class MergeRequestTabs {
this.currentTab = action; this.currentTab = action;
if (this.mergeRequestTabPanesAll) { if (this.mergeRequestTabPanesAll) {
this.mergeRequestTabPanesAll.forEach(el => { this.mergeRequestTabPanesAll.forEach((el) => {
const tabPane = el; const tabPane = el;
tabPane.style.display = 'none'; tabPane.style.display = 'none';
}); });
} }
if (this.mergeRequestTabsAll) { if (this.mergeRequestTabsAll) {
this.mergeRequestTabsAll.forEach(el => { this.mergeRequestTabsAll.forEach((el) => {
el.classList.remove('active'); el.classList.remove('active');
}); });
} }
......
...@@ -11,7 +11,7 @@ export default class Milestone { ...@@ -11,7 +11,7 @@ export default class Milestone {
} }
bindTabsSwitching() { bindTabsSwitching() {
return $('a[data-toggle="tab"]').on('show.bs.tab', e => { return $('a[data-toggle="tab"]').on('show.bs.tab', (e) => {
const $target = $(e.target); const $target = $(e.target);
window.location.hash = $target.attr('href'); window.location.hash = $target.attr('href');
......
...@@ -89,7 +89,7 @@ export default class MilestoneSelect { ...@@ -89,7 +89,7 @@ export default class MilestoneSelect {
return getMilestones(contextId, reqParams) return getMilestones(contextId, reqParams)
.then(({ data }) => .then(({ data }) =>
data data
.map(m => ({ .map((m) => ({
...m, ...m,
// Public API includes `title` instead of `name`. // Public API includes `title` instead of `name`.
name: m.title, name: m.title,
...@@ -105,7 +105,7 @@ export default class MilestoneSelect { ...@@ -105,7 +105,7 @@ export default class MilestoneSelect {
return 0; return 0;
}), }),
) )
.then(data => { .then((data) => {
const extraOptions = []; const extraOptions = [];
if (showAny) { if (showAny) {
extraOptions.push({ extraOptions.push({
...@@ -146,7 +146,7 @@ export default class MilestoneSelect { ...@@ -146,7 +146,7 @@ export default class MilestoneSelect {
$(`[data-milestone-id="${selectedMilestone}"] > a`).addClass('is-active'); $(`[data-milestone-id="${selectedMilestone}"] > a`).addClass('is-active');
}); });
}, },
renderRow: milestone => { renderRow: (milestone) => {
const milestoneName = milestone.title || milestone.name; const milestoneName = milestone.title || milestone.name;
let milestoneDisplayName = escape(milestoneName); let milestoneDisplayName = escape(milestoneName);
...@@ -178,8 +178,8 @@ export default class MilestoneSelect { ...@@ -178,8 +178,8 @@ export default class MilestoneSelect {
}, },
defaultLabel, defaultLabel,
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
text: milestone => escape(milestone.title), text: (milestone) => escape(milestone.title),
id: milestone => { id: (milestone) => {
if (milestone !== undefined) { if (milestone !== undefined) {
if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) { if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
return milestone.name; return milestone.name;
...@@ -193,7 +193,7 @@ export default class MilestoneSelect { ...@@ -193,7 +193,7 @@ export default class MilestoneSelect {
// display:block overrides the hide-collapse rule // display:block overrides the hide-collapse rule
return $value.css('display', ''); return $value.css('display', '');
}, },
opened: e => { opened: (e) => {
const $el = $(e.currentTarget); const $el = $(e.currentTarget);
if ($dropdown.hasClass('js-issue-board-sidebar') || options.handleClick) { if ($dropdown.hasClass('js-issue-board-sidebar') || options.handleClick) {
selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault; selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault;
...@@ -202,7 +202,7 @@ export default class MilestoneSelect { ...@@ -202,7 +202,7 @@ export default class MilestoneSelect {
$(`[data-milestone-id="${selectedMilestone}"] > a`, $el).addClass('is-active'); $(`[data-milestone-id="${selectedMilestone}"] > a`, $el).addClass('is-active');
}, },
vue: $dropdown.hasClass('js-issue-board-sidebar'), vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: clickEvent => { clicked: (clickEvent) => {
const { e } = clickEvent; const { e } = clickEvent;
let selected = clickEvent.selectedObj; let selected = clickEvent.selectedObj;
......
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
value: { value: {
immediate: true, immediate: true,
handler() { handler() {
const milestoneTitles = this.value.map(milestone => const milestoneTitles = this.value.map((milestone) =>
milestone.title ? milestone.title : milestone, milestone.title ? milestone.title : milestone,
); );
if (!isEqual(milestoneTitles, this.selectedMilestones)) { if (!isEqual(milestoneTitles, this.selectedMilestones)) {
......
...@@ -41,10 +41,10 @@ export const fetchProjectMilestones = ({ commit, state }) => { ...@@ -41,10 +41,10 @@ export const fetchProjectMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.projectMilestones(state.projectId) Api.projectMilestones(state.projectId)
.then(response => { .then((response) => {
commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response); commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error); commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -56,10 +56,10 @@ export const fetchGroupMilestones = ({ commit, state }) => { ...@@ -56,10 +56,10 @@ export const fetchGroupMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.groupMilestones(state.groupId) Api.groupMilestones(state.groupId)
.then(response => { .then((response) => {
commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response); commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error); commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -76,10 +76,10 @@ export const searchProjectMilestones = ({ commit, state }) => { ...@@ -76,10 +76,10 @@ export const searchProjectMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.projectSearch(state.projectId, options) Api.projectSearch(state.projectId, options)
.then(response => { .then((response) => {
commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response); commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error); commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -95,10 +95,10 @@ export const searchGroupMilestones = ({ commit, state }) => { ...@@ -95,10 +95,10 @@ export const searchGroupMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.groupMilestones(state.groupId, options) Api.groupMilestones(state.groupId, options)
.then(response => { .then((response) => {
commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response); commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error); commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
......
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
}, },
[types.REMOVE_SELECTED_MILESTONE](state, selectedMilestone) { [types.REMOVE_SELECTED_MILESTONE](state, selectedMilestone) {
const filteredMilestones = state.selectedMilestones.filter( const filteredMilestones = state.selectedMilestones.filter(
milestone => milestone !== selectedMilestone, (milestone) => milestone !== selectedMilestone,
); );
Vue.set(state, 'selectedMilestones', filteredMilestones); Vue.set(state, 'selectedMilestones', filteredMilestones);
}, },
......
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