Commit 8639c778 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'leipert-prettier-arrow-parens-3' into 'master'

Format files with prettier arrowParens [3/15]

See merge request gitlab-org/gitlab!50528
parents ac332957 73993b43
......@@ -10,177 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss
*.md
## relaxed-kilby
app/assets/javascripts/ci_variable_list/store/actions.js
app/assets/javascripts/ci_variable_list/store/getters.js
app/assets/javascripts/ci_variable_list/store/utils.js
app/assets/javascripts/clone_panel.js
app/assets/javascripts/clusters/clusters_bundle.js
app/assets/javascripts/clusters/components/fluentd_output_settings.vue
app/assets/javascripts/clusters/forms/stores/index.js
app/assets/javascripts/clusters/stores/clusters_store.js
app/assets/javascripts/clusters/stores/new_cluster/index.js
app/assets/javascripts/clusters_list/components/clusters.vue
app/assets/javascripts/clusters_list/load_clusters.js
app/assets/javascripts/clusters_list/store/actions.js
app/assets/javascripts/clusters_list/store/index.js
app/assets/javascripts/code_navigation/index.js
app/assets/javascripts/code_navigation/store/actions.js
app/assets/javascripts/code_navigation/utils/index.js
app/assets/javascripts/commit/image_file.js
app/assets/javascripts/commit/pipelines/pipelines_bundle.js
app/assets/javascripts/commit_merge_requests.js
app/assets/javascripts/commons/nav/user_merge_requests.js
app/assets/javascripts/compare_autocomplete.js
app/assets/javascripts/confidential_merge_request/components/project_form_group.vue
app/assets/javascripts/confirm_danger_modal.js
app/assets/javascripts/confirm_modal.js
app/assets/javascripts/contributors/components/contributors.vue
app/assets/javascripts/contributors/stores/actions.js
app/assets/javascripts/contributors/stores/getters.js
app/assets/javascripts/contributors/utils.js
app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue
app/assets/javascripts/create_cluster/eks_cluster/index.js
app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js
## lucid-lederberg
app/assets/javascripts/create_cluster/eks_cluster/store/actions.js
app/assets/javascripts/create_cluster/eks_cluster/store/state.js
app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js
app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue
app/assets/javascripts/create_cluster/gke_cluster/index.js
app/assets/javascripts/create_cluster/gke_cluster/store/actions.js
app/assets/javascripts/create_cluster/gke_cluster/store/getters.js
app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js
app/assets/javascripts/create_cluster/init_create_cluster.js
app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js
app/assets/javascripts/create_item_dropdown.js
app/assets/javascripts/create_label.js
app/assets/javascripts/create_merge_request_dropdown.js
app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue
app/assets/javascripts/custom_metrics/constants.js
app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
app/assets/javascripts/cycle_analytics/cycle_analytics_service.js
app/assets/javascripts/cycle_analytics/cycle_analytics_store.js
app/assets/javascripts/deploy_freeze/store/actions.js
app/assets/javascripts/deploy_freeze/store/index.js
app/assets/javascripts/deploy_freeze/store/mutations.js
app/assets/javascripts/deploy_keys/components/app.vue
app/assets/javascripts/deploy_keys/components/key.vue
app/assets/javascripts/deploy_keys/service/index.js
app/assets/javascripts/deploy_keys/store/index.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js
app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
app/assets/javascripts/design_management/components/design_presentation.vue
app/assets/javascripts/design_management/components/design_sidebar.vue
app/assets/javascripts/design_management/components/design_todo_button.vue
## loving-feistel
app/assets/javascripts/design_management/components/toolbar/design_navigation.vue
app/assets/javascripts/design_management/components/toolbar/index.vue
app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue
app/assets/javascripts/design_management/graphql.js
app/assets/javascripts/design_management/mixins/all_designs.js
app/assets/javascripts/design_management/mixins/all_versions.js
app/assets/javascripts/design_management/pages/design/index.vue
app/assets/javascripts/design_management/pages/index.vue
app/assets/javascripts/design_management/utils/cache_update.js
app/assets/javascripts/design_management/utils/design_management_utils.js
app/assets/javascripts/design_management/utils/error_messages.js
app/assets/javascripts/diff.js
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/compare_dropdown_layout.vue
app/assets/javascripts/diffs/components/diff_content.vue
app/assets/javascripts/diffs/components/diff_expansion_cell.vue
app/assets/javascripts/diffs/components/diff_file.vue
app/assets/javascripts/diffs/components/diff_gutter_avatars.vue
app/assets/javascripts/diffs/components/diff_line_note_form.vue
app/assets/javascripts/diffs/components/diff_row_utils.js
app/assets/javascripts/diffs/components/parallel_diff_table_row.vue
app/assets/javascripts/diffs/components/tree_list.vue
app/assets/javascripts/diffs/index.js
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/getters_versions_dropdowns.js
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/utils.js
app/assets/javascripts/diffs/utils/diff_file.js
app/assets/javascripts/diffs/workers/tree_worker.js
app/assets/javascripts/dirty_submit/dirty_submit_collection.js
app/assets/javascripts/dirty_submit/dirty_submit_form.js
## distracted-nash
app/assets/javascripts/droplab/drop_down.js
app/assets/javascripts/droplab/drop_lab.js
app/assets/javascripts/droplab/hook_button.js
app/assets/javascripts/droplab/hook_input.js
app/assets/javascripts/droplab/plugins/ajax.js
app/assets/javascripts/droplab/plugins/ajax_filter.js
app/assets/javascripts/droplab/plugins/input_setter.js
app/assets/javascripts/due_date_select.js
app/assets/javascripts/editor/editor_lite.js
app/assets/javascripts/editor/editor_markdown_ext.js
app/assets/javascripts/editor/utils.js
app/assets/javascripts/emoji/index.js
app/assets/javascripts/emoji/no_emoji_validator.js
app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js
app/assets/javascripts/emoji/support/unicode_support_map.js
app/assets/javascripts/environments/components/environment_item.vue
app/assets/javascripts/environments/components/environment_rollback.vue
app/assets/javascripts/environments/components/environments_app.vue
app/assets/javascripts/environments/components/environments_table.vue
app/assets/javascripts/environments/mixins/environments_mixin.js
app/assets/javascripts/environments/stores/environments_store.js
app/assets/javascripts/error_tracking/components/error_details.vue
app/assets/javascripts/error_tracking/store/actions.js
app/assets/javascripts/error_tracking/store/details/actions.js
app/assets/javascripts/error_tracking/store/details/getters.js
app/assets/javascripts/error_tracking/store/list/mutations.js
app/assets/javascripts/error_tracking/utils.js
app/assets/javascripts/error_tracking_settings/store/actions.js
app/assets/javascripts/error_tracking_settings/store/getters.js
app/assets/javascripts/error_tracking_settings/store/mutations.js
app/assets/javascripts/error_tracking_settings/utils.js
## modest-mayer
app/assets/javascripts/experimental_flags.js
app/assets/javascripts/feature_flags/components/edit_feature_flag.vue
app/assets/javascripts/feature_flags/components/feature_flags.vue
app/assets/javascripts/feature_flags/components/feature_flags_table.vue
app/assets/javascripts/feature_flags/components/form.vue
app/assets/javascripts/feature_flags/components/new_feature_flag.vue
app/assets/javascripts/feature_flags/store/edit/actions.js
app/assets/javascripts/feature_flags/store/edit/index.js
app/assets/javascripts/feature_flags/store/gitlab_user_list/actions.js
app/assets/javascripts/feature_flags/store/gitlab_user_list/index.js
app/assets/javascripts/feature_flags/store/helpers.js
app/assets/javascripts/feature_flags/store/index/actions.js
app/assets/javascripts/feature_flags/store/index/index.js
app/assets/javascripts/feature_flags/store/index/mutations.js
app/assets/javascripts/feature_flags/store/new/actions.js
app/assets/javascripts/feature_flags/store/new/index.js
app/assets/javascripts/feature_flags/utils.js
app/assets/javascripts/feature_highlight/feature_highlight.js
app/assets/javascripts/feature_highlight/feature_highlight_helper.js
app/assets/javascripts/file_pickers.js
app/assets/javascripts/files_comment_button.js
app/assets/javascripts/filterable_list.js
app/assets/javascripts/filtered_search/available_dropdown_mappings.js
app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue
app/assets/javascripts/filtered_search/dropdown_ajax_filter.js
app/assets/javascripts/filtered_search/dropdown_emoji.js
app/assets/javascripts/filtered_search/dropdown_hint.js
app/assets/javascripts/filtered_search/dropdown_non_user.js
app/assets/javascripts/filtered_search/dropdown_utils.js
app/assets/javascripts/filtered_search/filtered_search_dropdown.js
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
app/assets/javascripts/filtered_search/filtered_search_manager.js
app/assets/javascripts/filtered_search/filtered_search_token_keys.js
app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js
app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
## stoic-merkle
app/assets/javascripts/filtered_search/stores/recent_searches_store.js
app/assets/javascripts/filtered_search/visual_token_value.js
......
......@@ -47,7 +47,7 @@ export const addVariable = ({ state, dispatch }) => {
dispatch('receiveAddVariableSuccess');
dispatch('fetchVariables');
})
.catch(error => {
.catch((error) => {
createFlash(error.response.data[0]);
dispatch('receiveAddVariableError', error);
});
......@@ -77,7 +77,7 @@ export const updateVariable = ({ state, dispatch }) => {
dispatch('receiveUpdateVariableSuccess');
dispatch('fetchVariables');
})
.catch(error => {
.catch((error) => {
createFlash(error.response.data[0]);
dispatch('receiveUpdateVariableError', error);
});
......@@ -132,7 +132,7 @@ export const deleteVariable = ({ dispatch, state }) => {
dispatch('receiveDeleteVariableSuccess');
dispatch('fetchVariables');
})
.catch(error => {
.catch((error) => {
createFlash(error.response.data[0]);
dispatch('receiveDeleteVariableError', error);
});
......@@ -150,7 +150,7 @@ export const fetchEnvironments = ({ dispatch, state }) => {
dispatch('requestEnvironments');
return Api.environments(state.projectId)
.then(res => {
.then((res) => {
dispatch('receiveEnvironmentsSuccess', prepareEnvironments(res.data));
})
.catch(() => {
......
import { uniq } from 'lodash';
export const joinedEnvironments = state => {
const scopesFromVariables = (state.variables || []).map(variable => variable.environment_scope);
export const joinedEnvironments = (state) => {
const scopesFromVariables = (state.variables || []).map((variable) => variable.environment_scope);
return uniq(state.environments.concat(scopesFromVariables)).sort();
};
import { cloneDeep } from 'lodash';
import { displayText, types } from '../constants';
const variableTypeHandler = type =>
const variableTypeHandler = (type) =>
type === displayText.variableText ? types.variableType : types.fileType;
export const prepareDataForDisplay = variables => {
export const prepareDataForDisplay = (variables) => {
const variablesToDisplay = [];
variables.forEach(variable => {
variables.forEach((variable) => {
const variableCopy = variable;
if (variableCopy.variable_type === types.variableType) {
variableCopy.variable_type = displayText.variableText;
......@@ -42,4 +42,4 @@ export const prepareDataForApi = (variable, destroy = false) => {
return variableCopy;
};
export const prepareEnvironments = environments => environments.map(e => e.name);
export const prepareEnvironments = (environments) => environments.map((e) => e.name);
......@@ -14,7 +14,7 @@ export default function initClonePanel() {
$(`a:contains('${selectedCloneOption}')`, $cloneOptions).addClass('is-active');
}
$('a', $cloneOptions).on('click', e => {
$('a', $cloneOptions).on('click', (e) => {
e.preventDefault();
const $this = $(e.currentTarget);
const url = $this.attr('href');
......
......@@ -128,7 +128,7 @@ export default class Clusters {
this.initPolling(
'fetchClusterEnvironments',
data => this.handleClusterEnvironmentsSuccess(data),
(data) => this.handleClusterEnvironmentsSuccess(data),
() => this.handleEnvironmentsPollError(),
);
}
......@@ -139,7 +139,7 @@ export default class Clusters {
if (statusPath && !this.environments) {
this.initPolling(
'fetchClusterStatus',
data => this.handleClusterStatusSuccess(data),
(data) => this.handleClusterStatusSuccess(data),
() => this.handlePollError(),
);
}
......@@ -248,15 +248,15 @@ export default class Clusters {
addListeners() {
eventHub.$on('installApplication', this.installApplication);
eventHub.$on('updateApplication', data => this.updateApplication(data));
eventHub.$on('saveKnativeDomain', data => this.saveKnativeDomain(data));
eventHub.$on('setKnativeDomain', data => this.setKnativeDomain(data));
eventHub.$on('uninstallApplication', data => this.uninstallApplication(data));
eventHub.$on('setCrossplaneProviderStack', data => this.setCrossplaneProviderStack(data));
eventHub.$on('setIngressModSecurityEnabled', data => this.setIngressModSecurityEnabled(data));
eventHub.$on('setIngressModSecurityMode', data => this.setIngressModSecurityMode(data));
eventHub.$on('resetIngressModSecurityChanges', id => this.resetIngressModSecurityChanges(id));
eventHub.$on('setFluentdSettings', data => this.setFluentdSettings(data));
eventHub.$on('updateApplication', (data) => this.updateApplication(data));
eventHub.$on('saveKnativeDomain', (data) => this.saveKnativeDomain(data));
eventHub.$on('setKnativeDomain', (data) => this.setKnativeDomain(data));
eventHub.$on('uninstallApplication', (data) => this.uninstallApplication(data));
eventHub.$on('setCrossplaneProviderStack', (data) => this.setCrossplaneProviderStack(data));
eventHub.$on('setIngressModSecurityEnabled', (data) => this.setIngressModSecurityEnabled(data));
eventHub.$on('setIngressModSecurityMode', (data) => this.setIngressModSecurityMode(data));
eventHub.$on('resetIngressModSecurityChanges', (id) => this.resetIngressModSecurityChanges(id));
eventHub.$on('setFluentdSettings', (data) => this.setFluentdSettings(data));
// Add event listener to all the banner close buttons
this.addBannerCloseHandler(this.unreachableContainer, 'unreachable');
this.addBannerCloseHandler(this.authenticationFailureContainer, 'authentication_failure');
......@@ -343,12 +343,12 @@ export default class Clusters {
checkForNewInstalls(prevApplicationMap, newApplicationMap) {
const appTitles = Object.keys(newApplicationMap)
.filter(
appId =>
(appId) =>
newApplicationMap[appId].status === APPLICATION_STATUS.INSTALLED &&
prevApplicationMap[appId].status !== APPLICATION_STATUS.INSTALLED &&
prevApplicationMap[appId].status !== null,
)
.map(appId => newApplicationMap[appId].title);
.map((appId) => newApplicationMap[appId].title);
if (appTitles.length > 0) {
const text = sprintf(
......@@ -450,7 +450,7 @@ export default class Clusters {
);
});
})
.catch(error => this.store.updateAppProperty(appId, 'validationError', error));
.catch((error) => this.store.updateAppProperty(appId, 'validationError', error));
}
static validateInstallation(appId, params) {
......
......@@ -127,7 +127,7 @@ export default {
});
},
updateCurrentServerSideSettings(settings) {
Object.keys(settings).forEach(key => {
Object.keys(settings).forEach((key) => {
if (this.currentServerSideSettings[key] === null) {
this.currentServerSideSettings[key] = this[key];
}
......
......@@ -4,7 +4,7 @@ import state from './state';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
state: state(initialState),
});
......
......@@ -17,7 +17,7 @@ import {
} from '../constants';
import transitionApplicationState from '../services/application_state_machine';
const isApplicationInstalled = appStatus => APPLICATION_INSTALLED_STATUSES.includes(appStatus);
const isApplicationInstalled = (appStatus) => APPLICATION_INSTALLED_STATUSES.includes(appStatus);
const applicationInitialState = {
status: null,
......@@ -195,7 +195,7 @@ export default class ClusterStore {
this.state.status = serverState.status;
this.state.statusReason = serverState.status_reason;
serverState.applications.forEach(serverAppEntry => {
serverState.applications.forEach((serverAppEntry) => {
const {
name: appId,
status,
......@@ -284,7 +284,7 @@ export default class ClusterStore {
}
updateEnvironments(environments = []) {
this.state.environments = environments.map(environment => ({
this.state.environments = environments.map((environment) => ({
name: environment.name,
project: environment.project,
environmentPath: environment.environment_path,
......
......@@ -4,7 +4,7 @@ import state from './state';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
state: state(initialState),
});
......
......@@ -79,7 +79,7 @@ export default {
{
key: 'cluster_type',
label: __('Cluster level'),
formatter: value => CLUSTER_TYPES[value],
formatter: (value) => CLUSTER_TYPES[value],
},
];
},
......
import Clusters from './components/clusters.vue';
import { createStore } from './store';
export default Vue => {
export default (Vue) => {
const el = document.querySelector('#js-clusters-list-app');
if (!el) {
......
......@@ -13,11 +13,11 @@ const allNodesPresent = (clusters, retryCount) => {
They may fail for reasons GitLab cannot control.
MAX_REQUESTS will ensure this poll stops at some point.
*/
return retryCount > MAX_REQUESTS || clusters.every(cluster => cluster.nodes != null);
return retryCount > MAX_REQUESTS || clusters.every((cluster) => cluster.nodes != null);
};
export const reportSentryError = (_store, { error, tag }) => {
Sentry.withScope(scope => {
Sentry.withScope((scope) => {
scope.setTag('javascript_clusters_list', tag);
Sentry.captureException(error);
});
......@@ -30,7 +30,7 @@ export const fetchClusters = ({ state, commit, dispatch }) => {
const poll = new Poll({
resource: {
fetchClusters: paginatedEndPoint => axios.get(paginatedEndPoint),
fetchClusters: (paginatedEndPoint) => axios.get(paginatedEndPoint),
},
data: `${state.endpoint}?page=${state.page}`,
method: 'fetchClusters',
......@@ -59,7 +59,7 @@ export const fetchClusters = ({ state, commit, dispatch }) => {
dispatch('reportSentryError', { error, tag: 'fetchClustersSuccessCallback' });
}
},
errorCallback: response => {
errorCallback: (response) => {
poll.stop();
commit(types.SET_LOADING_CLUSTERS, false);
......
......@@ -6,7 +6,7 @@ import * as actions from './actions';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -3,7 +3,7 @@ import Vuex from 'vuex';
import createStore from './store';
import App from './components/app.vue';
export default initialData => {
export default (initialData) => {
const el = document.getElementById('js-code-navigation');
if (!el) return null;
......
......@@ -34,7 +34,7 @@ export default {
},
showBlobInteractionZones({ state }, path) {
if (state.data && state.data[path]) {
Object.values(state.data[path]).forEach(d => addInteractionClass(path, d));
Object.values(state.data[path]).forEach((d) => addInteractionClass(path, d));
}
},
showDefinition({ commit, state }, { target: el }) {
......
export const cachedData = new Map();
export const getCurrentHoverElement = () => cachedData.get('current');
export const setCurrentHoverElement = el => cachedData.set('current', el);
export const setCurrentHoverElement = (el) => cachedData.set('current', el);
export const addInteractionClass = (path, d) => {
const lineNumber = d.start_line + 1;
......@@ -10,7 +10,7 @@ export const addInteractionClass = (path, d) => {
.querySelectorAll(`.blob-content #LC${lineNumber}, .line_content:not(.old) #LC${lineNumber}`);
if (!lines?.length) return;
lines.forEach(line => {
lines.forEach((line) => {
let charCount = 0;
const el = [...line.childNodes].find(({ textContent }) => {
if (charCount === d.start_char) return true;
......
......@@ -28,7 +28,7 @@ export default class ImageFile {
initViewModes() {
const viewMode = viewModes[0];
$('.view-modes', this.file).removeClass('gl-display-none');
$('.view-modes-menu', this.file).on('click', 'li', event => {
$('.view-modes-menu', this.file).on('click', 'li', (event) => {
if (!$(event.currentTarget).hasClass('active')) {
return this.activateViewMode(event.currentTarget.className);
}
......
......@@ -21,7 +21,7 @@ export default () => {
if (pipelineTableViewEl) {
// Update MR and Commits tabs
pipelineTableViewEl.addEventListener('update-pipelines-count', event => {
pipelineTableViewEl.addEventListener('update-pipelines-count', (event) => {
if (
event.detail.pipelines &&
event.detail.pipelines.count &&
......
......@@ -50,7 +50,7 @@ export function createContent(mergeRequests) {
if (mergeRequests.length === 0) {
$content.text(s__('Commits|No related merge requests found'));
} else {
mergeRequests.forEach(mergeRequest => {
mergeRequests.forEach((mergeRequest) => {
const $header = createHeader($content.children().length, mergeRequests.length);
const $item = createItem(mergeRequest);
$content.append($header);
......@@ -66,7 +66,7 @@ export function fetchCommitMergeRequests() {
axios
.get($container.data('projectCommitPath'))
.then(response => {
.then((response) => {
const $content = createContent(response.data);
$container.html($content);
......
......@@ -27,7 +27,7 @@ export function refreshUserMergeRequestCounts() {
updateUserMergeRequestCounts(count);
broadcastCount(count);
})
.catch(ex => {
.catch((ex) => {
console.error(ex); // eslint-disable-line no-console
});
}
......@@ -59,7 +59,7 @@ export function openUserCountsBroadcast() {
const currentUserId = typeof gon !== 'undefined' && gon && gon.current_user_id;
if (currentUserId) {
channel = new BroadcastChannel(`mr_count_channel_${currentUserId}`);
channel.onmessage = ev => {
channel.onmessage = (ev) => {
updateUserMergeRequestCounts(ev.data);
};
}
......
......@@ -63,7 +63,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
},
clicked: () => clickHandler($dropdown),
});
$filterInput.on('keyup', e => {
$filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return;
const text = $filterInput.val();
......@@ -72,7 +72,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
$dropdownContainer.removeClass('open');
});
$dropdownContainer.on('click', '.dropdown-content a', e => {
$dropdownContainer.on('click', '.dropdown-content a', (e) => {
$dropdown.prop('title', e.target.text.replace(/_+?/g, '-'));
if ($dropdown.hasClass('has-tooltip')) {
fixTitle($dropdown);
......
......@@ -61,7 +61,7 @@ export default {
}
},
normalizeProjectData(data) {
return data.map(p => ({
return data.map((p) => ({
id: p.id,
name: p.name_with_namespace,
pathWithNamespace: p.path_with_namespace,
......@@ -78,7 +78,7 @@ export default {
this.projects = this.normalizeProjectData(data);
this.selectProject(this.projects[0]);
})
.catch(e => {
.catch((e) => {
createFlash(__('Error fetching forked projects. Please try again.'));
throw e;
});
......
......@@ -47,7 +47,7 @@ function getModal($btn) {
}
export default function initConfirmDangerModal() {
$(document).on('click', '.js-confirm-danger', e => {
$(document).on('click', '.js-confirm-danger', (e) => {
const $btn = $(e.target);
const checkFieldName = $btn.data('checkFieldName');
const checkFieldCompareValue = $btn.data('checkCompareValue');
......
import Vue from 'vue';
import ConfirmModal from '~/vue_shared/components/confirm_modal.vue';
const mountConfirmModal = optionalProps =>
const mountConfirmModal = (optionalProps) =>
new Vue({
render(h) {
return h(ConfirmModal, {
......
......@@ -39,7 +39,7 @@ export default {
...mapGetters(['showChart', 'parsedData']),
masterChartData() {
const data = {};
this.xAxisRange.forEach(date => {
this.xAxisRange.forEach((date) => {
data[date] = this.parsedData.total[date] || 0;
});
return [
......@@ -67,7 +67,7 @@ export default {
const maxNumberOfIndividualContributorsCharts = 100;
return Object.keys(this.parsedData.byAuthorEmail)
.map(email => {
.map((email) => {
const author = this.parsedData.byAuthorEmail[email];
return {
name: author.name,
......@@ -76,7 +76,7 @@ export default {
dates: [
{
name: __('Commits'),
data: this.xAxisRange.map(date => [date, author.dates[date] || 0]),
data: this.xAxisRange.map((date) => [date, author.dates[date] || 0]),
},
],
};
......@@ -101,7 +101,7 @@ export default {
},
individualChartYAxisMax() {
return this.individualChartsData.reduce((acc, item) => {
const values = item.dates[0].data.map(value => value[1]);
const values = item.dates[0].data.map((value) => value[1]);
return Math.max(acc, ...values);
}, 0);
},
......@@ -150,7 +150,7 @@ export default {
},
setSvg(name) {
return getSvgIconPathContent(name)
.then(path => {
.then((path) => {
if (path) {
this.$set(this.svgs, name, `path://${path}`);
}
......@@ -177,7 +177,7 @@ export default {
this.individualCharts.push(chart);
},
setIndividualChartsZoom(options) {
this.charts.forEach(chart =>
this.charts.forEach((chart) =>
chart.setOption(
{
dataZoom: {
......
......@@ -8,8 +8,8 @@ export const fetchChartData = ({ commit }, endpoint) => {
return service
.fetchChartData(endpoint)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
commit(types.SET_CHART_DATA, data);
commit(types.SET_LOADING_STATE, false);
})
......
export const showChart = state => Boolean(!state.loading && state.chartData);
export const showChart = (state) => Boolean(!state.loading && state.chartData);
export const parsedData = state => {
export const parsedData = (state) => {
const byAuthorEmail = {};
const total = {};
......
......@@ -9,7 +9,7 @@ import { getMonthNames } from '~/lib/utils/datetime_utility';
* xAxisLabelFormatter('02-12-2019') will return 'Feb'
* xAxisLabelFormatter('07-12-2019') will return 'Jul'
*/
export const xAxisLabelFormatter = val => {
export const xAxisLabelFormatter = (val) => {
const date = new Date(val);
const month = date.getUTCMonth();
const year = date.getUTCFullYear();
......@@ -21,7 +21,7 @@ export const xAxisLabelFormatter = val => {
* @param {Date}
* @returns {String} - formatted value
*/
export const dateFormatter = date => {
export const dateFormatter = (date) => {
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
......
......@@ -6,9 +6,9 @@ import DropdownSearchInput from '~/vue_shared/components/dropdown/dropdown_searc
import DropdownHiddenInput from '~/vue_shared/components/dropdown/dropdown_hidden_input.vue';
import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue';
const toArray = value => (isNil(value) ? [] : [].concat(value));
const itemsProp = (items, prop) => items.map(item => item[prop]);
const defaultSearchFn = (searchQuery, labelProp) => item =>
const toArray = (value) => (isNil(value) ? [] : [].concat(value));
const itemsProp = (items, prop) => items.map((item) => item[prop]);
const defaultSearchFn = (searchQuery, labelProp) => (item) =>
item[labelProp].toLowerCase().indexOf(searchQuery) > -1;
export default {
......@@ -135,7 +135,7 @@ export default {
const valueList = toArray(this.value);
const items = this.getItemsOrEmptyList();
return items.filter(item => valueList.some(value => item[valueProp] === value));
return items.filter((item) => valueList.some((value) => item[valueProp] === value));
},
selectedItemsLabels() {
return itemsProp(this.selectedItems, this.labelProperty).join(', ');
......
......@@ -6,7 +6,7 @@ import createStore from './store';
Vue.use(Vuex);
export default el => {
export default (el) => {
const {
gitlabManagedClusterHelpPath,
namespacePerEnvironmentHelpPath,
......
......@@ -37,7 +37,7 @@ export const fetchVpcs = ({ region }) => {
.describeVpcs()
.promise()
.then(({ Vpcs: vpcs }) =>
vpcs.map(vpc => ({
vpcs.map((vpc) => ({
value: vpc.VpcId,
name: lookupVpcName(vpc),
})),
......
......@@ -5,7 +5,7 @@ import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
const getErrorMessage = data => {
const getErrorMessage = (data) => {
const errorKey = Object.keys(data)[0];
return data[errorKey][0];
......@@ -42,7 +42,7 @@ export const createRole = ({ dispatch, state: { createRolePath } }, payload) =>
dispatch('createRoleSuccess', awsData);
})
.catch(error => {
.catch((error) => {
let message = error;
if (error?.response?.data?.message) {
message = error.response.data.message;
......
import { KUBERNETES_VERSIONS } from '../constants';
const kubernetesVersion = KUBERNETES_VERSIONS.find(version => version.default).value;
const kubernetesVersion = KUBERNETES_VERSIONS.find((version) => version.default).value;
export default () => ({
createRolePath: null,
......
......@@ -42,13 +42,13 @@ export default {
return [];
}
return this.items.filter(item => item.name.toLowerCase().indexOf(this.searchQuery) > -1);
return this.items.filter((item) => item.name.toLowerCase().indexOf(this.searchQuery) > -1);
},
},
methods: {
fetchSuccessHandler() {
if (this.defaultValue) {
const itemToSelect = this.items.find(item => item.name === this.defaultValue);
const itemToSelect = this.items.find((item) => item.name === this.defaultValue);
if (itemToSelect) {
this.setItem(itemToSelect.name);
......
......@@ -106,7 +106,7 @@ export default {
...mapActions({ setItem: 'setProject' }),
fetchSuccessHandler() {
if (this.defaultValue) {
const projectToSelect = this.items.find(item => item.projectId === this.defaultValue);
const projectToSelect = this.items.find((item) => item.projectId === this.defaultValue);
if (projectToSelect) {
this.setItem(projectToSelect);
......
......@@ -22,7 +22,7 @@ const mountComponent = (entryPoint, component, componentName, extraProps = {}) =
components: {
[componentName]: component,
},
render: createElement =>
render: (createElement) =>
createElement(componentName, {
props: {
fieldName: hiddenInput.getAttribute('name'),
......
......@@ -6,14 +6,14 @@ const gapiResourceListRequest = ({ resource, params, commit, mutation, payloadKe
const request = resource.list(params);
return request.then(
resp => {
(resp) => {
const { result } = resp;
commit(mutation, result[payloadKey]);
resolve();
},
resp => {
(resp) => {
reject(resp);
},
);
......@@ -54,14 +54,14 @@ export const validateProjectBilling = ({ dispatch, commit, state }) =>
commit(types.SET_MACHINE_TYPE, '');
return request.then(
resp => {
(resp) => {
const { billingEnabled } = resp.result;
commit(types.SET_PROJECT_BILLING_STATUS, Boolean(billingEnabled));
dispatch('setIsValidatingProjectBilling', false);
resolve();
},
resp => {
(resp) => {
dispatch('setIsValidatingProjectBilling', false);
reject(resp);
},
......
export const hasProject = state => Boolean(state.selectedProject.projectId);
export const hasZone = state => Boolean(state.selectedZone);
export const hasMachineType = state => Boolean(state.selectedMachineType);
export const hasProject = (state) => Boolean(state.selectedProject.projectId);
export const hasZone = (state) => Boolean(state.selectedZone);
export const hasMachineType = (state) => Boolean(state.selectedMachineType);
export const hasValidData = (state, getters) =>
Boolean(state.projectHasBillingEnabled) && getters.hasZone && getters.hasMachineType;
......@@ -12,7 +12,7 @@ const setDisabled = (el, isDisabled) => {
}
};
const setState = glManagedCheckbox => {
const setState = (glManagedCheckbox) => {
const glManaged = document.querySelector('.js-namespace-prefixed');
const selfManaged = document.querySelector('.js-namespace');
......
......@@ -4,11 +4,11 @@ import PersistentUserCallout from '~/persistent_user_callout';
const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:create_user'];
const isProjectLevelCluster = page => page.startsWith('project:clusters');
const isProjectLevelCluster = (page) => page.startsWith('project:clusters');
export default document => {
export default (document) => {
const { page } = document.body.dataset;
const isNewClusterView = newClusterViews.some(view => page.endsWith(view));
const isNewClusterView = newClusterViews.some((view) => page.endsWith(view));
if (!isNewClusterView) {
return;
......
import * as types from './mutation_types';
export default fetchItems => ({
export default (fetchItems) => ({
requestItems: ({ commit }) => commit(types.REQUEST_ITEMS),
receiveItemsSuccess: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_SUCCESS, payload),
receiveItemsError: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_ERROR, payload),
......@@ -8,7 +8,7 @@ export default fetchItems => ({
dispatch('requestItems');
return fetchItems(payload)
.then(items => dispatch('receiveItemsSuccess', { items }))
.catch(error => dispatch('receiveItemsError', { error }));
.then((items) => dispatch('receiveItemsSuccess', { items }))
.catch((error) => dispatch('receiveItemsError', { error }));
},
});
......@@ -47,7 +47,7 @@ export default class CreateItemDropdown {
return escape(item.id);
},
onFilter: this.toggleCreateNewButton.bind(this),
clicked: options => {
clicked: (options) => {
options.e.preventDefault();
this.onSelect();
},
......@@ -79,7 +79,7 @@ export default class CreateItemDropdown {
this.getDataOption(term, (data = []) => {
// Ensure the selected item isn't already in the data to avoid duplicates
const alreadyHasSelectedItem =
this.selectedItem && data.some(item => item.id === this.selectedItem.id);
this.selectedItem && data.some((item) => item.id === this.selectedItem.id);
let uniqueData = data;
if (!alreadyHasSelectedItem) {
......
......@@ -56,7 +56,7 @@ export default class CreateLabelDropdown {
this.$dropdownBack.on('click', this.resetForm.bind(this));
this.$cancelButton.on('click', e => {
this.$cancelButton.on('click', (e) => {
e.preventDefault();
e.stopPropagation();
......@@ -105,7 +105,7 @@ export default class CreateLabelDropdown {
title: this.$newLabelField.val(),
color: this.$newColorField.val(),
},
label => {
(label) => {
this.$newLabelCreateButton.enable();
if (label.message) {
......@@ -115,7 +115,7 @@ export default class CreateLabelDropdown {
errors = label.message;
} else {
errors = Object.keys(label.message)
.map(key => `${humanize(key)} ${label.message[key].join(', ')}`)
.map((key) => `${humanize(key)} ${label.message[key].join(', ')}`)
.join('<br/>');
}
......
......@@ -191,7 +191,7 @@ export default class CreateMergeRequestDropdown {
static findByValue(objects, ref, returnFirstMatch = false) {
if (!objects || !objects.length) return false;
if (objects.indexOf(ref) > -1) return ref;
if (returnFirstMatch) return objects.find(item => new RegExp(`^${ref}`).test(item));
if (returnFirstMatch) return objects.find((item) => new RegExp(`^${ref}`).test(item));
return false;
}
......@@ -356,7 +356,7 @@ export default class CreateMergeRequestDropdown {
event.preventDefault();
if (isConfidentialIssue() && !event.target.classList.contains('js-create-target')) {
this.droplab.hooks.forEach(hook => hook.list.toggle());
this.droplab.hooks.forEach((hook) => hook.list.toggle());
return;
}
......@@ -404,8 +404,8 @@ export default class CreateMergeRequestDropdown {
const inputClasses = ['gl-field-error-outline', 'gl-field-success-outline'];
const messageClasses = ['text-muted', 'text-danger', 'text-success'];
inputClasses.forEach(cssClass => input.classList.remove(cssClass));
messageClasses.forEach(cssClass => message.classList.remove(cssClass));
inputClasses.forEach((cssClass) => input.classList.remove(cssClass));
messageClasses.forEach((cssClass) => message.classList.remove(cssClass));
message.style.display = 'none';
}
......
......@@ -22,7 +22,7 @@ let cancelTokenSource;
function backOffRequest(makeRequestCallback) {
return backOff((next, stop) => {
makeRequestCallback()
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
stop(resp);
} else {
......@@ -32,7 +32,7 @@ function backOffRequest(makeRequestCallback) {
// If the request is cancelled by axios
// then consider it as noop so that its not
// caught by subsequent catches
.catch(thrown => (axios.isCancel(thrown) ? undefined : stop(thrown)));
.catch((thrown) => (axios.isCancel(thrown) ? undefined : stop(thrown)));
}, VALIDATION_REQUEST_TIMEOUT);
}
......@@ -144,7 +144,7 @@ export default {
// as well.
cancelTokenSource = axiosCancelToken.source();
this.requestValidation(this.query, cancelTokenSource.token)
.then(res => {
.then((res) => {
const response = res.data;
const { valid, error } = response.query;
if (response.success) {
......
......@@ -4,9 +4,9 @@ export const queryTypes = {
system: 'system',
};
export const formDataValidator = val => {
export const formDataValidator = (val) => {
const fieldNames = Object.keys(val);
const requiredFields = ['title', 'query', 'yLabel', 'unit', 'group', 'legend'];
return requiredFields.every(name => fieldNames.includes(name));
return requiredFields.every((name) => fieldNames.includes(name));
};
......@@ -78,7 +78,7 @@ export default () => {
$dropdown
.find('li a')
.off('click')
.on('click', e => {
.on('click', (e) => {
e.preventDefault();
const $target = $(e.currentTarget);
this.startDate = $target.data('value');
......@@ -94,7 +94,7 @@ export default () => {
this.service
.fetchCycleAnalyticsData(fetchOptions)
.then(response => {
.then((response) => {
this.store.setCycleAnalyticsData(response);
this.selectDefaultStage();
this.initDropdown();
......@@ -128,7 +128,7 @@ export default () => {
startDate: this.startDate,
projectIds: this.selectedProjectIds,
})
.then(response => {
.then((response) => {
this.isEmptyStage = !response.events.length;
this.store.setStageEvents(response.events, stage);
this.isLoadingStage = false;
......
......@@ -17,7 +17,7 @@ export default class CycleAnalyticsService {
'cycle_analytics[project_ids]': projectIds,
},
})
.then(x => x.data);
.then((x) => x.data);
}
fetchStageData(options) {
......@@ -30,6 +30,6 @@ export default class CycleAnalyticsService {
'cycle_analytics[project_ids]': projectIds,
},
})
.then(x => x.data);
.then((x) => x.data);
}
}
......@@ -42,11 +42,11 @@ export default {
newData.stages = data.stats || [];
newData.summary = data.summary || [];
newData.summary.forEach(item => {
newData.summary.forEach((item) => {
item.value = item.value || '-';
});
newData.stages.forEach(item => {
newData.stages.forEach((item) => {
const stageSlug = dasherize(item.name.toLowerCase());
item.active = false;
item.isUserAllowed = data.permissions[stageSlug];
......@@ -64,7 +64,7 @@ export default {
this.state.hasError = state;
},
deactivateAllStages() {
this.state.stages.forEach(stage => {
this.state.stages.forEach((stage) => {
stage.active = false;
});
},
......@@ -78,7 +78,7 @@ export default {
decorateEvents(events, stage) {
const newEvents = [];
events.forEach(item => {
events.forEach((item) => {
if (!item) return;
const eventItem = { ...DEFAULT_EVENT_OBJECTS[stage.slug], ...item };
......@@ -107,6 +107,6 @@ export default {
return newEvents;
},
currentActiveStage() {
return this.state.stages.find(stage => stage.active);
return this.state.stages.find((stage) => stage.active);
},
};
......@@ -28,7 +28,7 @@ export const addFreezePeriod = ({ state, dispatch, commit }) => {
commit(types.RESET_MODAL);
dispatch('fetchFreezePeriods');
})
.catch(error => {
.catch((error) => {
createFlash(__('Error: Unable to create deploy freeze'));
dispatch('receiveAddFreezePeriodError', error);
});
......
......@@ -6,7 +6,7 @@ import createState from './state';
Vue.use(Vuex);
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -4,7 +4,7 @@ import * as types from './mutation_types';
const formatTimezoneName = (freezePeriod, timezoneList) =>
convertObjectPropsToCamelCase({
...freezePeriod,
cron_timezone: timezoneList.find(tz => tz.identifier === freezePeriod.cron_timezone)?.name,
cron_timezone: timezoneList.find((tz) => tz.identifier === freezePeriod.cron_timezone)?.name,
});
export default {
......@@ -14,7 +14,7 @@ export default {
[types.RECEIVE_FREEZE_PERIODS_SUCCESS](state, freezePeriods) {
state.isLoading = false;
state.freezePeriods = freezePeriods.map(freezePeriod =>
state.freezePeriods = freezePeriods.map((freezePeriod) =>
formatTimezoneName(freezePeriod, state.timezoneData),
);
},
......
......@@ -39,7 +39,7 @@ export default {
},
computed: {
tabs() {
return Object.keys(this.$options.scopes).map(scope => {
return Object.keys(this.$options.scopes).map((scope) => {
const count = Array.isArray(this.keys[scope]) ? this.keys[scope].length : null;
return {
......@@ -81,7 +81,7 @@ export default {
return this.service
.getKeys()
.then(data => {
.then((data) => {
this.isLoading = false;
this.store.keys = data;
})
......
......@@ -48,7 +48,7 @@ export default {
if (this.projectId !== null) {
const indexOfCurrentProject = projects.findIndex(
project =>
(project) =>
project &&
project.project &&
project.project.id &&
......
......@@ -6,14 +6,14 @@ export default class DeployKeysService {
}
getKeys() {
return axios.get(this.endpoint).then(response => response.data);
return axios.get(this.endpoint).then((response) => response.data);
}
enableKey(id) {
return axios.put(`${this.endpoint}/${id}/enable`).then(response => response.data);
return axios.put(`${this.endpoint}/${id}/enable`).then((response) => response.data);
}
disableKey(id) {
return axios.put(`${this.endpoint}/${id}/disable`).then(response => response.data);
return axios.put(`${this.endpoint}/${id}/disable`).then((response) => response.data);
}
}
......@@ -4,6 +4,6 @@ export default class DeployKeysStore {
}
isEnabled(id) {
return this.keys.enabled_keys.some(key => key.id === id);
return this.keys.enabled_keys.some((key) => key.id === id);
}
}
......@@ -68,7 +68,7 @@ export class GitLabDropdown {
this.remote = new GitLabDropdownRemote(this.options.data, {
dataType: this.options.dataType,
beforeSend: this.toggleLoading.bind(this),
success: data => {
success: (data) => {
this.fullData = data;
this.parseData(this.fullData);
this.focusTextInput();
......@@ -113,7 +113,7 @@ export class GitLabDropdown {
return $(selector, this.dropdown);
},
data: () => this.fullData,
callback: data => {
callback: (data) => {
this.parseData(data);
if (this.filterInput.val() !== '') {
selector = SELECTABLE_CLASSES;
......@@ -135,13 +135,13 @@ export class GitLabDropdown {
this.dropdown.on('hidden.bs.dropdown', this.hidden);
$(this.el).on('update.label', this.updateLabel);
this.dropdown.on('click', '.dropdown-menu, .dropdown-menu-close', this.shouldPropagate);
this.dropdown.on('keyup', e => {
this.dropdown.on('keyup', (e) => {
// Escape key
if (e.which === 27) {
return $('.dropdown-menu-close', this.dropdown).trigger('click');
}
});
this.dropdown.on('blur', 'a', e => {
this.dropdown.on('blur', 'a', (e) => {
let $dropdownMenu;
let $relatedTarget;
if (e.relatedTarget != null) {
......@@ -153,7 +153,7 @@ export class GitLabDropdown {
}
});
if (this.dropdown.find('.dropdown-toggle-page').length) {
this.dropdown.find('.dropdown-toggle-page, .dropdown-menu-back').on('click', e => {
this.dropdown.find('.dropdown-toggle-page, .dropdown-menu-back').on('click', (e) => {
e.preventDefault();
e.stopPropagation();
return this.togglePage();
......@@ -164,7 +164,7 @@ export class GitLabDropdown {
if (this.dropdown.find('.dropdown-toggle-page').length) {
selector = '.dropdown-page-one .dropdown-content a';
}
this.dropdown.on('click', selector, e => {
this.dropdown.on('click', selector, (e) => {
const $el = $(e.currentTarget);
const selected = self.rowClicked($el);
const selectedObj = selected ? selected[0] : null;
......@@ -221,7 +221,7 @@ export class GitLabDropdown {
else if (isObject(data)) {
html = [];
Object.keys(data).forEach(name => {
Object.keys(data).forEach((name) => {
groupData = data[name];
html.push(
this.renderItem(
......@@ -232,7 +232,7 @@ export class GitLabDropdown {
name,
),
);
this.renderData(groupData, name).map(item => html.push(item));
this.renderData(groupData, name).map((item) => html.push(item));
});
} else {
// Render each row
......@@ -271,7 +271,7 @@ export class GitLabDropdown {
filteredFullData() {
return this.fullData.filter(
r =>
(r) =>
typeof r === 'object' &&
!Object.prototype.hasOwnProperty.call(r, 'beforeDivider') &&
!Object.prototype.hasOwnProperty.call(r, 'header'),
......@@ -389,7 +389,7 @@ export class GitLabDropdown {
...this.options,
icon: this.icon,
highlight: this.highlight,
highlightText: text => this.highlightTextMatches(text, this.filterInput.val()),
highlightText: (text) => this.highlightTextMatches(text, this.filterInput.val()),
highlightTemplate: this.highlightTemplate.bind(this),
parent,
},
......@@ -536,7 +536,7 @@ export class GitLabDropdown {
}
if (this.options.multiSelect) {
Object.keys(selectedObject).forEach(attribute => {
Object.keys(selectedObject).forEach((attribute) => {
$input.attr(`data-${attribute}`, selectedObject[attribute]);
});
}
......@@ -577,7 +577,7 @@ export class GitLabDropdown {
if (this.dropdown.find('.dropdown-toggle-page').length) {
selector = `.dropdown-page-one ${selector}`;
}
return $('body').on('keydown', e => {
return $('body').on('keydown', (e) => {
let $listItems;
let PREV_INDEX;
const currentKeyCode = e.which;
......
......@@ -18,7 +18,7 @@ export class GitLabDropdownFilter {
this.filterInputBlur = (ref = this.options.filterInputBlur) != null ? ref : true;
const $inputContainer = this.input.parent();
const $clearButton = $inputContainer.find('.js-dropdown-input-clear');
$clearButton.on('click', e => {
$clearButton.on('click', (e) => {
// Clear click
e.preventDefault();
e.stopPropagation();
......@@ -27,7 +27,7 @@ export class GitLabDropdownFilter {
// Key events
timeout = '';
this.input
.on('keydown', e => {
.on('keydown', (e) => {
const keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) {
e.preventDefault();
......@@ -46,7 +46,7 @@ export class GitLabDropdownFilter {
return (timeout = setTimeout(() => {
$inputContainer.parent().addClass('is-loading');
return this.options.query(this.input.val(), data => {
return this.options.query(this.input.val(), (data) => {
$inputContainer.parent().removeClass('is-loading');
return this.options.callback(data);
});
......@@ -94,13 +94,13 @@ export class GitLabDropdownFilter {
// }
else if (isObject(data)) {
results = {};
Object.keys(data).forEach(key => {
Object.keys(data).forEach((key) => {
group = data[key];
tmp = fuzzaldrinPlus.filter(group, searchText, {
key: this.options.keys,
});
if (tmp.length) {
results[key] = tmp.map(item => item);
results[key] = tmp.map((item) => item);
}
});
}
......
......@@ -5,7 +5,7 @@ export class GitLabDropdownInput {
this.fieldName = this.options.fieldName || 'field-name';
const $inputContainer = this.input.parent();
const $clearButton = $inputContainer.find('.js-dropdown-input-clear');
$clearButton.on('click', e => {
$clearButton.on('click', (e) => {
// Clear click
e.preventDefault();
e.stopPropagation();
......@@ -13,13 +13,13 @@ export class GitLabDropdownInput {
});
this.input
.on('keydown', e => {
.on('keydown', (e) => {
const keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) {
e.preventDefault();
}
})
.on('input', e => {
.on('input', (e) => {
let val = e.currentTarget.value || this.options.inputFieldName;
val = val
.split(' ')
......
......@@ -15,7 +15,7 @@ export class GitLabDropdownRemote {
if (this.options.beforeSend) {
this.options.beforeSend();
}
return this.dataEndpoint('', data => {
return this.dataEndpoint('', (data) => {
// Fetch the data by calling the data function
if (this.options.success) {
this.options.success(data);
......
......@@ -171,7 +171,7 @@ export default {
this.$emit('resolve-discussion-error', data.errors[0]);
}
})
.catch(err => {
.catch((err) => {
this.$emit('resolve-discussion-error', err);
})
.finally(() => {
......
......@@ -58,7 +58,7 @@ export default {
},
computed: {
discussionStartingNotes() {
return this.discussions.map(discussion => ({
return this.discussions.map((discussion) => ({
...discussion.notes[0],
index: discussion.index,
}));
......
......@@ -63,10 +63,10 @@ export default {
return extractParticipants(this.issue.participants.nodes);
},
resolvedDiscussions() {
return this.discussions.filter(discussion => discussion.resolved);
return this.discussions.filter((discussion) => discussion.resolved);
},
unresolvedDiscussions() {
return this.discussions.filter(discussion => !discussion.resolved);
return this.discussions.filter((discussion) => !discussion.resolved);
},
resolvedCommentsToggleIcon() {
return this.resolvedDiscussionsExpanded ? 'chevron-down' : 'chevron-right';
......
......@@ -95,7 +95,7 @@ export default {
.then(() => {
this.incrementGlobalTodoCount();
})
.catch(err => {
.catch((err) => {
this.$emit('error', Error(CREATE_DESIGN_TODO_ERROR));
throw err;
})
......@@ -133,7 +133,7 @@ export default {
.then(() => {
this.decrementGlobalTodoCount();
})
.catch(err => {
.catch((err) => {
this.$emit('error', Error(DELETE_DESIGN_TODO_ERROR));
throw err;
})
......
......@@ -26,7 +26,7 @@ export default {
return this.designs.length;
},
currentIndex() {
return this.designs.findIndex(design => design.filename === this.id);
return this.designs.findIndex((design) => design.filename === this.id);
},
paginationText() {
return sprintf(s__('DesignManagement|%{current_design} of %{designs_count}'), {
......
......@@ -75,7 +75,7 @@ export default {
iid: this.issueIid,
};
},
update: data => data.project.issue.userPermissions,
update: (data) => data.project.issue.userPermissions,
},
},
computed: {
......
......@@ -19,7 +19,7 @@ export default {
if (!this.queryVersion) return 0;
const idx = this.allVersions.findIndex(
version => this.findVersionId(version.id) === this.queryVersion,
(version) => this.findVersionId(version.id) === this.queryVersion,
);
// if the currentVersionId isn't a valid version (i.e. not in allVersions)
......
......@@ -19,7 +19,7 @@ const resolvers = {
updateActiveDiscussion: (_, { id = null, source }, { cache }) => {
const sourceData = cache.readQuery({ query: activeDiscussionQuery });
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.activeDiscussion = {
__typename: 'ActiveDiscussion',
......@@ -74,7 +74,7 @@ const defaultClient = createDefaultClient(
// Should be removed as soon as https://gitlab.com/gitlab-org/gitlab/issues/13495 is resolved
{
cacheConfig: {
dataIdFromObject: object => {
dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings
if (object.__typename === 'Design') {
return object.id && object.image ? `${object.id}-${object.image}` : uniqueId();
......
......@@ -17,7 +17,7 @@ export default {
atVersion: this.designsVersion,
};
},
update: data => {
update: (data) => {
const designNodes = propertyOf(data)([
'project',
'issue',
......
......@@ -12,7 +12,7 @@ export default {
atVersion: null,
};
},
update: data => data.project.issue.designCollection.versions.nodes,
update: (data) => data.project.issue.designCollection.versions.nodes,
},
},
inject: {
......@@ -28,7 +28,7 @@ export default {
return (
this.$route.query.version &&
this.allVersions &&
this.allVersions.some(version => version.id.endsWith(this.$route.query.version))
this.allVersions.some((version) => version.id.endsWith(this.$route.query.version))
);
},
designsVersion() {
......
......@@ -81,7 +81,7 @@ export default {
variables() {
return this.designVariables;
},
update: data => extractDesign(data),
update: (data) => extractDesign(data),
result(res) {
this.onDesignQueryResult(res);
},
......@@ -139,7 +139,7 @@ export default {
return Boolean(this.annotationCoordinates);
},
resolvedDiscussions() {
return this.discussions.filter(discussion => discussion.resolved);
return this.discussions.filter((discussion) => discussion.resolved);
},
},
watch: {
......@@ -203,7 +203,7 @@ export default {
update: this.updateImageDiffNoteInStore,
};
return this.$apollo.mutate(mutationPayload).catch(e => this.onUpdateImageDiffNoteError(e));
return this.$apollo.mutate(mutationPayload).catch((e) => this.onUpdateImageDiffNoteError(e));
},
onDesignQueryResult({ data, loading }) {
// On the initial load with cache-and-network policy data is undefined while loading is true
......
......@@ -69,7 +69,7 @@ export default {
iid: this.issueIid,
};
},
update: data => data.project.issue.userPermissions,
update: (data) => data.project.issue.userPermissions,
},
},
data() {
......@@ -184,7 +184,7 @@ export default {
return this.$apollo
.mutate(mutationPayload)
.then(res => this.onUploadDesignDone(res))
.then((res) => this.onUploadDesignDone(res))
.catch(() => this.onUploadDesignError());
},
afterUploadDesign(store, { data: { designManagementUpload } }) {
......@@ -208,7 +208,7 @@ export default {
this.trackUploadDesign(res);
},
trackUploadDesign(res) {
(res?.data?.designManagementUpload?.designs || []).forEach(design => {
(res?.data?.designManagementUpload?.designs || []).forEach((design) => {
if (design.event === 'CREATION') {
trackDesignCreate();
} else if (design.event === 'MODIFICATION') {
......@@ -222,7 +222,7 @@ export default {
},
changeSelectedDesigns(filename) {
if (this.isDesignSelected(filename)) {
this.selectedDesigns = this.selectedDesigns.filter(design => design !== filename);
this.selectedDesigns = this.selectedDesigns.filter((design) => design !== filename);
} else {
this.selectedDesigns.push(filename);
}
......@@ -231,14 +231,14 @@ export default {
if (this.hasSelectedDesigns) {
this.selectedDesigns = [];
} else {
this.selectedDesigns = this.designs.map(design => design.filename);
this.selectedDesigns = this.designs.map((design) => design.filename);
}
},
isDesignSelected(filename) {
return this.selectedDesigns.includes(filename);
},
isDesignToBeSaved(filename) {
return this.filesToBeSaved.some(file => file.name === filename);
return this.filesToBeSaved.some((file) => file.name === filename);
},
canSelectDesign(filename) {
return this.isLatestVersion && this.canCreateDesign && !this.isDesignToBeSaved(filename);
......
......@@ -11,14 +11,14 @@ import {
designDeletionError,
} from './error_messages';
const designsOf = data => data.project.issue.designCollection.designs;
const designsOf = (data) => data.project.issue.designCollection.designs;
const deleteDesignsFromStore = (store, query, selectedDesigns) => {
const sourceData = store.readQuery(query);
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
const changedDesigns = designsOf(sourceData).nodes.filter(
design => !selectedDesigns.includes(design.filename),
(design) => !selectedDesigns.includes(design.filename),
);
designsOf(draftData).nodes = [...changedDesigns];
});
......@@ -40,7 +40,7 @@ const addNewVersionToStore = (store, query, version) => {
if (!version) return;
const sourceData = store.readQuery(query);
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.issue.designCollection.versions.nodes = [
version,
......@@ -74,14 +74,14 @@ const addImageDiffNoteToStore = (store, createImageDiffNote, query, variables) =
},
};
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
const design = extractDesign(draftData);
design.notesCount += 1;
design.discussions.nodes = [...design.discussions.nodes, newDiscussion];
if (
!design.issue.participants.nodes.some(
participant => participant.username === createImageDiffNote.note.author.username,
(participant) => participant.username === createImageDiffNote.note.author.username,
)
) {
design.issue.participants.nodes = [
......@@ -107,7 +107,7 @@ const updateImageDiffNoteInStore = (store, repositionImageDiffNote, query, varia
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
const design = extractDesign(draftData);
const discussion = extractCurrentDiscussion(
design.discussions,
......@@ -130,18 +130,18 @@ const updateImageDiffNoteInStore = (store, repositionImageDiffNote, query, varia
const addNewDesignToStore = (store, designManagementUpload, query) => {
const sourceData = store.readQuery(query);
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
const currentDesigns = extractDesigns(draftData);
const difference = differenceBy(designManagementUpload.designs, currentDesigns, 'filename');
const newDesigns = currentDesigns
.map(design => {
return designManagementUpload.designs.find(d => d.filename === design.filename) || design;
.map((design) => {
return designManagementUpload.designs.find((d) => d.filename === design.filename) || design;
})
.concat(difference);
let newVersionNode;
const findNewVersions = designManagementUpload.designs.find(design => design.versions);
const findNewVersions = designManagementUpload.designs.find((design) => design.versions);
if (findNewVersions) {
const findNewVersionsNodes = findNewVersions.versions.nodes;
......@@ -181,7 +181,7 @@ const addNewDesignToStore = (store, designManagementUpload, query) => {
const moveDesignInStore = (store, designManagementMove, query) => {
const sourceData = store.readQuery(query);
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.issue.designCollection.designs =
designManagementMove.designCollection.designs;
......@@ -199,7 +199,7 @@ export const addPendingTodoToStore = (store, pendingTodo, query, queryVariables)
variables: queryVariables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
const design = extractDesign(draftData);
const existingTodos = design.currentUserTodos?.nodes || [];
const newTodoNodes = [...existingTodos, { ...pendingTodo, __typename: 'Todo' }];
......@@ -226,7 +226,7 @@ export const deletePendingTodoFromStore = (store, todoMarkDone, query, queryVari
const {
todo: { id: todoId },
} = todoMarkDone;
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
const design = extractDesign(draftData);
const existingTodos = design.currentUserTodos?.nodes || [];
......
......@@ -10,7 +10,7 @@ export const isValidDesignFile = ({ type }) =>
* @param {Array} discussions
*/
export const extractDiscussions = discussions =>
export const extractDiscussions = (discussions) =>
discussions.nodes.map((discussion, index) => ({
...discussion,
index: index + 1,
......@@ -24,27 +24,27 @@ export const extractDiscussions = discussions =>
*/
export const extractCurrentDiscussion = (discussions, id) =>
discussions.nodes.find(discussion => discussion.id === id);
discussions.nodes.find((discussion) => discussion.id === id);
export const findVersionId = id => (id.match('::Version/(.+$)') || [])[1];
export const findVersionId = (id) => (id.match('::Version/(.+$)') || [])[1];
export const findNoteId = id => (id.match('DiffNote/(.+$)') || [])[1];
export const findNoteId = (id) => (id.match('DiffNote/(.+$)') || [])[1];
export const findIssueId = id => (id.match('Issue/(.+$)') || [])[1];
export const findIssueId = (id) => (id.match('Issue/(.+$)') || [])[1];
export const findDesignId = id => (id.match('Design/(.+$)') || [])[1];
export const findDesignId = (id) => (id.match('Design/(.+$)') || [])[1];
export const extractDesigns = data => data.project.issue.designCollection.designs.nodes;
export const extractDesigns = (data) => data.project.issue.designCollection.designs.nodes;
export const extractDesign = data => (extractDesigns(data) || [])[0];
export const extractDesign = (data) => (extractDesigns(data) || [])[0];
export const toDiffNoteGid = noteId => `gid://gitlab/DiffNote/${noteId}`;
export const toDiffNoteGid = (noteId) => `gid://gitlab/DiffNote/${noteId}`;
/**
* Return the note ID from a URL hash parameter
* @param {String} urlHash URL hash, including `#` prefix
*/
export const extractDesignNoteId = urlHash => {
export const extractDesignNoteId = (urlHash) => {
const [, noteId] = urlHash.match('#note_([0-9]+$)') || [];
return noteId || null;
};
......@@ -53,8 +53,8 @@ export const extractDesignNoteId = urlHash => {
* Generates optimistic response for a design upload mutation
* @param {Array<File>} files
*/
export const designUploadOptimisticResponse = files => {
const designs = files.map(file => ({
export const designUploadOptimisticResponse = (files) => {
const designs = files.map((file) => ({
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26
// eslint-disable-next-line @gitlab/require-i18n-strings
__typename: 'Design',
......@@ -128,7 +128,7 @@ export const repositionImageDiffNoteOptimisticResponse = (note, { position }) =>
* Generates optimistic response for a design upload mutation
* @param {Array} designs
*/
export const moveDesignOptimisticResponse = designs => ({
export const moveDesignOptimisticResponse = (designs) => ({
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26
// eslint-disable-next-line @gitlab/require-i18n-strings
__typename: 'Mutation',
......@@ -145,13 +145,13 @@ export const moveDesignOptimisticResponse = designs => ({
},
});
const normalizeAuthor = author => ({
const normalizeAuthor = (author) => ({
...author,
web_url: author.webUrl,
avatar_url: author.avatarUrl,
});
export const extractParticipants = users => users.map(node => normalizeAuthor(node));
export const extractParticipants = (users) => users.map((node) => normalizeAuthor(node));
export const getPageLayoutElement = () => document.querySelector('.layout-page');
......@@ -160,14 +160,14 @@ export const getPageLayoutElement = () => document.querySelector('.layout-page')
* Example of todoDeletePath: /delete/1234
* @param {String} todoDeletePath delete_path from REST API response
*/
export const extractTodoIdFromDeletePath = todoDeletePath =>
export const extractTodoIdFromDeletePath = (todoDeletePath) =>
(todoDeletePath.match('todos/([0-9]+$)') || [])[1];
const createTodoGid = todoId => {
const createTodoGid = (todoId) => {
return `gid://gitlab/Todo/${todoId}`;
};
export const createPendingTodo = todoId => {
export const createPendingTodo = (todoId) => {
return {
__typename: 'Todo', // eslint-disable-line @gitlab/require-i18n-strings
id: createTodoGid(todoId),
......
......@@ -54,7 +54,7 @@ export const TOGGLE_TODO_ERROR = __('Failed to toggle To-Do for the design.');
const MAX_SKIPPED_FILES_LISTINGS = 5;
const oneDesignSkippedMessage = filename =>
const oneDesignSkippedMessage = (filename) =>
`${DESIGN_UPLOAD_SKIPPED_MESSAGE} ${sprintf(s__('DesignManagement|%{filename} did not change.'), {
filename,
})}`;
......@@ -64,7 +64,7 @@ const oneDesignSkippedMessage = filename =>
* files were skipped.
* @param {Array<{ filename }>} skippedFiles
*/
const someDesignsSkippedMessage = skippedFiles => {
const someDesignsSkippedMessage = (skippedFiles) => {
const designsSkippedMessage = `${DESIGN_UPLOAD_SKIPPED_MESSAGE} ${s__(
'Some of the designs you tried uploading did not change:',
)}`;
......
......@@ -117,7 +117,7 @@ export default class Diff {
table.removeClass('left-side-selected right-side-selected');
const lineClass = ['left-side', 'right-side'].filter(name => line.hasClass(name))[0];
const lineClass = ['left-side', 'right-side'].filter((name) => line.hasClass(name))[0];
if (lineClass) {
table.addClass(`${lineClass}-selected`);
}
......@@ -132,7 +132,7 @@ export default class Diff {
if (children.length !== 2) {
return [0, 0];
}
return children.map(elm => parseInt($(elm).data('linenumber'), 10) || 0);
return children.map((elm) => parseInt($(elm).data('linenumber'), 10) || 0);
}
// eslint-disable-next-line class-methods-use-this
highlightSelectedLine() {
......
......@@ -141,19 +141,19 @@ export default {
},
computed: {
...mapState({
isLoading: state => state.diffs.isLoading,
isBatchLoading: state => state.diffs.isBatchLoading,
diffFiles: state => state.diffs.diffFiles,
diffViewType: state => state.diffs.diffViewType,
mergeRequestDiffs: state => state.diffs.mergeRequestDiffs,
mergeRequestDiff: state => state.diffs.mergeRequestDiff,
commit: state => state.diffs.commit,
renderOverflowWarning: state => state.diffs.renderOverflowWarning,
numTotalFiles: state => state.diffs.realSize,
numVisibleFiles: state => state.diffs.size,
plainDiffPath: state => state.diffs.plainDiffPath,
emailPatchPath: state => state.diffs.emailPatchPath,
retrievingBatches: state => state.diffs.retrievingBatches,
isLoading: (state) => state.diffs.isLoading,
isBatchLoading: (state) => state.diffs.isBatchLoading,
diffFiles: (state) => state.diffs.diffFiles,
diffViewType: (state) => state.diffs.diffViewType,
mergeRequestDiffs: (state) => state.diffs.mergeRequestDiffs,
mergeRequestDiff: (state) => state.diffs.mergeRequestDiff,
commit: (state) => state.diffs.commit,
renderOverflowWarning: (state) => state.diffs.renderOverflowWarning,
numTotalFiles: (state) => state.diffs.realSize,
numVisibleFiles: (state) => state.diffs.size,
plainDiffPath: (state) => state.diffs.plainDiffPath,
emailPatchPath: (state) => state.diffs.emailPatchPath,
retrievingBatches: (state) => state.diffs.retrievingBatches,
}),
...mapState('diffs', [
'showTreeList',
......
......@@ -16,7 +16,7 @@ export default {
},
computed: {
selectedVersionName() {
return this.versions.find(x => x.selected)?.versionName || '';
return this.versions.find((x) => x.selected)?.versionName || '';
},
},
};
......
......@@ -50,7 +50,7 @@ export default {
},
computed: {
...mapState({
projectPath: state => state.diffs.projectPath,
projectPath: (state) => state.diffs.projectPath,
}),
...mapGetters('diffs', [
'isInlineView',
......
......@@ -13,7 +13,7 @@ const EXPAND_DOWN = 2;
const lineNumberByViewType = (viewType, diffLine) => {
const numberGetters = {
[INLINE_DIFF_VIEW_TYPE]: line => line?.new_line,
[INLINE_DIFF_VIEW_TYPE]: (line) => line?.new_line,
};
const numberGetter = numberGetters[viewType];
return numberGetter && numberGetter(diffLine);
......@@ -56,7 +56,7 @@ export default {
},
computed: {
...mapState({
diffFiles: state => state.diffs.diffFiles,
diffFiles: (state) => state.diffs.diffFiles,
}),
canExpandUp() {
return !this.isBottom;
......
......@@ -210,7 +210,7 @@ export default {
await this.$nextTick();
eventsForThisFile.forEach(event => {
eventsForThisFile.forEach((event) => {
eventHub.$emit(event);
});
},
......
......@@ -29,7 +29,7 @@ export default {
return this.discussions.reduce((acc, note) => acc.concat(note.notes), []);
},
notesInGutter() {
return this.allDiscussions.slice(0, COUNT_OF_AVATARS_IN_GUTTER).map(n => ({
return this.allDiscussions.slice(0, COUNT_OF_AVATARS_IN_GUTTER).map((n) => ({
note: n.note,
author: n.author,
}));
......
......@@ -56,8 +56,8 @@ export default {
},
computed: {
...mapState({
noteableData: state => state.notes.noteableData,
diffViewType: state => state.diffs.diffViewType,
noteableData: (state) => state.notes.noteableData,
diffViewType: (state) => state.diffs.diffViewType,
}),
...mapState('diffs', ['showSuggestPopover']),
...mapGetters('diffs', ['getDiffFileByHash', 'diffLines']),
......
......@@ -15,22 +15,22 @@ export const isHighlighted = (state, line, isCommented) => {
return lineCode ? lineCode === state.diffs.highlightedRow : false;
};
export const isContextLine = type => type === CONTEXT_LINE_TYPE;
export const isContextLine = (type) => type === CONTEXT_LINE_TYPE;
export const isMatchLine = type => type === MATCH_LINE_TYPE;
export const isMatchLine = (type) => type === MATCH_LINE_TYPE;
export const isMetaLine = type =>
export const isMetaLine = (type) =>
[OLD_NO_NEW_LINE_TYPE, NEW_NO_NEW_LINE_TYPE, EMPTY_CELL_TYPE].includes(type);
export const shouldRenderCommentButton = (isLoggedIn, isCommentButtonRendered) => {
return isCommentButtonRendered && isLoggedIn;
};
export const hasDiscussions = line => line?.discussions?.length > 0;
export const hasDiscussions = (line) => line?.discussions?.length > 0;
export const lineHref = line => `#${line?.line_code || ''}`;
export const lineHref = (line) => `#${line?.line_code || ''}`;
export const lineCode = line => {
export const lineCode = (line) => {
if (!line) return undefined;
return line.line_code || line.left?.line_code || line.right?.line_code;
};
......@@ -48,7 +48,7 @@ export const classNameMapCell = (line, hll, isLoggedIn, isHover) => {
];
};
export const addCommentTooltip = line => {
export const addCommentTooltip = (line) => {
let tooltip;
if (!line) return tooltip;
......@@ -84,7 +84,7 @@ export const shouldShowCommentButton = (hover, context, meta, discussions) => {
return hover && !context && !meta && !discussions;
};
export const mapParallel = content => line => {
export const mapParallel = (content) => (line) => {
let { left, right } = line;
// Dicussions/Comments
......@@ -137,7 +137,7 @@ export const mapParallel = content => line => {
};
// TODO: Delete this function when unifiedDiffComponents FF is removed
export const mapInline = content => line => {
export const mapInline = (content) => (line) => {
// Discussions/Comments
const renderCommentRow = line.hasForm || (line.discussions?.length && line.discussionsExpanded);
......
......@@ -112,8 +112,8 @@ export default {
mounted() {
this.scrollToLineIfNeededParallel(this.line);
this.unwatchShouldShowCommentButton = this.$watch(
vm => [vm.shouldShowCommentButtonLeft, vm.shouldShowCommentButtonRight].join(),
newVal => {
(vm) => [vm.shouldShowCommentButtonLeft, vm.shouldShowCommentButtonRight].join(),
(newVal) => {
if (newVal) {
this.isCommentButtonRendered = true;
this.unwatchShouldShowCommentButton();
......@@ -150,7 +150,7 @@ export default {
const table = line.closest('table');
table.removeClass('left-side-selected right-side-selected');
const [lineClass] = ['left-side', 'right-side'].filter(name => line.hasClass(name));
const [lineClass] = ['left-side', 'right-side'].filter((name) => line.hasClass(name));
if (lineClass) {
table.addClass(`${lineClass}-selected`);
......
......@@ -35,7 +35,7 @@ export default {
}
return this.allBlobs.reduce((acc, folder) => {
const tree = folder.tree.filter(f => f.path.toLowerCase().indexOf(search) >= 0);
const tree = folder.tree.filter((f) => f.path.toLowerCase().indexOf(search) >= 0);
if (tree.length) {
return acc.concat({
......
......@@ -87,7 +87,7 @@ export default function initDiffsApp(store) {
},
computed: {
...mapState({
activeTab: state => state.page.activeTab,
activeTab: (state) => state.page.activeTab,
}),
},
created() {
......
......@@ -127,7 +127,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
// We need to check that the currentDiffFileId points to a file that exists
if (
state.currentDiffFileId &&
!state.diffFiles.some(f => f.file_hash === state.currentDiffFileId) &&
!state.diffFiles.some((f) => f.file_hash === state.currentDiffFileId) &&
!isNoteLink
) {
commit(types.VIEW_DIFF_FILE, state.diffFiles[0].file_hash);
......@@ -135,11 +135,11 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
if (state.diffFiles?.length) {
// eslint-disable-next-line promise/catch-or-return,promise/no-nesting
import('~/code_navigation').then(m =>
import('~/code_navigation').then((m) =>
m.default({
blobs: state.diffFiles
.filter(f => f.code_navigation_path)
.map(f => ({
.filter((f) => f.code_navigation_path)
.map((f) => ({
path: f.new_path,
codeNavigationPath: f.code_navigation_path,
})),
......@@ -161,7 +161,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
return pagination.next_page;
})
.then(nextPage => nextPage && getBatch(nextPage))
.then((nextPage) => nextPage && getBatch(nextPage))
.catch(() => commit(types.SET_RETRIEVING_BATCHES, false));
return getBatch()
......@@ -211,7 +211,7 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
export const fetchCoverageFiles = ({ commit, state }) => {
const coveragePoll = new Poll({
resource: {
getCoverageReports: endpoint => axios.get(endpoint),
getCoverageReports: (endpoint) => axios.get(endpoint),
},
data: state.endpointCoverage,
method: 'getCoverageReports',
......@@ -246,8 +246,8 @@ export const assignDiscussionsToDiff = (
const hash = getLocationHash();
discussions
.filter(discussion => discussion.diff_discussion)
.forEach(discussion => {
.filter((discussion) => discussion.diff_discussion)
.forEach((discussion) => {
commit(types.SET_LINE_DISCUSSIONS_FOR_FILE, {
discussion,
diffPositionByLineCode,
......@@ -274,10 +274,10 @@ export const toggleLineDiscussions = ({ commit }, options) => {
};
export const renderFileForDiscussionId = ({ commit, rootState, state }, discussionId) => {
const discussion = rootState.notes.discussions.find(d => d.id === discussionId);
const discussion = rootState.notes.discussions.find((d) => d.id === discussionId);
if (discussion && discussion.diff_file) {
const file = state.diffFiles.find(f => f.file_hash === discussion.diff_file.file_hash);
const file = state.diffFiles.find((f) => f.file_hash === discussion.diff_file.file_hash);
if (file) {
if (!file.renderIt) {
......@@ -303,9 +303,9 @@ export const renderFileForDiscussionId = ({ commit, rootState, state }, discussi
export const startRenderDiffsQueue = ({ state, commit }) => {
const checkItem = () =>
new Promise(resolve => {
new Promise((resolve) => {
const nextFile = state.diffFiles.find(
file =>
(file) =>
!file.renderIt &&
file.viewer &&
(!isCollapsed(file) || file.viewer.name !== diffViewerModes.text),
......@@ -362,7 +362,7 @@ export const loadMoreLines = ({ commit }, options) => {
params.from_merge_request = true;
return axios.get(endpoint, { params }).then(res => {
return axios.get(endpoint, { params }).then((res) => {
const contextLines = res.data || [];
commit(types.ADD_CONTEXT_LINES, {
......@@ -403,7 +403,7 @@ export const loadCollapsedDiff = ({ commit, getters, state }, file) =>
w: state.showWhitespace ? '0' : '1',
},
})
.then(res => {
.then((res) => {
commit(types.ADD_COLLAPSED_DIFFS, {
file,
data: res.data,
......@@ -426,7 +426,7 @@ export const toggleFileDiscussions = ({ getters, dispatch }, diff) => {
const shouldCloseAll = getters.diffHasAllExpandedDiscussions(diff);
const shouldExpandAll = getters.diffHasAllCollapsedDiscussions(diff);
discussions.forEach(discussion => {
discussions.forEach((discussion) => {
const data = { discussionId: discussion.id };
if (shouldCloseAll) {
......@@ -440,13 +440,13 @@ export const toggleFileDiscussions = ({ getters, dispatch }, diff) => {
export const toggleFileDiscussionWrappers = ({ commit }, diff) => {
const discussionWrappersExpanded = allDiscussionWrappersExpanded(diff);
const lineCodesWithDiscussions = new Set();
const lineHasDiscussion = line => Boolean(line?.discussions.length);
const registerDiscussionLine = line => lineCodesWithDiscussions.add(line.line_code);
const lineHasDiscussion = (line) => Boolean(line?.discussions.length);
const registerDiscussionLine = (line) => lineCodesWithDiscussions.add(line.line_code);
diff[INLINE_DIFF_LINES_KEY].filter(lineHasDiscussion).forEach(registerDiscussionLine);
if (lineCodesWithDiscussions.size) {
Array.from(lineCodesWithDiscussions).forEach(lineCode => {
Array.from(lineCodesWithDiscussions).forEach((lineCode) => {
commit(types.TOGGLE_LINE_DISCUSSIONS, {
fileHash: diff.file_hash,
expanded: !discussionWrappersExpanded,
......@@ -464,8 +464,8 @@ export const saveDiffDiscussion = ({ state, dispatch }, { note, formData }) => {
});
return dispatch('saveNote', postData, { root: true })
.then(result => dispatch('updateDiscussion', result.discussion, { root: true }))
.then(discussion => dispatch('assignDiscussionsToDiff', [discussion]))
.then((result) => dispatch('updateDiscussion', result.discussion, { root: true }))
.then((discussion) => dispatch('assignDiscussionsToDiff', [discussion]))
.then(() => dispatch('updateResolvableDiscussionsCounts', null, { root: true }))
.then(() => dispatch('closeDiffFileCommentForm', formData.diffFile.file_hash))
.catch(() => createFlash(s__('MergeRequests|Saving the comment failed')));
......@@ -565,7 +565,7 @@ export const setExpandedDiffLines = ({ commit }, { file, data }) => {
});
commit(types.TOGGLE_DIFF_FILE_RENDERING_MORE, file.file_path);
const idleCb = t => {
const idleCb = (t) => {
const startIndex = index;
while (
......@@ -613,7 +613,7 @@ export const fetchFullDiff = ({ commit, dispatch }, file) =>
.catch(() => dispatch('receiveFullDiffError', file.file_path));
export const toggleFullDiff = ({ dispatch, commit, getters, state }, filePath) => {
const file = state.diffFiles.find(f => f.file_path === filePath);
const file = state.diffFiles.find((f) => f.file_path === filePath);
commit(types.REQUEST_FULL_DIFF, filePath);
......@@ -724,7 +724,7 @@ export const setCurrentDiffFileIdFromNote = ({ commit, state, rootGetters }, not
const fileHash = rootGetters.getDiscussion(note.discussion_id).diff_file?.file_hash;
if (fileHash && state.diffFiles.some(f => f.file_hash === fileHash)) {
if (fileHash && state.diffFiles.some((f) => f.file_hash === fileHash)) {
commit(types.VIEW_DIFF_FILE, fileHash);
}
};
......
......@@ -2,10 +2,10 @@ import { __, n__, sprintf } from '~/locale';
import { getParameterByName, parseBoolean } from '~/lib/utils/common_utils';
import { DIFF_COMPARE_BASE_VERSION_INDEX, DIFF_COMPARE_HEAD_VERSION_INDEX } from '../constants';
export const selectedTargetIndex = state =>
export const selectedTargetIndex = (state) =>
state.startVersion?.version_index || DIFF_COMPARE_BASE_VERSION_INDEX;
export const selectedSourceIndex = state => state.mergeRequestDiff.version_index;
export const selectedSourceIndex = (state) => state.mergeRequestDiff.version_index;
export const diffCompareDropdownTargetVersions = (state, getters) => {
// startVersion only exists if the user has selected a version other
......@@ -40,7 +40,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
selected: isHeadSelected,
};
// Appended properties here are to make the compare_dropdown_layout easier to reason about
const formatVersion = v => {
const formatVersion = (v) => {
return {
href: v.compare_path,
versionName: sprintf(__(`version %{versionIndex}`), { versionIndex: v.version_index }),
......@@ -53,7 +53,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
...state.mergeRequestDiffs.slice(1).map(formatVersion),
baseVersion,
state.mergeRequestDiff.head_version_path && headVersion,
].filter(a => a);
].filter((a) => a);
};
export const diffCompareDropdownSourceVersions = (state, getters) => {
......
......@@ -105,11 +105,11 @@ export default {
},
[types.TOGGLE_LINE_HAS_FORM](state, { lineCode, fileHash, hasForm }) {
const diffFile = state.diffFiles.find(f => f.file_hash === fileHash);
const diffFile = state.diffFiles.find((f) => f.file_hash === fileHash);
if (!diffFile) return;
diffFile[INLINE_DIFF_LINES_KEY].find(l => l.line_code === lineCode).hasForm = hasForm;
diffFile[INLINE_DIFF_LINES_KEY].find((l) => l.line_code === lineCode).hasForm = hasForm;
},
[types.ADD_CONTEXT_LINES](state, options) {
......@@ -125,7 +125,7 @@ export default {
bottom,
isExpandDown,
nextLineNumbers,
).map(line => {
).map((line) => {
const lineCode =
line.type === 'match'
? `${fileHash}_${line.meta_data.old_pos}_${line.meta_data.new_pos}_match`
......@@ -149,8 +149,8 @@ export default {
[types.ADD_COLLAPSED_DIFFS](state, { file, data }) {
const files = prepareDiffData({ diff: data });
const [newFileData] = files.filter(f => f.file_hash === file.file_hash);
const selectedFile = state.diffFiles.find(f => f.file_hash === file.file_hash);
const [newFileData] = files.filter((f) => f.file_hash === file.file_hash);
const selectedFile = state.diffFiles.find((f) => f.file_hash === file.file_hash);
Object.assign(selectedFile, { ...newFileData });
},
......@@ -159,9 +159,9 @@ export default {
const discussionLineCodes = [discussion.line_code, ...(discussion.line_codes || [])];
const fileHash = discussion.diff_file.file_hash;
const lineCheck = line =>
const lineCheck = (line) =>
discussionLineCodes.some(
discussionLineCode =>
(discussionLineCode) =>
line.line_code === discussionLineCode &&
isDiscussionApplicableToLine({
discussion,
......@@ -179,26 +179,26 @@ export default {
: [],
});
const setDiscussionsExpanded = line => {
const setDiscussionsExpanded = (line) => {
const isLineNoteTargeted =
line.discussions &&
line.discussions.some(
disc => disc.notes && disc.notes.find(note => hash === `note_${note.id}`),
(disc) => disc.notes && disc.notes.find((note) => hash === `note_${note.id}`),
);
return {
...line,
discussionsExpanded:
line.discussions && line.discussions.length
? line.discussions.some(disc => !disc.resolved) || isLineNoteTargeted
? line.discussions.some((disc) => !disc.resolved) || isLineNoteTargeted
: false,
};
};
state.diffFiles.forEach(file => {
state.diffFiles.forEach((file) => {
if (file.file_hash === fileHash) {
if (file[INLINE_DIFF_LINES_KEY].length) {
file[INLINE_DIFF_LINES_KEY].forEach(line => {
file[INLINE_DIFF_LINES_KEY].forEach((line) => {
Object.assign(
line,
setDiscussionsExpanded(lineCheck(line) ? mapDiscussions(line) : line),
......@@ -208,7 +208,7 @@ export default {
if (!file[INLINE_DIFF_LINES_KEY].length) {
const newDiscussions = (file.discussions || [])
.filter(d => d.id !== discussion.id)
.filter((d) => d.id !== discussion.id)
.concat(discussion);
Object.assign(file, {
......@@ -220,26 +220,26 @@ export default {
},
[types.REMOVE_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, lineCode }) {
const selectedFile = state.diffFiles.find(f => f.file_hash === fileHash);
const selectedFile = state.diffFiles.find((f) => f.file_hash === fileHash);
if (selectedFile) {
updateLineInFile(selectedFile, lineCode, line =>
updateLineInFile(selectedFile, lineCode, (line) =>
Object.assign(line, {
discussions: line.discussions.filter(discussion => discussion.notes.length),
discussions: line.discussions.filter((discussion) => discussion.notes.length),
}),
);
if (selectedFile.discussions && selectedFile.discussions.length) {
selectedFile.discussions = selectedFile.discussions.filter(
discussion => discussion.notes.length,
(discussion) => discussion.notes.length,
);
}
}
},
[types.TOGGLE_LINE_DISCUSSIONS](state, { fileHash, lineCode, expanded }) {
const selectedFile = state.diffFiles.find(f => f.file_hash === fileHash);
const selectedFile = state.diffFiles.find((f) => f.file_hash === fileHash);
updateLineInFile(selectedFile, lineCode, line => {
updateLineInFile(selectedFile, lineCode, (line) => {
Object.assign(line, { discussionsExpanded: expanded });
});
},
......@@ -262,7 +262,7 @@ export default {
[types.UPDATE_DIFF_FILE_COMMENT_FORM](state, formData) {
const { fileHash } = formData;
state.commentForms = state.commentForms.map(form => {
state.commentForms = state.commentForms.map((form) => {
if (form.fileHash === fileHash) {
return {
...formData,
......@@ -273,7 +273,7 @@ export default {
});
},
[types.CLOSE_DIFF_FILE_COMMENT_FORM](state, fileHash) {
state.commentForms = state.commentForms.filter(form => form.fileHash !== fileHash);
state.commentForms = state.commentForms.filter((form) => form.fileHash !== fileHash);
},
[types.SET_HIGHLIGHTED_ROW](state, lineCode) {
state.highlightedRow = lineCode;
......@@ -313,7 +313,7 @@ export default {
state,
{ filePath, collapsed, trigger = DIFF_FILE_AUTOMATIC_COLLAPSE },
) {
const file = state.diffFiles.find(f => f.file_path === filePath);
const file = state.diffFiles.find((f) => f.file_path === filePath);
if (file && file.viewer) {
if (trigger === DIFF_FILE_MANUAL_COLLAPSE) {
......@@ -330,17 +330,17 @@ export default {
}
},
[types.SET_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, lines }) {
const file = state.diffFiles.find(f => f.file_path === filePath);
const file = state.diffFiles.find((f) => f.file_path === filePath);
file[INLINE_DIFF_LINES_KEY] = lines;
},
[types.ADD_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, line }) {
const file = state.diffFiles.find(f => f.file_path === filePath);
const file = state.diffFiles.find((f) => f.file_path === filePath);
file[INLINE_DIFF_LINES_KEY].push(line);
},
[types.TOGGLE_DIFF_FILE_RENDERING_MORE](state, filePath) {
const file = state.diffFiles.find(f => f.file_path === filePath);
const file = state.diffFiles.find((f) => f.file_path === filePath);
file.renderingLines = !file.renderingLines;
},
......
......@@ -23,15 +23,15 @@ import {
} from '../constants';
import { prepareRawDiffFile } from '../utils/diff_file';
export const isAdded = line => ['new', 'new-nonewline'].includes(line.type);
export const isRemoved = line => ['old', 'old-nonewline'].includes(line.type);
export const isUnchanged = line => !line.type;
export const isMeta = line => ['match', 'new-nonewline', 'old-nonewline'].includes(line.type);
export const isConflictMarker = line =>
export const isAdded = (line) => ['new', 'new-nonewline'].includes(line.type);
export const isRemoved = (line) => ['old', 'old-nonewline'].includes(line.type);
export const isUnchanged = (line) => !line.type;
export const isMeta = (line) => ['match', 'new-nonewline', 'old-nonewline'].includes(line.type);
export const isConflictMarker = (line) =>
[CONFLICT_MARKER_OUR, CONFLICT_MARKER_THEIR].includes(line.type);
export const isConflictSeperator = line => line.type === CONFLICT_MARKER;
export const isConflictOur = line => line.type === CONFLICT_OUR;
export const isConflictTheir = line => line.type === CONFLICT_THEIR;
export const isConflictSeperator = (line) => line.type === CONFLICT_MARKER;
export const isConflictOur = (line) => line.type === CONFLICT_OUR;
export const isConflictTheir = (line) => line.type === CONFLICT_THEIR;
/**
* Pass in the inline diff lines array which gets converted
......@@ -117,10 +117,10 @@ export const parallelizeDiffLines = (diffLines, inline) => {
};
export function findDiffFile(files, match, matchKey = 'file_hash') {
return files.find(file => file[matchKey] === match);
return files.find((file) => file[matchKey] === match);
}
export const getReversePosition = linePosition => {
export const getReversePosition = (linePosition) => {
if (linePosition === LINE_POSITION_RIGHT) {
return LINE_POSITION_LEFT;
}
......@@ -197,7 +197,7 @@ export const findIndexInInlineLines = (lines, lineNumbers) => {
const { oldLineNumber, newLineNumber } = lineNumbers;
return lines.findIndex(
line => line.old_line === oldLineNumber && line.new_line === newLineNumber,
(line) => line.old_line === oldLineNumber && line.new_line === newLineNumber,
);
};
......@@ -370,7 +370,7 @@ export function prepareLineForRenamedFile({ line, diffFile, index = 0 }) {
function prepareDiffFileLines(file) {
const inlineLines = file[INLINE_DIFF_LINES_KEY];
inlineLines.forEach(line => prepareLine(line, file)); // WARNING: In-Place Mutations!
inlineLines.forEach((line) => prepareLine(line, file)); // WARNING: In-Place Mutations!
Object.assign(file, {
inlineLinesCount: inlineLines.length,
......@@ -424,7 +424,7 @@ export function getDiffPositionByLineCode(diffFiles) {
let lines = [];
lines = diffFiles.reduce((acc, diffFile) => {
diffFile[INLINE_DIFF_LINES_KEY].forEach(line => {
diffFile[INLINE_DIFF_LINES_KEY].forEach((line) => {
acc.push({ file: diffFile, line });
});
......@@ -471,21 +471,21 @@ export function isDiscussionApplicableToLine({ discussion, diffPosition, latestD
...(discussion.positions || []),
];
const removeLineRange = position => {
const removeLineRange = (position) => {
const { line_range: pNotUsed, ...positionNoLineRange } = position;
return positionNoLineRange;
};
return discussionPositions
.map(removeLineRange)
.some(position => isEqual(position, diffPositionCopy));
.some((position) => isEqual(position, diffPositionCopy));
}
// eslint-disable-next-line
return latestDiff && discussion.active && line_code === discussion.line_code;
}
export const getLowestSingleFolder = folder => {
export const getLowestSingleFolder = (folder) => {
const getFolder = (blob, start = []) =>
blob.tree.reduce(
(acc, file) => {
......@@ -517,8 +517,8 @@ export const getLowestSingleFolder = folder => {
};
};
export const flattenTree = tree => {
const flatten = blobTree =>
export const flattenTree = (tree) => {
const flatten = (blobTree) =>
blobTree.reduce((acc, file) => {
const blob = file;
let treeToFlatten = blob.tree;
......@@ -540,7 +540,7 @@ export const flattenTree = tree => {
return flatten(tree);
};
export const generateTreeList = files => {
export const generateTreeList = (files) => {
const { treeEntries, tree } = files.reduce(
(acc, file) => {
const split = file.new_path.split('/');
......@@ -590,8 +590,8 @@ export const generateTreeList = files => {
return { treeEntries, tree: flattenTree(tree) };
};
export const getDiffMode = diffFile => {
const diffModeKey = Object.keys(diffModes).find(key => diffFile[`${key}_file`]);
export const getDiffMode = (diffFile) => {
const diffModeKey = Object.keys(diffModes).find((key) => diffFile[`${key}_file`]);
return (
diffModes[diffModeKey] ||
(diffFile.viewer &&
......@@ -639,11 +639,11 @@ export const convertExpandLines = ({
return lines;
};
export const idleCallback = cb => requestIdleCallback(cb);
export const idleCallback = (cb) => requestIdleCallback(cb);
function getLinesFromFileByLineCode(file, lineCode) {
const inlineLines = file[INLINE_DIFF_LINES_KEY];
const matchesCode = line => line.line_code === lineCode;
const matchesCode = (line) => line.line_code === lineCode;
return inlineLines.filter(matchesCode);
}
......@@ -652,15 +652,15 @@ export const updateLineInFile = (selectedFile, lineCode, updateFn) => {
getLinesFromFileByLineCode(selectedFile, lineCode).forEach(updateFn);
};
export const allDiscussionWrappersExpanded = diff => {
export const allDiscussionWrappersExpanded = (diff) => {
let discussionsExpanded = true;
const changeExpandedResult = line => {
const changeExpandedResult = (line) => {
if (line && line.discussions.length) {
discussionsExpanded = discussionsExpanded && line.discussionsExpanded;
}
};
diff[INLINE_DIFF_LINES_KEY].forEach(line => {
diff[INLINE_DIFF_LINES_KEY].forEach((line) => {
changeExpandedResult(line);
});
......
......@@ -8,8 +8,8 @@ import { getDerivedMergeRequestInformation } from './merge_request';
import { uuids } from './uuids';
function fileSymlinkInformation(file, fileList) {
const duplicates = fileList.filter(iteratedFile => iteratedFile.file_hash === file.file_hash);
const includesSymlink = duplicates.some(iteratedFile => {
const duplicates = fileList.filter((iteratedFile) => iteratedFile.file_hash === file.file_hash);
const includesSymlink = duplicates.some((iteratedFile) => {
return [iteratedFile.a_mode, iteratedFile.b_mode].includes(DIFF_FILE_SYMLINK_MODE);
});
const brokenSymlinkScenario = duplicates.length > 1 && includesSymlink;
......
......@@ -2,7 +2,7 @@ import { sortTree } from '~/ide/stores/utils';
import { generateTreeList } from '../store/utils';
// eslint-disable-next-line no-restricted-globals
self.addEventListener('message', e => {
self.addEventListener('message', (e) => {
const { data } = e;
if (data === undefined) {
......
......@@ -6,7 +6,7 @@ class DirtySubmitCollection {
this.dirtySubmits = [];
this.forms.forEach(form => this.dirtySubmits.push(new DirtySubmitForm(form)));
this.forms.forEach((form) => this.dirtySubmits.push(new DirtySubmitForm(form)));
}
}
......
......@@ -22,10 +22,10 @@ class DirtySubmitForm {
registerListeners() {
const getThrottledHandlerForInput = memoize(() =>
throttle(event => this.updateDirtyInput(event), DirtySubmitForm.THROTTLE_DURATION),
throttle((event) => this.updateDirtyInput(event), DirtySubmitForm.THROTTLE_DURATION),
);
const throttledUpdateDirtyInput = event => {
const throttledUpdateDirtyInput = (event) => {
const throttledHandler = getThrottledHandlerForInput(event.target.name);
throttledHandler(event);
};
......@@ -33,7 +33,7 @@ class DirtySubmitForm {
this.form.addEventListener('input', throttledUpdateDirtyInput);
this.form.addEventListener('change', throttledUpdateDirtyInput);
$(this.form).on('change.select2', throttledUpdateDirtyInput);
this.form.addEventListener('submit', event => this.formSubmit(event));
this.form.addEventListener('submit', (event) => this.formSubmit(event));
}
updateDirtyInput(event) {
......@@ -58,7 +58,7 @@ class DirtySubmitForm {
toggleSubmission() {
this.isDisabled = this.dirtyInputs.length === 0;
this.submits.forEach(element => {
this.submits.forEach((element) => {
element.disabled = this.isDisabled;
});
}
......
......@@ -68,7 +68,7 @@ class DropDown {
removeSelectedClasses() {
const items = this.items || this.getItems();
items.forEach(item => item.classList.remove(SELECTED_CLASS));
items.forEach((item) => item.classList.remove(SELECTED_CLASS));
}
addEvents() {
......@@ -162,7 +162,7 @@ class DropDown {
static setImagesSrc(template) {
const images = [...template.querySelectorAll('img[data-src]')];
images.forEach(image => {
images.forEach((image) => {
const img = image;
img.src = img.getAttribute('data-src');
......
......@@ -28,7 +28,7 @@ class DropLab {
}
destroy() {
this.hooks.forEach(hook => hook.destroy());
this.hooks.forEach((hook) => hook.destroy());
this.hooks = [];
this.removeEvents();
}
......@@ -51,7 +51,7 @@ class DropLab {
}
processData(trigger, data, methodName) {
this.hooks.forEach(hook => {
this.hooks.forEach((hook) => {
if (Array.isArray(trigger)) hook.list[methodName](trigger);
if (hook.trigger.id === trigger) hook.list[methodName](data);
......@@ -70,7 +70,7 @@ class DropLab {
if (utils.isDropDownParts(thisTag, this.hooks)) return;
if (utils.isDropDownParts(e.target, this.hooks)) return;
this.hooks.forEach(hook => hook.list.hide());
this.hooks.forEach((hook) => hook.list.hide());
}
removeEvents() {
......@@ -115,7 +115,7 @@ class DropLab {
}
addHooks(hooks, plugins, config) {
hooks.forEach(hook => this.addHook(hook, null, plugins, config));
hooks.forEach((hook) => this.addHook(hook, null, plugins, config));
return this;
}
......@@ -147,7 +147,7 @@ class DropLab {
this.fireReady();
this.queuedData.forEach(data => this.addData(data));
this.queuedData.forEach((data) => this.addData(data));
this.queuedData = [];
return this;
......
......@@ -14,7 +14,7 @@ class HookButton extends Hook {
}
addPlugins() {
this.plugins.forEach(plugin => plugin.init(this));
this.plugins.forEach((plugin) => plugin.init(this));
}
clicked(e) {
......@@ -44,7 +44,7 @@ class HookButton extends Hook {
}
removePlugins() {
this.plugins.forEach(plugin => plugin.destroy());
this.plugins.forEach((plugin) => plugin.destroy());
}
destroy() {
......
......@@ -14,7 +14,7 @@ class HookInput extends Hook {
}
addPlugins() {
this.plugins.forEach(plugin => plugin.init(this));
this.plugins.forEach((plugin) => plugin.init(this));
}
addEvents() {
......@@ -101,7 +101,7 @@ class HookInput extends Hook {
}
removePlugins() {
this.plugins.forEach(plugin => plugin.destroy());
this.plugins.forEach((plugin) => plugin.destroy());
}
destroy() {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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