Commit 0e800cbb authored by Paul Slaughter's avatar Paul Slaughter

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

Format files with prettier arrowParens [2/15]

See merge request gitlab-org/gitlab!50527
parents aaa35d8f 281cc730
...@@ -10,158 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql ...@@ -10,158 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss *.scss
*.md *.md
## boring-bohr
jest.config.base.js
jest.config.js
scripts/frontend/block_dependencies.js
scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
scripts/frontend/extract_gettext_all.js
scripts/frontend/file_test_coverage.js
scripts/frontend/frontend_script_utils.js
scripts/frontend/merge_coverage_frontend.js
scripts/frontend/prettier.js
scripts/frontend/stylelint/stylelint-utility-map.js
scripts/frontend/stylelint/stylelint-utils.js
app/assets/javascripts/access_tokens/index.js
app/assets/javascripts/activities.js
app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue
app/assets/javascripts/add_context_commits_modal/store/actions.js
## interesting-kepler
app/assets/javascripts/add_context_commits_modal/utils.js
app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js
app/assets/javascripts/admin/statistics_panel/store/actions.js
app/assets/javascripts/admin/statistics_panel/store/getters.js
app/assets/javascripts/admin/users/components/users_table.vue
app/assets/javascripts/admin/users/index.js
app/assets/javascripts/alert_handler.js
app/assets/javascripts/alert_management/components/alert_details.vue
app/assets/javascripts/alert_management/components/alert_management_table.vue
app/assets/javascripts/alert_management/components/alert_metrics.vue
app/assets/javascripts/alert_management/components/alert_status.vue
app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue
app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue
app/assets/javascripts/alert_management/details.js
app/assets/javascripts/alert_management/list.js
app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue
app/assets/javascripts/alerts_service_settings/index.js
app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue
app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue
app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue
app/assets/javascripts/alerts_settings/graphql.js
app/assets/javascripts/alerts_settings/index.js
app/assets/javascripts/alerts_settings/utils/cache_updates.js
app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue
app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue
app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue
app/assets/javascripts/analytics/instance_statistics/utils.js
app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js
app/assets/javascripts/api.js
app/assets/javascripts/authentication/u2f/authenticate.js
app/assets/javascripts/authentication/u2f/register.js
## reverent-lovelace
app/assets/javascripts/authentication/webauthn/authenticate.js
app/assets/javascripts/authentication/webauthn/register.js
app/assets/javascripts/awards_handler.js
app/assets/javascripts/badges/components/badge_form.vue
app/assets/javascripts/badges/components/badge_settings.vue
app/assets/javascripts/badges/store/actions.js
app/assets/javascripts/badges/store/mutations.js
app/assets/javascripts/batch_comments/components/preview_item.vue
app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js
app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js
app/assets/javascripts/batch_comments/utils.js
app/assets/javascripts/behaviors/autosize.js
app/assets/javascripts/behaviors/bind_in_out.js
app/assets/javascripts/behaviors/copy_to_clipboard.js
app/assets/javascripts/behaviors/gl_emoji.js
app/assets/javascripts/behaviors/load_startup_css.js
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
app/assets/javascripts/behaviors/markdown/highlight_current_user.js
app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
app/assets/javascripts/behaviors/markdown/marks/inline_html.js
app/assets/javascripts/behaviors/markdown/nodes/code_block.js
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
app/assets/javascripts/behaviors/markdown/nodes/image.js
app/assets/javascripts/behaviors/markdown/nodes/playable.js
app/assets/javascripts/behaviors/markdown/nodes/reference.js
app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
app/assets/javascripts/behaviors/markdown/render_math.js
app/assets/javascripts/behaviors/markdown/render_mermaid.js
app/assets/javascripts/behaviors/markdown/render_metrics.js
app/assets/javascripts/behaviors/markdown/schema.js
app/assets/javascripts/behaviors/markdown/serializer.js
## nice-swanson
app/assets/javascripts/behaviors/preview_markdown.js
app/assets/javascripts/behaviors/quick_submit.js
app/assets/javascripts/behaviors/requires_input.js
app/assets/javascripts/behaviors/secret_values.js
app/assets/javascripts/behaviors/shortcuts/keybindings.js
app/assets/javascripts/behaviors/shortcuts/shortcuts.js
app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js
app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js
app/assets/javascripts/blob/3d_viewer/index.js
app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js
app/assets/javascripts/blob/blob_file_dropzone.js
app/assets/javascripts/blob/blob_line_permalink_updater.js
app/assets/javascripts/blob/components/blob_content_error.vue
app/assets/javascripts/blob/file_template_mediator.js
app/assets/javascripts/blob/notebook/notebook_viewer.vue
app/assets/javascripts/blob/openapi/index.js
app/assets/javascripts/blob/sketch/index.js
app/assets/javascripts/blob/stl_viewer.js
app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js
app/assets/javascripts/blob/template_selector.js
app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js
app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js
app/assets/javascripts/blob/template_selectors/dockerfile_selector.js
app/assets/javascripts/blob/template_selectors/gitignore_selector.js
app/assets/javascripts/blob/template_selectors/license_selector.js
app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js
app/assets/javascripts/blob/template_selectors/type_selector.js
app/assets/javascripts/blob/viewer/index.js
app/assets/javascripts/blob_edit/blob_bundle.js
app/assets/javascripts/blob_edit/edit_blob.js
app/assets/javascripts/boards/boards_util.js
## keen-chatelet
app/assets/javascripts/boards/components/board_assignee_dropdown.vue
app/assets/javascripts/boards/components/board_card_layout.vue
app/assets/javascripts/boards/components/board_form.vue
app/assets/javascripts/boards/components/board_list.vue
app/assets/javascripts/boards/components/board_list_new.vue
app/assets/javascripts/boards/components/board_new_issue_new.vue
app/assets/javascripts/boards/components/board_sidebar.js
app/assets/javascripts/boards/components/boards_selector.vue
app/assets/javascripts/boards/components/modal/footer.vue
app/assets/javascripts/boards/components/modal/index.vue
app/assets/javascripts/boards/components/project_select.vue
app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue
app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue
app/assets/javascripts/boards/filtered_search_boards.js
app/assets/javascripts/boards/filters/due_date_filters.js
app/assets/javascripts/boards/index.js
app/assets/javascripts/boards/mixins/sortable_default_options.js
app/assets/javascripts/boards/models/issue.js
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/stores/actions.js
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/getters.js
app/assets/javascripts/boards/stores/modal_store.js
app/assets/javascripts/boards/stores/mutations.js
app/assets/javascripts/branches/divergence_graph.js
app/assets/javascripts/breadcrumb.js
app/assets/javascripts/broadcast_notification.js
app/assets/javascripts/build_artifacts.js
app/assets/javascripts/ci_settings_pipeline_triggers/index.js
app/assets/javascripts/ci_variable_list/ci_variable_list.js
app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue
app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue
## relaxed-kilby ## relaxed-kilby
app/assets/javascripts/ci_variable_list/store/actions.js 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/getters.js
......
import Vue from 'vue'; import Vue from 'vue';
import ExpiresAtField from './components/expires_at_field.vue'; import ExpiresAtField from './components/expires_at_field.vue';
const getInputAttrs = el => { const getInputAttrs = (el) => {
const input = el.querySelector('input'); const input = el.querySelector('input');
return { return {
......
...@@ -9,9 +9,9 @@ export default class Activities { ...@@ -9,9 +9,9 @@ export default class Activities {
constructor(container = '') { constructor(container = '') {
this.container = container; this.container = container;
Pager.init(20, true, false, data => data, this.updateTooltips, this.container); Pager.init(20, true, false, (data) => data, this.updateTooltips, this.container);
$('.event-filter-link').on('click', e => { $('.event-filter-link').on('click', (e) => {
e.preventDefault(); e.preventDefault();
this.toggleFilter(e.currentTarget); this.toggleFilter(e.currentTarget);
this.reloadActivities(); this.reloadActivities();
...@@ -24,7 +24,7 @@ export default class Activities { ...@@ -24,7 +24,7 @@ export default class Activities {
reloadActivities() { reloadActivities() {
$('.content_list').html(''); $('.content_list').html('');
Pager.init(20, true, false, data => data, this.updateTooltips, this.container); Pager.init(20, true, false, (data) => data, this.updateTooltips, this.container);
} }
toggleFilter(sender) { toggleFilter(sender) {
......
...@@ -61,14 +61,14 @@ export default { ...@@ -61,14 +61,14 @@ export default {
}, },
}, },
selectedCommitsCount() { selectedCommitsCount() {
return this.selectedCommits.filter(selectedCommit => selectedCommit.isSelected).length; return this.selectedCommits.filter((selectedCommit) => selectedCommit.isSelected).length;
}, },
shouldPurge() { shouldPurge() {
return this.selectedCommitsCount !== this.selectedCommits.length; return this.selectedCommitsCount !== this.selectedCommits.length;
}, },
uniqueCommits() { uniqueCommits() {
return this.selectedCommits.filter( return this.selectedCommits.filter(
selectedCommit => (selectedCommit) =>
selectedCommit.isSelected && selectedCommit.isSelected &&
findCommitIndex(this.contextCommits, selectedCommit.short_id) === -1, findCommitIndex(this.contextCommits, selectedCommit.short_id) === -1,
); );
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
this.focusSearch(); this.focusSearch();
if (this.shouldPurge) { if (this.shouldPurge) {
this.setSelectedCommits( this.setSelectedCommits(
[...this.commits, ...this.selectedCommits].filter(commit => commit.isSelected), [...this.commits, ...this.selectedCommits].filter((commit) => commit.isSelected),
); );
} }
} }
...@@ -178,7 +178,7 @@ export default { ...@@ -178,7 +178,7 @@ export default {
this.setCommits({ commits: tempCommits }); this.setCommits({ commits: tempCommits });
this.setSelectedCommits([ this.setSelectedCommits([
...tempSelectedCommits, ...tempSelectedCommits,
...tempCommits.filter(commit => commit.isSelected), ...tempCommits.filter((commit) => commit.isSelected),
]); ]);
}, },
handleCreateContextCommits() { handleCreateContextCommits() {
...@@ -186,7 +186,7 @@ export default { ...@@ -186,7 +186,7 @@ export default {
return Promise.all([ return Promise.all([
this.createContextCommits({ commits: this.uniqueCommits }), this.createContextCommits({ commits: this.uniqueCommits }),
this.removeContextCommits(), this.removeContextCommits(),
]).then(values => { ]).then((values) => {
if (values[0] || values[1]) { if (values[0] || values[1]) {
window.location.reload(); window.location.reload();
} }
......
...@@ -27,10 +27,10 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => { ...@@ -27,10 +27,10 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => {
return axios return axios
.get(state.contextCommitsPath, params) .get(state.contextCommitsPath, params)
.then(({ data }) => { .then(({ data }) => {
let commits = data.map(o => ({ ...o, isSelected: false })); let commits = data.map((o) => ({ ...o, isSelected: false }));
commits = commits.map(c => { commits = commits.map((c) => {
const isPresent = state.selectedCommits.find( const isPresent = state.selectedCommits.find(
selectedCommit => selectedCommit.short_id === c.short_id && selectedCommit.isSelected, (selectedCommit) => selectedCommit.short_id === c.short_id && selectedCommit.isSelected,
); );
if (isPresent) { if (isPresent) {
return { ...c, isSelected: true }; return { ...c, isSelected: true };
...@@ -50,7 +50,7 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => { ...@@ -50,7 +50,7 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => {
export const setCommits = ({ commit }, { commits: data, silentAddition = false }) => { export const setCommits = ({ commit }, { commits: data, silentAddition = false }) => {
let commits = _.uniqBy(data, 'short_id'); let commits = _.uniqBy(data, 'short_id');
commits = _.orderBy(data, c => new Date(c.committed_date), ['desc']); commits = _.orderBy(data, (c) => new Date(c.committed_date), ['desc']);
if (silentAddition) { if (silentAddition) {
commit(types.SET_COMMITS_SILENT, commits); commit(types.SET_COMMITS_SILENT, commits);
} else { } else {
...@@ -60,7 +60,7 @@ export const setCommits = ({ commit }, { commits: data, silentAddition = false } ...@@ -60,7 +60,7 @@ export const setCommits = ({ commit }, { commits: data, silentAddition = false }
export const createContextCommits = ({ state }, { commits, forceReload = false }) => export const createContextCommits = ({ state }, { commits, forceReload = false }) =>
Api.createContextCommits(state.projectId, state.mergeRequestIid, { Api.createContextCommits(state.projectId, state.mergeRequestIid, {
commits: commits.map(commit => commit.short_id), commits: commits.map((commit) => commit.short_id),
}) })
.then(() => { .then(() => {
if (forceReload) { if (forceReload) {
...@@ -81,7 +81,7 @@ export const fetchContextCommits = ({ dispatch, commit, state }) => { ...@@ -81,7 +81,7 @@ export const fetchContextCommits = ({ dispatch, commit, state }) => {
commit(types.FETCH_CONTEXT_COMMITS); commit(types.FETCH_CONTEXT_COMMITS);
return Api.allContextCommits(state.projectId, state.mergeRequestIid) return Api.allContextCommits(state.projectId, state.mergeRequestIid)
.then(({ data }) => { .then(({ data }) => {
const contextCommits = data.map(o => ({ ...o, isSelected: true })); const contextCommits = data.map((o) => ({ ...o, isSelected: true }));
dispatch('setContextCommits', contextCommits); dispatch('setContextCommits', contextCommits);
dispatch('setCommits', { dispatch('setCommits', {
commits: [...state.commits, ...contextCommits], commits: [...state.commits, ...contextCommits],
...@@ -121,7 +121,7 @@ export const setSelectedCommits = ({ commit }, selected) => { ...@@ -121,7 +121,7 @@ export const setSelectedCommits = ({ commit }, selected) => {
let selectedCommits = _.uniqBy(selected, 'short_id'); let selectedCommits = _.uniqBy(selected, 'short_id');
selectedCommits = _.orderBy( selectedCommits = _.orderBy(
selectedCommits, selectedCommits,
selectedCommit => new Date(selectedCommit.committed_date), (selectedCommit) => new Date(selectedCommit.committed_date),
['desc'], ['desc'],
); );
commit(types.SET_SELECTED_COMMITS, selectedCommits); commit(types.SET_SELECTED_COMMITS, selectedCommits);
......
export const findCommitIndex = (commits, commitShortId) => { export const findCommitIndex = (commits, commitShortId) => {
return commits.findIndex(commit => commit.short_id === commitShortId); return commits.findIndex((commit) => commit.short_id === commitShortId);
}; };
export const setCommitStatus = (commits, commitIndex, selected) => { export const setCommitStatus = (commits, commitIndex, selected) => {
......
import PayloadPreviewer from '~/pages/admin/application_settings/payload_previewer'; import PayloadPreviewer from '~/pages/admin/application_settings/payload_previewer';
export default () => { export default () => {
Array.from(document.querySelectorAll('.js-payload-preview-trigger')).forEach(trigger => { Array.from(document.querySelectorAll('.js-payload-preview-trigger')).forEach((trigger) => {
new PayloadPreviewer(trigger).init(); new PayloadPreviewer(trigger).init();
}); });
}; };
...@@ -13,7 +13,7 @@ export const fetchStatistics = ({ dispatch }) => { ...@@ -13,7 +13,7 @@ export const fetchStatistics = ({ dispatch }) => {
.then(({ data }) => { .then(({ data }) => {
dispatch('receiveStatisticsSuccess', convertObjectPropsToCamelCase(data, { deep: true })); dispatch('receiveStatisticsSuccess', convertObjectPropsToCamelCase(data, { deep: true }));
}) })
.catch(error => dispatch('receiveStatisticsError', error)); .catch((error) => dispatch('receiveStatisticsError', error));
}; };
export const receiveStatisticsSuccess = ({ commit }, statistics) => export const receiveStatisticsSuccess = ({ commit }, statistics) =>
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* and returns an array of the following form: * and returns an array of the following form:
* [{ key: "forks", label: "Forks", value: 50 }] * [{ key: "forks", label: "Forks", value: 50 }]
*/ */
export const getStatistics = state => labels => export const getStatistics = (state) => (labels) =>
Object.keys(labels).map(key => { Object.keys(labels).map((key) => {
const result = { const result = {
key, key,
label: labels[key], label: labels[key],
......
...@@ -4,7 +4,7 @@ import { __ } from '~/locale'; ...@@ -4,7 +4,7 @@ import { __ } from '~/locale';
const DEFAULT_TH_CLASSES = const DEFAULT_TH_CLASSES =
'gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!'; 'gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!';
const thWidthClass = width => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`; const thWidthClass = (width) => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`;
export default { export default {
components: { components: {
......
...@@ -11,7 +11,7 @@ export default function (el = document.querySelector('#js-admin-users-app')) { ...@@ -11,7 +11,7 @@ export default function (el = document.querySelector('#js-admin-users-app')) {
return new Vue({ return new Vue({
el, el,
render: createElement => render: (createElement) =>
createElement(AdminUsersApp, { createElement(AdminUsersApp, {
props: { props: {
users: convertObjectPropsToCamelCase(JSON.parse(users), { deep: true }), users: convertObjectPropsToCamelCase(JSON.parse(users), { deep: true }),
......
...@@ -8,9 +8,9 @@ export default function initAlertHandler() { ...@@ -8,9 +8,9 @@ export default function initAlertHandler() {
const DISMISS_LABEL = '[aria-label="Dismiss"]'; const DISMISS_LABEL = '[aria-label="Dismiss"]';
const DISMISS_CLASS = '.gl-alert-dismiss'; const DISMISS_CLASS = '.gl-alert-dismiss';
DISMISSIBLE_SELECTORS.forEach(selector => { DISMISSIBLE_SELECTORS.forEach((selector) => {
const elements = document.querySelectorAll(selector); const elements = document.querySelectorAll(selector);
elements.forEach(element => { elements.forEach((element) => {
const button = element.querySelector(DISMISS_LABEL) || element.querySelector(DISMISS_CLASS); const button = element.querySelector(DISMISS_LABEL) || element.querySelector(DISMISS_CLASS);
if (!button) { if (!button) {
return; return;
......
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
}, },
currentTabIndex: { currentTabIndex: {
get() { get() {
return this.$options.tabsConfig.findIndex(tab => tab.id === this.activeTab); return this.$options.tabsConfig.findIndex((tab) => tab.id === this.activeTab);
}, },
set(tabIdx) { set(tabIdx) {
const tabId = this.$options.tabsConfig[tabIdx].id; const tabId = this.$options.tabsConfig[tabIdx].id;
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
} }
}, },
) )
.catch(error => { .catch((error) => {
this.createIncidentError = error; this.createIncidentError = error;
this.incidentCreationInProgress = false; this.incidentCreationInProgress = false;
}); });
......
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
data.project || {}; data.project || {};
const now = new Date(); const now = new Date();
const listWithData = list.map(alert => { const listWithData = list.map((alert) => {
const then = new Date(alert.startedAt); const then = new Date(alert.startedAt);
const diff = now - then; const diff = now - then;
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
}); });
this.metricEmbedComponent = MetricEmbed; this.metricEmbedComponent = MetricEmbed;
}) })
.catch(e => Sentry.captureException(e)); .catch((e) => Sentry.captureException(e));
} }
}, },
}; };
......
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
projectPath: this.projectPath, projectPath: this.projectPath,
}, },
}) })
.then(resp => { .then((resp) => {
this.trackStatusUpdate(status); this.trackStatusUpdate(status);
const errors = resp.data?.updateAlertStatus?.errors || []; const errors = resp.data?.updateAlertStatus?.errors || [];
......
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
}, },
sortedUsers() { sortedUsers() {
return this.users return this.users
.map(user => ({ ...user, active: this.isActive(user.username) })) .map((user) => ({ ...user, active: this.isActive(user.username) }))
.sort((a, b) => (a.active === b.active ? 0 : a.active ? -1 : 1)); // eslint-disable-line no-nested-ternary .sort((a, b) => (a.active === b.active ? 0 : a.active ? -1 : 1)); // eslint-disable-line no-nested-ternary
}, },
dropdownClass() { dropdownClass() {
......
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
variables: this.getAlertQueryVariables, variables: this.getAlertQueryVariables,
}); });
const data = produce(sourceData, draftData => { const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftData.project.alertManagementAlerts.nodes[0].todos.nodes = []; draftData.project.alertManagementAlerts.nodes[0].todos.nodes = [];
}); });
......
...@@ -9,7 +9,7 @@ import createRouter from './router'; ...@@ -9,7 +9,7 @@ import createRouter from './router';
Vue.use(VueApollo); Vue.use(VueApollo);
export default selector => { export default (selector) => {
const domEl = document.querySelector(selector); const domEl = document.querySelector(selector);
const { alertId, projectPath, projectIssuesPath, projectId } = domEl.dataset; const { alertId, projectPath, projectIssuesPath, projectId } = domEl.dataset;
const router = createRouter(); const router = createRouter();
...@@ -18,7 +18,7 @@ export default selector => { ...@@ -18,7 +18,7 @@ export default selector => {
Mutation: { Mutation: {
toggleSidebarStatus: (_, __, { cache }) => { toggleSidebarStatus: (_, __, { cache }) => {
const sourceData = cache.readQuery({ query: sidebarStatusQuery }); const sourceData = cache.readQuery({ query: sidebarStatusQuery });
const data = produce(sourceData, draftData => { const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftData.sidebarStatus = !draftData.sidebarStatus; draftData.sidebarStatus = !draftData.sidebarStatus;
}); });
...@@ -30,7 +30,7 @@ export default selector => { ...@@ -30,7 +30,7 @@ export default selector => {
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(resolvers, { defaultClient: createDefaultClient(resolvers, {
cacheConfig: { cacheConfig: {
dataIdFromObject: object => { dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
if (object.__typename === 'AlertManagementAlert') { if (object.__typename === 'AlertManagementAlert') {
return object.iid; return object.iid;
......
...@@ -30,7 +30,7 @@ export default () => { ...@@ -30,7 +30,7 @@ export default () => {
{}, {},
{ {
cacheConfig: { cacheConfig: {
dataIdFromObject: object => { dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
if (object.__typename === 'AlertManagementAlert') { if (object.__typename === 'AlertManagementAlert') {
return object.iid; return object.iid;
......
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
}, },
methods: { methods: {
updateIcon() { updateIcon() {
return document.querySelectorAll('.js-service-active-status').forEach(icon => { return document.querySelectorAll('.js-service-active-status').forEach((icon) => {
if (icon.dataset.value === this.activated.toString()) { if (icon.dataset.value === this.activated.toString()) {
icon.classList.remove('d-none'); icon.classList.remove('d-none');
} else { } else {
...@@ -109,7 +109,7 @@ export default { ...@@ -109,7 +109,7 @@ export default {
resetKey() { resetKey() {
return axios return axios
.put(this.formPath, { service: { token: '' } }) .put(this.formPath, { service: { token: '' } })
.then(res => { .then((res) => {
this.authorizationKey = res.data.token; this.authorizationKey = res.data.token;
}) })
.catch(() => { .catch(() => {
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import AlertsServiceForm from './components/alerts_service_form.vue'; import AlertsServiceForm from './components/alerts_service_form.vue';
export default el => { export default (el) => {
if (!el) { if (!el) {
return null; return null;
} }
......
...@@ -64,9 +64,9 @@ export default { ...@@ -64,9 +64,9 @@ export default {
}, },
computed: { computed: {
mappingData() { mappingData() {
return this.gitlabFields.map(gitlabField => { return this.gitlabFields.map((gitlabField) => {
const mappingFields = this.payloadFields.filter(({ type }) => const mappingFields = this.payloadFields.filter(({ type }) =>
type.some(t => gitlabField.compatibleTypes.includes(t)), type.some((t) => gitlabField.compatibleTypes.includes(t)),
); );
const foundMapping = this.mapping.find( const foundMapping = this.mapping.find(
...@@ -88,26 +88,26 @@ export default { ...@@ -88,26 +88,26 @@ export default {
}, },
methods: { methods: {
setMapping(gitlabKey, mappingKey, valueKey) { setMapping(gitlabKey, mappingKey, valueKey) {
const fieldIndex = this.gitlabFields.findIndex(field => field.name === gitlabKey); const fieldIndex = this.gitlabFields.findIndex((field) => field.name === gitlabKey);
const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [valueKey]: mappingKey } }; const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [valueKey]: mappingKey } };
Vue.set(this.gitlabFields, fieldIndex, updatedField); Vue.set(this.gitlabFields, fieldIndex, updatedField);
}, },
setSearchTerm(search = '', searchFieldKey, gitlabKey) { setSearchTerm(search = '', searchFieldKey, gitlabKey) {
const fieldIndex = this.gitlabFields.findIndex(field => field.name === gitlabKey); const fieldIndex = this.gitlabFields.findIndex((field) => field.name === gitlabKey);
const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [searchFieldKey]: search } }; const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [searchFieldKey]: search } };
Vue.set(this.gitlabFields, fieldIndex, updatedField); Vue.set(this.gitlabFields, fieldIndex, updatedField);
}, },
filterFields(searchTerm = '', fields) { filterFields(searchTerm = '', fields) {
const search = searchTerm.toLowerCase(); const search = searchTerm.toLowerCase();
return fields.filter(field => field.label.toLowerCase().includes(search)); return fields.filter((field) => field.label.toLowerCase().includes(search));
}, },
isSelected(fieldValue, mapping) { isSelected(fieldValue, mapping) {
return fieldValue === mapping; return fieldValue === mapping;
}, },
selectedValue(name) { selectedValue(name) {
return ( return (
this.payloadFields.find(item => item.name === name)?.label || this.payloadFields.find((item) => item.name === name)?.label ||
this.$options.i18n.makeSelection this.$options.i18n.makeSelection
); );
}, },
......
...@@ -97,8 +97,8 @@ export default { ...@@ -97,8 +97,8 @@ export default {
}; };
}, },
mounted() { mounted() {
const callback = entries => { const callback = (entries) => {
const isVisible = entries.some(entry => entry.isIntersecting); const isVisible = entries.some((entry) => entry.isIntersecting);
if (isVisible) { if (isVisible) {
this.trackPageViews(); this.trackPageViews();
......
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
return options; return options;
}, },
options() { options() {
return integrationTypesNew.map(el => ({ return integrationTypesNew.map((el) => ({
...el, ...el,
disabled: this.disabledIntegrations.includes(el.value), disabled: this.disabledIntegrations.includes(el.value),
})); }));
...@@ -390,10 +390,10 @@ export default { ...@@ -390,10 +390,10 @@ export default {
// TODO: replace with real BE mutation when ready; // TODO: replace with real BE mutation when ready;
this.parsingPayload = true; this.parsingPayload = true;
return new Promise(resolve => { return new Promise((resolve) => {
setTimeout(() => resolve(mockedCustomMapping), 1000); setTimeout(() => resolve(mockedCustomMapping), 1000);
}) })
.then(res => { .then((res) => {
const mapping = { ...res }; const mapping = { ...res };
delete mapping.storedMapping; delete mapping.storedMapping;
this.customMapping = res; this.customMapping = res;
...@@ -408,7 +408,7 @@ export default { ...@@ -408,7 +408,7 @@ export default {
}, },
getIntegrationMapping() { getIntegrationMapping() {
// TODO: replace with real BE mutation when ready; // TODO: replace with real BE mutation when ready;
return Promise.resolve(mockedCustomMapping).then(res => { return Promise.resolve(mockedCustomMapping).then((res) => {
this.customMapping = res; this.customMapping = res;
this.integrationTestPayload.json = res?.samplePayload.body; this.integrationTestPayload.json = res?.samplePayload.body;
}); });
......
...@@ -14,7 +14,7 @@ const resolvers = { ...@@ -14,7 +14,7 @@ const resolvers = {
{ cache }, { cache },
) => { ) => {
const sourceData = cache.readQuery({ query: getCurrentIntegrationQuery }); const sourceData = cache.readQuery({ query: getCurrentIntegrationQuery });
const data = produce(sourceData, draftData => { const data = produce(sourceData, (draftData) => {
if (id === null) { if (id === null) {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftData.currentIntegration = null; draftData.currentIntegration = null;
......
...@@ -11,7 +11,7 @@ apolloProvider.clients.defaultClient.cache.writeData({ ...@@ -11,7 +11,7 @@ apolloProvider.clients.defaultClient.cache.writeData({
}); });
Vue.use(GlToast); Vue.use(GlToast);
export default el => { export default (el) => {
if (!el) { if (!el) {
return null; return null;
} }
......
...@@ -14,7 +14,7 @@ const deleteIntegrationFromStore = (store, query, { httpIntegrationDestroy }, va ...@@ -14,7 +14,7 @@ const deleteIntegrationFromStore = (store, query, { httpIntegrationDestroy }, va
variables, variables,
}); });
const data = produce(sourceData, draftData => { const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftData.project.alertManagementIntegrations.nodes = draftData.project.alertManagementIntegrations.nodes.filter( draftData.project.alertManagementIntegrations.nodes = draftData.project.alertManagementIntegrations.nodes.filter(
({ id }) => id !== integration.id, ({ id }) => id !== integration.id,
...@@ -45,7 +45,7 @@ const addIntegrationToStore = ( ...@@ -45,7 +45,7 @@ const addIntegrationToStore = (
variables, variables,
}); });
const data = produce(sourceData, draftData => { const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftData.project.alertManagementIntegrations.nodes = [ draftData.project.alertManagementIntegrations.nodes = [
integration, integration,
......
...@@ -60,13 +60,13 @@ export default { ...@@ -60,13 +60,13 @@ export default {
return Object.values(this.errors); return Object.values(this.errors);
}, },
isLoading() { isLoading() {
return some(this.$apollo.queries, query => query?.loading); return some(this.$apollo.queries, (query) => query?.loading);
}, },
allQueriesFailed() { allQueriesFailed() {
return every(this.errorMessages, message => message.length); return every(this.errorMessages, (message) => message.length);
}, },
hasLoadingErrors() { hasLoadingErrors() {
return some(this.errorMessages, message => message.length); return some(this.errorMessages, (message) => message.length);
}, },
errorMessage() { errorMessage() {
// show the generic loading message if all requests fail // show the generic loading message if all requests fail
...@@ -179,7 +179,7 @@ export default { ...@@ -179,7 +179,7 @@ export default {
}; };
}, },
}) })
.catch(error => this.handleError({ identifier, error, message: errorMessage })); .catch((error) => this.handleError({ identifier, error, message: errorMessage }));
}, },
}, },
}; };
......
...@@ -11,7 +11,7 @@ import latestGroupsQuery from '../graphql/queries/groups.query.graphql'; ...@@ -11,7 +11,7 @@ import latestGroupsQuery from '../graphql/queries/groups.query.graphql';
import latestProjectsQuery from '../graphql/queries/projects.query.graphql'; import latestProjectsQuery from '../graphql/queries/projects.query.graphql';
import { getAverageByMonth } from '../utils'; import { getAverageByMonth } from '../utils';
const sortByDate = data => sortBy(data, item => new Date(item[0]).getTime()); const sortByDate = (data) => sortBy(data, (item) => new Date(item[0]).getTime());
const averageAndSortData = (data = [], maxDataPoints) => { const averageAndSortData = (data = [], maxDataPoints) => {
const averaged = getAverageByMonth( const averaged = getAverageByMonth(
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
name: this.$options.i18n.xAxisTitle, name: this.$options.i18n.xAxisTitle,
type: 'category', type: 'category',
axisLabel: { axisLabel: {
formatter: value => { formatter: (value) => {
return formatDateAsMonth(value); return formatDateAsMonth(value);
}, },
}, },
...@@ -189,7 +189,7 @@ export default { ...@@ -189,7 +189,7 @@ export default {
.fetchMore({ .fetchMore({
variables: { first: this.totalDataPoints, after: pageInfo.endCursor }, variables: { first: this.totalDataPoints, after: pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => { updateQuery: (previousResult, { fetchMoreResult }) => {
const results = produce(fetchMoreResult, newData => { const results = produce(fetchMoreResult, (newData) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
newData[dataKey].nodes = [ newData[dataKey].nodes = [
...previousResult[dataKey].nodes, ...previousResult[dataKey].nodes,
...@@ -199,7 +199,7 @@ export default { ...@@ -199,7 +199,7 @@ export default {
return results; return results;
}, },
}) })
.catch(error => { .catch((error) => {
this.handleError({ error, message: errorMessage, dataKey }); this.handleError({ error, message: errorMessage, dataKey });
}); });
} }
......
...@@ -10,7 +10,7 @@ import { formatDateAsMonth } from '~/lib/utils/datetime_utility'; ...@@ -10,7 +10,7 @@ import { formatDateAsMonth } from '~/lib/utils/datetime_utility';
import usersQuery from '../graphql/queries/users.query.graphql'; import usersQuery from '../graphql/queries/users.query.graphql';
import { getAverageByMonth } from '../utils'; import { getAverageByMonth } from '../utils';
const sortByDate = data => sortBy(data, item => new Date(item[0]).getTime()); const sortByDate = (data) => sortBy(data, (item) => new Date(item[0]).getTime());
export default { export default {
name: 'UsersChart', name: 'UsersChart',
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
.fetchMore({ .fetchMore({
variables: { first: this.totalDataPoints, after: this.pageInfo.endCursor }, variables: { first: this.totalDataPoints, after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => { updateQuery: (previousResult, { fetchMoreResult }) => {
return produce(fetchMoreResult, newUsers => { return produce(fetchMoreResult, (newUsers) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
newUsers.users.nodes = [...previousResult.users.nodes, ...newUsers.users.nodes]; newUsers.users.nodes = [...previousResult.users.nodes, ...newUsers.users.nodes];
}); });
......
...@@ -29,7 +29,7 @@ export function getAverageByMonth(items = [], options = {}) { ...@@ -29,7 +29,7 @@ export function getAverageByMonth(items = [], options = {}) {
return { ...memo, [month]: { sum: count, recordCount: 1 } }; return { ...memo, [month]: { sum: count, recordCount: 1 } };
}, {}); }, {});
return Object.keys(itemsMap).map(month => { return Object.keys(itemsMap).map((month) => {
const { sum, recordCount } = itemsMap[month]; const { sum, recordCount } = itemsMap[month];
const avg = sum / recordCount; const avg = sum / recordCount;
if (shouldRound) { if (shouldRound) {
......
...@@ -8,7 +8,7 @@ export default () => { ...@@ -8,7 +8,7 @@ export default () => {
return false; return false;
} }
return containers.forEach(container => { return containers.forEach((container) => {
const { chartData } = container.dataset; const { chartData } = container.dataset;
const formattedData = JSON.parse(chartData); const formattedData = JSON.parse(chartData);
......
...@@ -374,8 +374,8 @@ const Api = { ...@@ -374,8 +374,8 @@ const Api = {
.post(url, { .post(url, {
label: data, label: data,
}) })
.then(res => callback(res.data)) .then((res) => callback(res.data))
.catch(e => callback(e.response.data)); .catch((e) => callback(e.response.data));
}, },
// Return group projects list. Filtered by query // Return group projects list. Filtered by query
...@@ -431,7 +431,7 @@ const Api = { ...@@ -431,7 +431,7 @@ const Api = {
commitPipelines(projectId, sha) { commitPipelines(projectId, sha) {
const encodedProjectId = projectId const encodedProjectId = projectId
.split('/') .split('/')
.map(fragment => encodeURIComponent(fragment)) .map((fragment) => encodeURIComponent(fragment))
.join('/'); .join('/');
const url = Api.buildUrl(Api.commitPipelinesPath) const url = Api.buildUrl(Api.commitPipelinesPath)
...@@ -455,7 +455,7 @@ const Api = { ...@@ -455,7 +455,7 @@ const Api = {
.replace(':type', type) .replace(':type', type)
.replace(':key', encodeURIComponent(key)); .replace(':key', encodeURIComponent(key));
return axios.get(url, { params: options }).then(res => { return axios.get(url, { params: options }).then((res) => {
if (callback) callback(res.data); if (callback) callback(res.data);
return res; return res;
...@@ -467,7 +467,7 @@ const Api = { ...@@ -467,7 +467,7 @@ const Api = {
.replace(':id', encodeURIComponent(id)) .replace(':id', encodeURIComponent(id))
.replace(':type', type); .replace(':type', type);
return axios.get(url, { params }).then(res => { return axios.get(url, { params }).then((res) => {
if (callback) callback(res.data); if (callback) callback(res.data);
return res; return res;
......
...@@ -37,7 +37,7 @@ export default class U2FAuthenticate { ...@@ -37,7 +37,7 @@ export default class U2FAuthenticate {
// Note: The server library fixes this behaviour in (unreleased) version 1.0.0. // Note: The server library fixes this behaviour in (unreleased) version 1.0.0.
// This can be removed once we upgrade. // This can be removed once we upgrade.
// https://github.com/castle/ruby-u2f/commit/103f428071a81cd3d5f80c2e77d522d5029946a4 // https://github.com/castle/ruby-u2f/commit/103f428071a81cd3d5f80c2e77d522d5029946a4
this.signRequests = u2fParams.sign_requests.map(request => omit(request, 'challenge')); this.signRequests = u2fParams.sign_requests.map((request) => omit(request, 'challenge'));
this.templates = { this.templates = {
inProgress: '#js-authenticate-token-2fa-in-progress', inProgress: '#js-authenticate-token-2fa-in-progress',
...@@ -48,7 +48,7 @@ export default class U2FAuthenticate { ...@@ -48,7 +48,7 @@ export default class U2FAuthenticate {
start() { start() {
return importU2FLibrary() return importU2FLibrary()
.then(utils => { .then((utils) => {
this.u2fUtils = utils; this.u2fUtils = utils;
this.renderInProgress(); this.renderInProgress();
}) })
...@@ -60,7 +60,7 @@ export default class U2FAuthenticate { ...@@ -60,7 +60,7 @@ export default class U2FAuthenticate {
this.appId, this.appId,
this.challenge, this.challenge,
this.signRequests, this.signRequests,
response => { (response) => {
if (response.errorCode) { if (response.errorCode) {
const error = new U2FError(response.errorCode, 'authenticate'); const error = new U2FError(response.errorCode, 'authenticate');
return this.renderError(error); return this.renderError(error);
......
...@@ -34,7 +34,7 @@ export default class U2FRegister { ...@@ -34,7 +34,7 @@ export default class U2FRegister {
start() { start() {
return importU2FLibrary() return importU2FLibrary()
.then(utils => { .then((utils) => {
this.u2fUtils = utils; this.u2fUtils = utils;
this.renderSetup(); this.renderSetup();
}) })
...@@ -46,7 +46,7 @@ export default class U2FRegister { ...@@ -46,7 +46,7 @@ export default class U2FRegister {
this.appId, this.appId,
this.registerRequests, this.registerRequests,
this.signRequests, this.signRequests,
response => { (response) => {
if (response.errorCode) { if (response.errorCode) {
const error = new U2FError(response.errorCode, 'register'); const error = new U2FError(response.errorCode, 'register');
return this.renderError(error); return this.renderError(error);
......
...@@ -39,11 +39,11 @@ export default class WebAuthnAuthenticate { ...@@ -39,11 +39,11 @@ export default class WebAuthnAuthenticate {
authenticate() { authenticate() {
navigator.credentials navigator.credentials
.get({ publicKey: this.webauthnParams }) .get({ publicKey: this.webauthnParams })
.then(resp => { .then((resp) => {
const convertedResponse = convertGetResponse(resp); const convertedResponse = convertGetResponse(resp);
this.renderAuthenticated(JSON.stringify(convertedResponse)); this.renderAuthenticated(JSON.stringify(convertedResponse));
}) })
.catch(err => { .catch((err) => {
this.flow.renderError(new WebAuthnError(err, 'authenticate')); this.flow.renderError(new WebAuthnError(err, 'authenticate'));
}); });
} }
......
...@@ -39,8 +39,8 @@ export default class WebAuthnRegister { ...@@ -39,8 +39,8 @@ export default class WebAuthnRegister {
.create({ .create({
publicKey: this.webauthnOptions, publicKey: this.webauthnOptions,
}) })
.then(cred => this.renderRegistered(JSON.stringify(convertCreateResponse(cred)))) .then((cred) => this.renderRegistered(JSON.stringify(convertCreateResponse(cred))))
.catch(err => this.flow.renderError(new WebAuthnError(err, 'register'))); .catch((err) => this.flow.renderError(new WebAuthnError(err, 'register')));
} }
renderSetup() { renderSetup() {
......
...@@ -56,13 +56,13 @@ export class AwardsHandler { ...@@ -56,13 +56,13 @@ export class AwardsHandler {
} }
}, },
); );
this.registerEventListener('on', $parentEl, 'click', this.toggleButtonSelector, e => { this.registerEventListener('on', $parentEl, 'click', this.toggleButtonSelector, (e) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.showEmojiMenu($(e.currentTarget)); this.showEmojiMenu($(e.currentTarget));
}); });
this.registerEventListener('on', $('html'), 'click', e => { this.registerEventListener('on', $('html'), 'click', (e) => {
const $target = $(e.target); const $target = $(e.target);
if (!$target.closest(`.${this.menuClass}`).length) { if (!$target.closest(`.${this.menuClass}`).length) {
$('.js-awards-block.current').removeClass('current'); $('.js-awards-block.current').removeClass('current');
...@@ -74,7 +74,7 @@ export class AwardsHandler { ...@@ -74,7 +74,7 @@ export class AwardsHandler {
}); });
const emojiButtonSelector = `.js-awards-block .js-emoji-btn, .${this.menuClass} .js-emoji-btn`; const emojiButtonSelector = `.js-awards-block .js-emoji-btn, .${this.menuClass} .js-emoji-btn`;
this.registerEventListener('on', $parentEl, 'click', emojiButtonSelector, e => { this.registerEventListener('on', $parentEl, 'click', emojiButtonSelector, (e) => {
e.preventDefault(); e.preventDefault();
const $target = $(e.currentTarget); const $target = $(e.currentTarget);
const $glEmojiElement = $target.find('gl-emoji'); const $glEmojiElement = $target.find('gl-emoji');
...@@ -190,7 +190,7 @@ export class AwardsHandler { ...@@ -190,7 +190,7 @@ export class AwardsHandler {
(promiseChain, categoryNameKey) => (promiseChain, categoryNameKey) =>
promiseChain.then( promiseChain.then(
() => () =>
new Promise(resolve => { new Promise((resolve) => {
const emojisInCategory = categoryMap[categoryNameKey]; const emojisInCategory = categoryMap[categoryNameKey];
const categoryMarkup = this.renderCategory( const categoryMarkup = this.renderCategory(
categoryLabelMap[categoryNameKey], categoryLabelMap[categoryNameKey],
...@@ -213,7 +213,7 @@ export class AwardsHandler { ...@@ -213,7 +213,7 @@ export class AwardsHandler {
menu.dispatchEvent(new CustomEvent('build-emoji-menu-finish')); menu.dispatchEvent(new CustomEvent('build-emoji-menu-finish'));
} }
}) })
.catch(err => { .catch((err) => {
emojiContentElement.insertAdjacentHTML( emojiContentElement.insertAdjacentHTML(
'beforeend', 'beforeend',
'<p>We encountered an error while adding the remaining categories</p>', '<p>We encountered an error while adding the remaining categories</p>',
...@@ -230,7 +230,7 @@ export class AwardsHandler { ...@@ -230,7 +230,7 @@ export class AwardsHandler {
<ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}"> <ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}">
${emojiList ${emojiList
.map( .map(
emojiName => ` (emojiName) => `
<li class="emoji-menu-list-item"> <li class="emoji-menu-list-item">
<button class="emoji-menu-btn text-center js-emoji-btn" type="button"> <button class="emoji-menu-btn text-center js-emoji-btn" type="button">
${this.emoji.glEmojiTag(emojiName, { ${this.emoji.glEmojiTag(emojiName, {
...@@ -463,7 +463,7 @@ export class AwardsHandler { ...@@ -463,7 +463,7 @@ export class AwardsHandler {
const className = 'pulse animated once short'; const className = 'pulse animated once short';
$emoji.addClass(className); $emoji.addClass(className);
this.registerEventListener('on', $emoji, animationEndEventString, e => { this.registerEventListener('on', $emoji, animationEndEventString, (e) => {
$(e.currentTarget).removeClass(className); $(e.currentTarget).removeClass(className);
}); });
} }
...@@ -515,7 +515,7 @@ export class AwardsHandler { ...@@ -515,7 +515,7 @@ export class AwardsHandler {
this.frequentlyUsedEmojis || this.frequentlyUsedEmojis ||
(() => { (() => {
const frequentlyUsedEmojis = uniq((Cookies.get('frequently_used_emojis') || '').split(',')); const frequentlyUsedEmojis = uniq((Cookies.get('frequently_used_emojis') || '').split(','));
this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter(inputName => this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter((inputName) =>
this.emoji.isEmojiNameValid(inputName), this.emoji.isEmojiNameValid(inputName),
); );
...@@ -527,13 +527,13 @@ export class AwardsHandler { ...@@ -527,13 +527,13 @@ export class AwardsHandler {
setupSearch() { setupSearch() {
const $search = $('.js-emoji-menu-search'); const $search = $('.js-emoji-menu-search');
this.registerEventListener('on', $search, 'input', e => { this.registerEventListener('on', $search, 'input', (e) => {
const term = $(e.target).val().trim(); const term = $(e.target).val().trim();
this.searchEmojis(term); this.searchEmojis(term);
}); });
const $menu = $(`.${this.menuClass}`); const $menu = $(`.${this.menuClass}`);
this.registerEventListener('on', $menu, transitionEndEventString, e => { this.registerEventListener('on', $menu, transitionEndEventString, (e) => {
if (e.target === e.currentTarget) { if (e.target === e.currentTarget) {
// Clear the search // Clear the search
this.searchEmojis(''); this.searchEmojis('');
...@@ -583,7 +583,7 @@ export class AwardsHandler { ...@@ -583,7 +583,7 @@ export class AwardsHandler {
} }
hideMenuElement($emojiMenu) { hideMenuElement($emojiMenu) {
$emojiMenu.on(transitionEndEventString, e => { $emojiMenu.on(transitionEndEventString, (e) => {
if (e.currentTarget === e.target) { if (e.currentTarget === e.target) {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$emojiMenu.removeClass(IS_RENDERED).off(transitionEndEventString); $emojiMenu.removeClass(IS_RENDERED).off(transitionEndEventString);
...@@ -594,7 +594,7 @@ export class AwardsHandler { ...@@ -594,7 +594,7 @@ export class AwardsHandler {
} }
destroy() { destroy() {
this.eventListeners.forEach(entry => { this.eventListeners.forEach((entry) => {
entry.element.off.call(entry.element, ...entry.args); entry.element.off.call(entry.element, ...entry.args);
}); });
$(`.${this.menuClass}`).remove(); $(`.${this.menuClass}`).remove();
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
}, },
helpText() { helpText() {
const placeholders = ['project_path', 'project_id', 'default_branch', 'commit_sha'] const placeholders = ['project_path', 'project_id', 'default_branch', 'commit_sha']
.map(placeholder => `<code>%{${placeholder}}</code>`) .map((placeholder) => `<code>%{${placeholder}}</code>`)
.join(', '); .join(', ');
return sprintf( return sprintf(
s__('Badges|Supported %{docsLinkStart}variables%{docsLinkEnd}: %{placeholders}'), s__('Badges|Supported %{docsLinkStart}variables%{docsLinkEnd}: %{placeholders}'),
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
createFlash(s__('Badges|Badge saved.'), 'notice'); createFlash(s__('Badges|Badge saved.'), 'notice');
this.wasValidated = false; this.wasValidated = false;
}) })
.catch(error => { .catch((error) => {
createFlash( createFlash(
s__('Badges|Saving the badge failed, please check the entered URLs and try again.'), s__('Badges|Saving the badge failed, please check the entered URLs and try again.'),
); );
...@@ -150,7 +150,7 @@ export default { ...@@ -150,7 +150,7 @@ export default {
createFlash(s__('Badges|New badge added.'), 'notice'); createFlash(s__('Badges|New badge added.'), 'notice');
this.wasValidated = false; this.wasValidated = false;
}) })
.catch(error => { .catch((error) => {
createFlash( createFlash(
s__('Badges|Adding the badge failed, please check the entered URLs and try again.'), s__('Badges|Adding the badge failed, please check the entered URLs and try again.'),
); );
......
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
.then(() => { .then(() => {
createFlash(s__('Badges|The badge was deleted.'), 'notice'); createFlash(s__('Badges|The badge was deleted.'), 'notice');
}) })
.catch(error => { .catch((error) => {
createFlash(s__('Badges|Deleting the badge failed, please try again.')); createFlash(s__('Badges|Deleting the badge failed, please try again.'));
throw error; throw error;
}); });
......
...@@ -2,7 +2,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -2,7 +2,7 @@ import axios from '~/lib/utils/axios_utils';
import types from './mutation_types'; import types from './mutation_types';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
export const transformBackendBadge = badge => ({ export const transformBackendBadge = (badge) => ({
...convertObjectPropsToCamelCase(badge, true), ...convertObjectPropsToCamelCase(badge, true),
isDeleting: false, isDeleting: false,
}); });
...@@ -27,11 +27,11 @@ export default { ...@@ -27,11 +27,11 @@ export default {
image_url: newBadge.imageUrl, image_url: newBadge.imageUrl,
link_url: newBadge.linkUrl, link_url: newBadge.linkUrl,
}) })
.catch(error => { .catch((error) => {
dispatch('receiveNewBadgeError'); dispatch('receiveNewBadgeError');
throw error; throw error;
}) })
.then(res => { .then((res) => {
dispatch('receiveNewBadge', transformBackendBadge(res.data)); dispatch('receiveNewBadge', transformBackendBadge(res.data));
}); });
}, },
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
const endpoint = `${state.apiEndpointUrl}/${badgeId}`; const endpoint = `${state.apiEndpointUrl}/${badgeId}`;
return axios return axios
.delete(endpoint) .delete(endpoint)
.catch(error => { .catch((error) => {
dispatch('receiveDeleteBadgeError', badgeId); dispatch('receiveDeleteBadgeError', badgeId);
throw error; throw error;
}) })
...@@ -78,11 +78,11 @@ export default { ...@@ -78,11 +78,11 @@ export default {
const endpoint = state.apiEndpointUrl; const endpoint = state.apiEndpointUrl;
return axios return axios
.get(endpoint) .get(endpoint)
.catch(error => { .catch((error) => {
dispatch('receiveLoadBadgesError'); dispatch('receiveLoadBadgesError');
throw error; throw error;
}) })
.then(res => { .then((res) => {
dispatch('receiveLoadBadges', res.data.map(transformBackendBadge)); dispatch('receiveLoadBadges', res.data.map(transformBackendBadge));
}); });
}, },
...@@ -113,11 +113,11 @@ export default { ...@@ -113,11 +113,11 @@ export default {
const renderEndpoint = `${state.apiEndpointUrl}/render?${parameters}`; const renderEndpoint = `${state.apiEndpointUrl}/render?${parameters}`;
return axios return axios
.get(renderEndpoint) .get(renderEndpoint)
.catch(error => { .catch((error) => {
dispatch('receiveRenderedBadgeError'); dispatch('receiveRenderedBadgeError');
throw error; throw error;
}) })
.then(res => { .then((res) => {
dispatch('receiveRenderedBadge', transformBackendBadge(res.data)); dispatch('receiveRenderedBadge', transformBackendBadge(res.data));
}); });
}, },
...@@ -142,11 +142,11 @@ export default { ...@@ -142,11 +142,11 @@ export default {
image_url: badge.imageUrl, image_url: badge.imageUrl,
link_url: badge.linkUrl, link_url: badge.linkUrl,
}) })
.catch(error => { .catch((error) => {
dispatch('receiveUpdatedBadgeError'); dispatch('receiveUpdatedBadgeError');
throw error; throw error;
}) })
.then(res => { .then((res) => {
dispatch('receiveUpdatedBadge', transformBackendBadge(res.data)); dispatch('receiveUpdatedBadge', transformBackendBadge(res.data));
}); });
}, },
......
import types from './mutation_types'; import types from './mutation_types';
import { PROJECT_BADGE } from '../constants'; import { PROJECT_BADGE } from '../constants';
const reorderBadges = badges => const reorderBadges = (badges) =>
badges.sort((a, b) => { badges.sort((a, b) => {
if (a.kind !== b.kind) { if (a.kind !== b.kind) {
return a.kind === PROJECT_BADGE ? 1 : -1; return a.kind === PROJECT_BADGE ? 1 : -1;
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
[types.RECEIVE_UPDATED_BADGE](state, updatedBadge) { [types.RECEIVE_UPDATED_BADGE](state, updatedBadge) {
const badges = state.badges.map(badge => { const badges = state.badges.map((badge) => {
if (badge.id === updatedBadge.id) { if (badge.id === updatedBadge.id) {
return updatedBadge; return updatedBadge;
} }
...@@ -77,13 +77,13 @@ export default { ...@@ -77,13 +77,13 @@ export default {
}, },
[types.RECEIVE_DELETE_BADGE](state, badgeId) { [types.RECEIVE_DELETE_BADGE](state, badgeId) {
const badges = state.badges.filter(badge => badge.id !== badgeId); const badges = state.badges.filter((badge) => badge.id !== badgeId);
Object.assign(state, { Object.assign(state, {
badges, badges,
}); });
}, },
[types.RECEIVE_DELETE_BADGE_ERROR](state, badgeId) { [types.RECEIVE_DELETE_BADGE_ERROR](state, badgeId) {
const badges = state.badges.map(badge => { const badges = state.badges.map((badge) => {
if (badge.id === badgeId) { if (badge.id === badgeId) {
return { return {
...badge, ...badge,
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
}); });
}, },
[types.REQUEST_DELETE_BADGE](state, badgeId) { [types.REQUEST_DELETE_BADGE](state, badgeId) {
const badges = state.badges.map(badge => { const badges = state.badges.map((badge) => {
if (badge.id === badgeId) { if (badge.id === badgeId) {
return { return {
...badge, ...badge,
......
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
} }
return sprintf(__("%{authorsName}'s thread"), { return sprintf(__("%{authorsName}'s thread"), {
authorsName: this.discussion.notes.find(note => !note.system).author.name, authorsName: this.discussion.notes.find((note) => !note.system).author.name,
}); });
}, },
linePosition() { linePosition() {
......
...@@ -11,8 +11,8 @@ export const saveDraft = ({ dispatch }, draft) => ...@@ -11,8 +11,8 @@ export const saveDraft = ({ dispatch }, draft) =>
export const addDraftToDiscussion = ({ commit }, { endpoint, data }) => export const addDraftToDiscussion = ({ commit }, { endpoint, data }) =>
service service
.addDraftToDiscussion(endpoint, data) .addDraftToDiscussion(endpoint, data)
.then(res => res.data) .then((res) => res.data)
.then(res => { .then((res) => {
commit(types.ADD_NEW_DRAFT, res); commit(types.ADD_NEW_DRAFT, res);
return res; return res;
}) })
...@@ -23,8 +23,8 @@ export const addDraftToDiscussion = ({ commit }, { endpoint, data }) => ...@@ -23,8 +23,8 @@ export const addDraftToDiscussion = ({ commit }, { endpoint, data }) =>
export const createNewDraft = ({ commit }, { endpoint, data }) => export const createNewDraft = ({ commit }, { endpoint, data }) =>
service service
.createNewDraft(endpoint, data) .createNewDraft(endpoint, data)
.then(res => res.data) .then((res) => res.data)
.then(res => { .then((res) => {
commit(types.ADD_NEW_DRAFT, res); commit(types.ADD_NEW_DRAFT, res);
return res; return res;
}) })
...@@ -43,8 +43,8 @@ export const deleteDraft = ({ commit, getters }, draft) => ...@@ -43,8 +43,8 @@ export const deleteDraft = ({ commit, getters }, draft) =>
export const fetchDrafts = ({ commit, getters }) => export const fetchDrafts = ({ commit, getters }) =>
service service
.fetchDrafts(getters.getNotesData.draftsPath) .fetchDrafts(getters.getNotesData.draftsPath)
.then(res => res.data) .then((res) => res.data)
.then(data => commit(types.SET_BATCH_COMMENTS_DRAFTS, data)) .then((data) => commit(types.SET_BATCH_COMMENTS_DRAFTS, data))
.catch(() => flash(__('An error occurred while fetching pending comments'))); .catch(() => flash(__('An error occurred while fetching pending comments')));
export const publishSingleDraft = ({ commit, dispatch, getters }, draftId) => { export const publishSingleDraft = ({ commit, dispatch, getters }, draftId) => {
...@@ -86,8 +86,8 @@ export const updateDraft = ( ...@@ -86,8 +86,8 @@ export const updateDraft = (
resolveDiscussion, resolveDiscussion,
position: JSON.stringify(position), position: JSON.stringify(position),
}) })
.then(res => res.data) .then((res) => res.data)
.then(data => commit(types.RECEIVE_DRAFT_UPDATE_SUCCESS, data)) .then((data) => commit(types.RECEIVE_DRAFT_UPDATE_SUCCESS, data))
.then(callback) .then(callback)
.catch(() => flash(__('An error occurred while updating the comment'))); .catch(() => flash(__('An error occurred while updating the comment')));
...@@ -116,8 +116,8 @@ export const scrollToDraft = ({ dispatch, rootGetters }, draft) => { ...@@ -116,8 +116,8 @@ export const scrollToDraft = ({ dispatch, rootGetters }, draft) => {
export const expandAllDiscussions = ({ dispatch, state }) => export const expandAllDiscussions = ({ dispatch, state }) =>
state.drafts state.drafts
.filter(draft => draft.discussion_id) .filter((draft) => draft.discussion_id)
.forEach(draft => { .forEach((draft) => {
dispatch('expandDiscussion', { discussionId: draft.discussion_id }, { root: true }); dispatch('expandDiscussion', { discussionId: draft.discussion_id }, { root: true });
}); });
......
import { parallelLineKey, showDraftOnSide } from '../../../utils'; import { parallelLineKey, showDraftOnSide } from '../../../utils';
export const draftsCount = state => state.drafts.length; export const draftsCount = (state) => state.drafts.length;
export const getNotesData = (state, getters, rootState, rootGetters) => rootGetters.getNotesData; export const getNotesData = (state, getters, rootState, rootGetters) => rootGetters.getNotesData;
export const hasDrafts = state => state.drafts.length > 0; export const hasDrafts = (state) => state.drafts.length > 0;
export const draftsPerDiscussionId = state => export const draftsPerDiscussionId = (state) =>
state.drafts.reduce((acc, draft) => { state.drafts.reduce((acc, draft) => {
if (draft.discussion_id) { if (draft.discussion_id) {
acc[draft.discussion_id] = draft; acc[draft.discussion_id] = draft;
...@@ -15,7 +15,7 @@ export const draftsPerDiscussionId = state => ...@@ -15,7 +15,7 @@ export const draftsPerDiscussionId = state =>
return acc; return acc;
}, {}); }, {});
export const draftsPerFileHashAndLine = state => export const draftsPerFileHashAndLine = (state) =>
state.drafts.reduce((acc, draft) => { state.drafts.reduce((acc, draft) => {
if (draft.file_hash) { if (draft.file_hash) {
if (!acc[draft.file_hash]) { if (!acc[draft.file_hash]) {
...@@ -55,10 +55,10 @@ export const hasParallelDraftRight = (state, getters) => (diffFileSha, line) => ...@@ -55,10 +55,10 @@ export const hasParallelDraftRight = (state, getters) => (diffFileSha, line) =>
return draftsForFile ? Boolean(draftsForFile[rkey]) : false; return draftsForFile ? Boolean(draftsForFile[rkey]) : false;
}; };
export const shouldRenderDraftRowInDiscussion = (state, getters) => discussionId => export const shouldRenderDraftRowInDiscussion = (state, getters) => (discussionId) =>
typeof getters.draftsPerDiscussionId[discussionId] !== 'undefined'; typeof getters.draftsPerDiscussionId[discussionId] !== 'undefined';
export const draftForDiscussion = (state, getters) => discussionId => export const draftForDiscussion = (state, getters) => (discussionId) =>
getters.draftsPerDiscussionId[discussionId] || {}; getters.draftsPerDiscussionId[discussionId] || {};
export const draftForLine = (state, getters) => (diffFileSha, line, side = null) => { export const draftForLine = (state, getters) => (diffFileSha, line, side = null) => {
...@@ -75,10 +75,10 @@ export const draftForLine = (state, getters) => (diffFileSha, line, side = null) ...@@ -75,10 +75,10 @@ export const draftForLine = (state, getters) => (diffFileSha, line, side = null)
return {}; return {};
}; };
export const draftsForFile = state => diffFileSha => export const draftsForFile = (state) => (diffFileSha) =>
state.drafts.filter(draft => draft.file_hash === diffFileSha); state.drafts.filter((draft) => draft.file_hash === diffFileSha);
export const isPublishingDraft = state => draftId => export const isPublishingDraft = (state) => (draftId) =>
state.currentlyPublishingDrafts.indexOf(draftId) !== -1; state.currentlyPublishingDrafts.indexOf(draftId) !== -1;
export const sortedDrafts = state => [...state.drafts].sort((a, b) => a.id > b.id); export const sortedDrafts = (state) => [...state.drafts].sort((a, b) => a.id > b.id);
import * as types from './mutation_types'; import * as types from './mutation_types';
const processDraft = draft => ({ const processDraft = (draft) => ({
...draft, ...draft,
isDraft: true, isDraft: true,
}); });
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
}, },
[types.DELETE_DRAFT](state, draftId) { [types.DELETE_DRAFT](state, draftId) {
state.drafts = state.drafts.filter(draft => draft.id !== draftId); state.drafts = state.drafts.filter((draft) => draft.id !== draftId);
}, },
[types.SET_BATCH_COMMENTS_DRAFTS](state, drafts) { [types.SET_BATCH_COMMENTS_DRAFTS](state, drafts) {
...@@ -23,13 +23,13 @@ export default { ...@@ -23,13 +23,13 @@ export default {
}, },
[types.RECEIVE_PUBLISH_DRAFT_SUCCESS](state, draftId) { [types.RECEIVE_PUBLISH_DRAFT_SUCCESS](state, draftId) {
state.currentlyPublishingDrafts = state.currentlyPublishingDrafts.filter( state.currentlyPublishingDrafts = state.currentlyPublishingDrafts.filter(
publishingDraftId => publishingDraftId !== draftId, (publishingDraftId) => publishingDraftId !== draftId,
); );
state.drafts = state.drafts.filter(d => d.id !== draftId); state.drafts = state.drafts.filter((d) => d.id !== draftId);
}, },
[types.RECEIVE_PUBLISH_DRAFT_ERROR](state, draftId) { [types.RECEIVE_PUBLISH_DRAFT_ERROR](state, draftId) {
state.currentlyPublishingDrafts = state.currentlyPublishingDrafts.filter( state.currentlyPublishingDrafts = state.currentlyPublishingDrafts.filter(
publishingDraftId => publishingDraftId !== draftId, (publishingDraftId) => publishingDraftId !== draftId,
); );
}, },
...@@ -44,14 +44,14 @@ export default { ...@@ -44,14 +44,14 @@ export default {
state.isPublishing = false; state.isPublishing = false;
}, },
[types.RECEIVE_DRAFT_UPDATE_SUCCESS](state, data) { [types.RECEIVE_DRAFT_UPDATE_SUCCESS](state, data) {
const index = state.drafts.findIndex(draft => draft.id === data.id); const index = state.drafts.findIndex((draft) => draft.id === data.id);
if (index >= 0) { if (index >= 0) {
state.drafts.splice(index, 1, processDraft(data)); state.drafts.splice(index, 1, processDraft(data));
} }
}, },
[types.TOGGLE_RESOLVE_DISCUSSION](state, draftId) { [types.TOGGLE_RESOLVE_DISCUSSION](state, draftId) {
state.drafts = state.drafts.map(draft => { state.drafts = state.drafts.map((draft) => {
if (draft.id === draftId) { if (draft.id === draftId) {
return { return {
...draft, ...draft,
......
import { getFormData } from '~/diffs/store/utils'; import { getFormData } from '~/diffs/store/utils';
export const getDraftReplyFormData = data => ({ export const getDraftReplyFormData = (data) => ({
endpoint: data.notesData.draftsPath, endpoint: data.notesData.draftsPath,
data, data,
}); });
export const getDraftFormData = params => ({ export const getDraftFormData = (params) => ({
endpoint: params.notesData.draftsPath, endpoint: params.notesData.draftsPath,
data: getFormData(params), data: getFormData(params),
}); });
......
...@@ -8,6 +8,6 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -8,6 +8,6 @@ document.addEventListener('DOMContentLoaded', () => {
Autosize(autosizeEls); Autosize(autosizeEls);
Autosize.update(autosizeEls); Autosize.update(autosizeEls);
autosizeEls.forEach(el => el.classList.add('js-autosize-initialized')); autosizeEls.forEach((el) => el.classList.add('js-autosize-initialized'));
}); });
}); });
...@@ -30,7 +30,7 @@ class BindInOut { ...@@ -30,7 +30,7 @@ class BindInOut {
static initAll() { static initAll() {
const ins = document.querySelectorAll('*[data-bind-in]'); const ins = document.querySelectorAll('*[data-bind-in]');
return [].map.call(ins, anIn => BindInOut.init(anIn)); return [].map.call(ins, (anIn) => BindInOut.init(anIn));
} }
static init(anIn, anOut) { static init(anIn, anOut) {
......
...@@ -58,7 +58,7 @@ export default function initCopyToClipboard() { ...@@ -58,7 +58,7 @@ export default function initCopyToClipboard() {
* the last minute to deconstruct this JSON hash and set the `text/plain` and `text/x-gfm` copy * the last minute to deconstruct this JSON hash and set the `text/plain` and `text/x-gfm` copy
* data types to the intended values. * data types to the intended values.
*/ */
$(document).on('copy', 'body > textarea[readonly]', e => { $(document).on('copy', 'body > textarea[readonly]', (e) => {
const { clipboardData } = e.originalEvent; const { clipboardData } = e.originalEvent;
if (!clipboardData) return; if (!clipboardData) return;
......
...@@ -32,7 +32,7 @@ class GlEmoji extends HTMLElement { ...@@ -32,7 +32,7 @@ class GlEmoji extends HTMLElement {
const isEmojiUnicode = const isEmojiUnicode =
this.childNodes && this.childNodes &&
Array.prototype.every.call(this.childNodes, childNode => childNode.nodeType === 3); Array.prototype.every.call(this.childNodes, (childNode) => childNode.nodeType === 3);
if ( if (
emojiUnicode && emojiUnicode &&
......
...@@ -8,7 +8,7 @@ export const loadStartupCSS = () => { ...@@ -8,7 +8,7 @@ export const loadStartupCSS = () => {
() => { () => {
document document
.querySelectorAll('link[media=print]') .querySelectorAll('link[media=print]')
.forEach(x => x.dispatchEvent(new Event('load'))); .forEach((x) => x.dispatchEvent(new Event('load')));
}, },
{ once: true }, { once: true },
); );
......
...@@ -10,10 +10,10 @@ export class CopyAsGFM { ...@@ -10,10 +10,10 @@ export class CopyAsGFM {
const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
if (isIOS) return; if (isIOS) return;
$(document).on('copy', '.md', e => { $(document).on('copy', '.md', (e) => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection);
}); });
$(document).on('copy', 'pre.code.highlight, table.code td.line_content', e => { $(document).on('copy', 'pre.code.highlight, table.code td.line_content', (e) => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection); CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection);
}); });
$(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM); $(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM);
...@@ -42,7 +42,7 @@ export class CopyAsGFM { ...@@ -42,7 +42,7 @@ export class CopyAsGFM {
clipboardData.setData('text/x-gfm-html', html); clipboardData.setData('text/x-gfm-html', html);
CopyAsGFM.nodeToGFM(el) CopyAsGFM.nodeToGFM(el)
.then(res => { .then((res) => {
clipboardData.setData('text/x-gfm', res); clipboardData.setData('text/x-gfm', res);
}) })
.catch(() => { .catch(() => {
...@@ -71,7 +71,7 @@ export class CopyAsGFM { ...@@ -71,7 +71,7 @@ export class CopyAsGFM {
const div = document.createElement('div'); const div = document.createElement('div');
div.innerHTML = gfmHtml; div.innerHTML = gfmHtml;
CopyAsGFM.nodeToGFM(div) CopyAsGFM.nodeToGFM(div)
.then(transformedGfm => { .then((transformedGfm) => {
CopyAsGFM.insertPastedText(e.target, text, transformedGfm); CopyAsGFM.insertPastedText(e.target, text, transformedGfm);
}) })
.catch(() => {}); .catch(() => {});
...@@ -79,7 +79,7 @@ export class CopyAsGFM { ...@@ -79,7 +79,7 @@ export class CopyAsGFM {
} }
static insertPastedText(target, text, gfm) { static insertPastedText(target, text, gfm) {
insertText(target, textBefore => { insertText(target, (textBefore) => {
// If the text before the cursor contains an odd number of backticks, // If the text before the cursor contains an odd number of backticks,
// we are either inside an inline code span that starts with 1 backtick // we are either inside an inline code span that starts with 1 backtick
// or a code block that starts with 3 backticks. // or a code block that starts with 3 backticks.
...@@ -125,7 +125,7 @@ export class CopyAsGFM { ...@@ -125,7 +125,7 @@ export class CopyAsGFM {
let lineSelector = '.line'; let lineSelector = '.line';
if (target) { if (target) {
const lineClass = ['left-side', 'right-side'].filter(name => const lineClass = ['left-side', 'right-side'].filter((name) =>
target.classList.contains(name), target.classList.contains(name),
)[0]; )[0];
if (lineClass) { if (lineClass) {
......
...@@ -9,7 +9,7 @@ export default function highlightCurrentUser(elements) { ...@@ -9,7 +9,7 @@ export default function highlightCurrentUser(elements) {
return; return;
} }
elements.forEach(element => { elements.forEach((element) => {
if (parseInt(element.dataset.user, 10) === currentUserId) { if (parseInt(element.dataset.user, 10) === currentUserId) {
element.classList.add('current-user'); element.classList.add('current-user');
} }
......
...@@ -19,7 +19,7 @@ export default class InlineDiff extends Mark { ...@@ -19,7 +19,7 @@ export default class InlineDiff extends Mark {
{ tag: 'span.idiff.addition', attrs: { addition: true } }, { tag: 'span.idiff.addition', attrs: { addition: true } },
{ tag: 'span.idiff.deletion', attrs: { addition: false } }, { tag: 'span.idiff.deletion', attrs: { addition: false } },
], ],
toDOM: node => [ toDOM: (node) => [
'span', 'span',
{ class: `idiff left right ${node.attrs.addition ? 'addition' : 'deletion'}` }, { class: `idiff left right ${node.attrs.addition ? 'addition' : 'deletion'}` },
0, 0,
......
...@@ -19,14 +19,14 @@ export default class InlineHTML extends Mark { ...@@ -19,14 +19,14 @@ export default class InlineHTML extends Mark {
parseDOM: [ parseDOM: [
{ {
tag: 'sup, sub, kbd, q, samp, var', tag: 'sup, sub, kbd, q, samp, var',
getAttrs: el => ({ tag: el.nodeName.toLowerCase() }), getAttrs: (el) => ({ tag: el.nodeName.toLowerCase() }),
}, },
{ {
tag: 'abbr', tag: 'abbr',
getAttrs: el => ({ tag: 'abbr', title: el.getAttribute('title') }), getAttrs: (el) => ({ tag: 'abbr', title: el.getAttribute('title') }),
}, },
], ],
toDOM: node => [node.attrs.tag, { title: node.attrs.title }, 0], toDOM: (node) => [node.attrs.tag, { title: node.attrs.title }, 0],
}; };
} }
......
...@@ -25,7 +25,7 @@ export default class CodeBlock extends BaseCodeBlock { ...@@ -25,7 +25,7 @@ export default class CodeBlock extends BaseCodeBlock {
{ {
tag: 'pre.code.highlight', tag: 'pre.code.highlight',
preserveWhitespace: 'full', preserveWhitespace: 'full',
getAttrs: el => { getAttrs: (el) => {
const lang = el.getAttribute('lang'); const lang = el.getAttribute('lang');
if (!lang || lang === '') return {}; if (!lang || lang === '') return {};
...@@ -62,13 +62,13 @@ export default class CodeBlock extends BaseCodeBlock { ...@@ -62,13 +62,13 @@ export default class CodeBlock extends BaseCodeBlock {
tag: '.md-suggestion-diff', tag: '.md-suggestion-diff',
preserveWhitespace: 'full', preserveWhitespace: 'full',
getContent: (el, schema) => getContent: (el, schema) =>
[...el.querySelectorAll('.line_content.new span')].map(span => [...el.querySelectorAll('.line_content.new span')].map((span) =>
schema.text(span.innerText), schema.text(span.innerText),
), ),
attrs: { lang: 'suggestion' }, attrs: { lang: 'suggestion' },
}, },
], ],
toDOM: node => ['pre', { class: 'code highlight', lang: node.attrs.lang }, ['code', 0]], toDOM: (node) => ['pre', { class: 'code highlight', lang: node.attrs.lang }, ['code', 0]],
}; };
} }
......
...@@ -20,14 +20,14 @@ export default class Emoji extends Node { ...@@ -20,14 +20,14 @@ export default class Emoji extends Node {
parseDOM: [ parseDOM: [
{ {
tag: 'gl-emoji', tag: 'gl-emoji',
getAttrs: el => ({ getAttrs: (el) => ({
name: el.dataset.name, name: el.dataset.name,
title: el.getAttribute('title'), title: el.getAttribute('title'),
moji: el.textContent, moji: el.textContent,
}), }),
}, },
], ],
toDOM: node => [ toDOM: (node) => [
'gl-emoji', 'gl-emoji',
{ 'data-name': node.attrs.name, title: node.attrs.title }, { 'data-name': node.attrs.name, title: node.attrs.title },
node.attrs.moji, node.attrs.moji,
......
...@@ -30,7 +30,7 @@ export default class Image extends BaseImage { ...@@ -30,7 +30,7 @@ export default class Image extends BaseImage {
// Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter // Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter
{ {
tag: 'img[src]', tag: 'img[src]',
getAttrs: el => { getAttrs: (el) => {
const imageSrc = el.src; const imageSrc = el.src;
const imageUrl = const imageUrl =
imageSrc && imageSrc !== placeholderImage ? imageSrc : el.dataset.src || ''; imageSrc && imageSrc !== placeholderImage ? imageSrc : el.dataset.src || '';
...@@ -43,7 +43,7 @@ export default class Image extends BaseImage { ...@@ -43,7 +43,7 @@ export default class Image extends BaseImage {
}, },
}, },
], ],
toDOM: node => ['img', node.attrs], toDOM: (node) => ['img', node.attrs],
}; };
} }
......
...@@ -42,11 +42,11 @@ export default class Playable extends Node { ...@@ -42,11 +42,11 @@ export default class Playable extends Node {
}, },
{ {
tag: `${this.mediaType}[src]`, tag: `${this.mediaType}[src]`,
getAttrs: el => ({ src: el.src, alt: el.dataset.title }), getAttrs: (el) => ({ src: el.src, alt: el.dataset.title }),
}, },
]; ];
const toDOM = node => [ const toDOM = (node) => [
this.mediaType, this.mediaType,
{ {
src: node.attrs.src, src: node.attrs.src,
......
...@@ -25,7 +25,7 @@ export default class Reference extends Node { ...@@ -25,7 +25,7 @@ export default class Reference extends Node {
{ {
tag: 'a.gfm:not([data-link=true])', tag: 'a.gfm:not([data-link=true])',
priority: HIGHER_PARSE_RULE_PRIORITY, priority: HIGHER_PARSE_RULE_PRIORITY,
getAttrs: el => ({ getAttrs: (el) => ({
className: el.className, className: el.className,
referenceType: el.dataset.referenceType, referenceType: el.dataset.referenceType,
originalText: el.dataset.original, originalText: el.dataset.original,
...@@ -34,7 +34,7 @@ export default class Reference extends Node { ...@@ -34,7 +34,7 @@ export default class Reference extends Node {
}), }),
}, },
], ],
toDOM: node => [ toDOM: (node) => [
'a', 'a',
{ {
class: node.attrs.className, class: node.attrs.className,
......
...@@ -19,13 +19,13 @@ export default class TableCell extends Node { ...@@ -19,13 +19,13 @@ export default class TableCell extends Node {
parseDOM: [ parseDOM: [
{ {
tag: 'td, th', tag: 'td, th',
getAttrs: el => ({ getAttrs: (el) => ({
header: el.tagName === 'TH', header: el.tagName === 'TH',
align: el.getAttribute('align') || el.style.textAlign, align: el.getAttribute('align') || el.style.textAlign,
}), }),
}, },
], ],
toDOM: node => [node.attrs.header ? 'th' : 'td', { align: node.attrs.align }, 0], toDOM: (node) => [node.attrs.header ? 'th' : 'td', { align: node.attrs.align }, 0],
}; };
} }
......
...@@ -23,7 +23,7 @@ export default class TaskListItem extends Node { ...@@ -23,7 +23,7 @@ export default class TaskListItem extends Node {
{ {
priority: HIGHER_PARSE_RULE_PRIORITY, priority: HIGHER_PARSE_RULE_PRIORITY,
tag: 'li.task-list-item', tag: 'li.task-list-item',
getAttrs: el => { getAttrs: (el) => {
const checkbox = el.querySelector('input[type=checkbox].task-list-item-checkbox'); const checkbox = el.querySelector('input[type=checkbox].task-list-item-checkbox');
return { done: checkbox && checkbox.checked }; return { done: checkbox && checkbox.checked };
}, },
......
...@@ -35,7 +35,7 @@ const RENDER_FLASH_MSG = sprintf( ...@@ -35,7 +35,7 @@ const RENDER_FLASH_MSG = sprintf(
// Wait for the browser to reflow the layout. Reflowing SVG takes time. // Wait for the browser to reflow the layout. Reflowing SVG takes time.
// This has to wrap the inner function, otherwise IE/Edge throw "invalid calling object". // This has to wrap the inner function, otherwise IE/Edge throw "invalid calling object".
const waitForReflow = fn => { const waitForReflow = (fn) => {
window.requestAnimationFrame(fn); window.requestAnimationFrame(fn);
}; };
...@@ -122,7 +122,7 @@ class SafeMathRenderer { ...@@ -122,7 +122,7 @@ class SafeMathRenderer {
render() { render() {
// Replace math blocks with a placeholder so they aren't rendered twice // Replace math blocks with a placeholder so they aren't rendered twice
this.elements.forEach(el => { this.elements.forEach((el) => {
const placeholder = document.createElement('span'); const placeholder = document.createElement('span');
placeholder.style.display = 'none'; placeholder.style.display = 'none';
placeholder.setAttribute('data-math-style', el.getAttribute('data-math-style')); placeholder.setAttribute('data-math-style', el.getAttribute('data-math-style'));
......
...@@ -29,7 +29,7 @@ let mermaidModule = {}; ...@@ -29,7 +29,7 @@ let mermaidModule = {};
function importMermaidModule() { function importMermaidModule() {
return import(/* webpackChunkName: 'mermaid' */ 'mermaid') return import(/* webpackChunkName: 'mermaid' */ 'mermaid')
.then(mermaid => { .then((mermaid) => {
let theme = 'neutral'; let theme = 'neutral';
const ideDarkThemes = ['dark', 'solarized-dark', 'monokai']; const ideDarkThemes = ['dark', 'solarized-dark', 'monokai'];
...@@ -59,7 +59,7 @@ function importMermaidModule() { ...@@ -59,7 +59,7 @@ function importMermaidModule() {
return mermaid; return mermaid;
}) })
.catch(err => { .catch((err) => {
flash(sprintf(__("Can't load mermaid module: %{err}"), { err })); flash(sprintf(__("Can't load mermaid module: %{err}"), { err }));
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(err);
...@@ -77,7 +77,7 @@ function fixElementSource(el) { ...@@ -77,7 +77,7 @@ function fixElementSource(el) {
} }
function renderMermaidEl(el) { function renderMermaidEl(el) {
mermaidModule.init(undefined, el, id => { mermaidModule.init(undefined, el, (id) => {
const source = el.textContent; const source = el.textContent;
const svg = document.getElementById(id); const svg = document.getElementById(id);
...@@ -170,7 +170,7 @@ function renderMermaids($els) { ...@@ -170,7 +170,7 @@ function renderMermaids($els) {
elsProcessingMap.set(el, requestId); elsProcessingMap.set(el, requestId);
}); });
}) })
.catch(err => { .catch((err) => {
flash(sprintf(__('Encountered an error while rendering: %{err}'), { err })); flash(sprintf(__('Encountered an error while rendering: %{err}'), { err }));
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(err);
......
...@@ -9,7 +9,7 @@ export default function renderMetrics(elements) { ...@@ -9,7 +9,7 @@ export default function renderMetrics(elements) {
const wrapperList = []; const wrapperList = [];
elements.forEach(element => { elements.forEach((element) => {
let wrapper; let wrapper;
const { previousElementSibling } = element; const { previousElementSibling } = element;
const isFirstElementInGroup = !previousElementSibling?.urls; const isFirstElementInGroup = !previousElementSibling?.urls;
...@@ -33,7 +33,7 @@ export default function renderMetrics(elements) { ...@@ -33,7 +33,7 @@ export default function renderMetrics(elements) {
).then(({ default: EmbedGroup }) => { ).then(({ default: EmbedGroup }) => {
const EmbedGroupComponent = Vue.extend(EmbedGroup); const EmbedGroupComponent = Vue.extend(EmbedGroup);
wrapperList.forEach(wrapper => { wrapperList.forEach((wrapper) => {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new EmbedGroupComponent({ new EmbedGroupComponent({
el: wrapper, el: wrapper,
......
...@@ -2,7 +2,7 @@ import { Schema } from 'prosemirror-model'; ...@@ -2,7 +2,7 @@ import { Schema } from 'prosemirror-model';
import editorExtensions from './editor_extensions'; import editorExtensions from './editor_extensions';
const nodes = editorExtensions const nodes = editorExtensions
.filter(extension => extension.type === 'node') .filter((extension) => extension.type === 'node')
.reduce( .reduce(
(ns, { name, schema }) => ({ (ns, { name, schema }) => ({
...ns, ...ns,
...@@ -12,7 +12,7 @@ const nodes = editorExtensions ...@@ -12,7 +12,7 @@ const nodes = editorExtensions
); );
const marks = editorExtensions const marks = editorExtensions
.filter(extension => extension.type === 'mark') .filter((extension) => extension.type === 'mark')
.reduce( .reduce(
(ms, { name, schema }) => ({ (ms, { name, schema }) => ({
...ms, ...ms,
......
...@@ -2,7 +2,7 @@ import { MarkdownSerializer } from 'prosemirror-markdown'; ...@@ -2,7 +2,7 @@ import { MarkdownSerializer } from 'prosemirror-markdown';
import editorExtensions from './editor_extensions'; import editorExtensions from './editor_extensions';
const nodes = editorExtensions const nodes = editorExtensions
.filter(extension => extension.type === 'node') .filter((extension) => extension.type === 'node')
.reduce( .reduce(
(ns, { name, toMarkdown }) => ({ (ns, { name, toMarkdown }) => ({
...ns, ...ns,
...@@ -12,7 +12,7 @@ const nodes = editorExtensions ...@@ -12,7 +12,7 @@ const nodes = editorExtensions
); );
const marks = editorExtensions const marks = editorExtensions
.filter(extension => extension.type === 'mark') .filter((extension) => extension.type === 'mark')
.reduce( .reduce(
(ms, { name, toMarkdown }) => ({ (ms, { name, toMarkdown }) => ({
...ms, ...ms,
......
...@@ -41,7 +41,7 @@ MarkdownPreview.prototype.showPreview = function ($form) { ...@@ -41,7 +41,7 @@ MarkdownPreview.prototype.showPreview = function ($form) {
this.hideReferencedUsers($form); this.hideReferencedUsers($form);
} else { } else {
preview.addClass('md-preview-loading').text(__('Loading...')); preview.addClass('md-preview-loading').text(__('Loading...'));
this.fetchMarkdownPreview(mdText, url, response => { this.fetchMarkdownPreview(mdText, url, (response) => {
let body; let body;
if (response.body.length > 0) { if (response.body.length > 0) {
({ body } = response); ({ body } = response);
......
...@@ -30,7 +30,7 @@ function keyCodeIs(e, keyCode) { ...@@ -30,7 +30,7 @@ function keyCodeIs(e, keyCode) {
return e.keyCode === keyCode; return e.keyCode === keyCode;
} }
$(document).on('keydown.quick_submit', '.js-quick-submit', e => { $(document).on('keydown.quick_submit', '.js-quick-submit', (e) => {
// Enter // Enter
if (!keyCodeIs(e, 13)) { if (!keyCodeIs(e, 13)) {
return; return;
......
...@@ -23,7 +23,7 @@ $.fn.requiresInput = function requiresInput() { ...@@ -23,7 +23,7 @@ $.fn.requiresInput = function requiresInput() {
function requireInput() { function requireInput() {
// Collect the input values of *all* required fields // Collect the input values of *all* required fields
const values = Array.from($(fieldSelector, $form)).map(field => field.value); const values = Array.from($(fieldSelector, $form)).map((field) => field.value);
// Disable the button if any required fields are empty // Disable the button if any required fields are empty
if (values.length && values.some(isEmpty)) { if (values.length && values.some(isEmpty)) {
......
...@@ -30,12 +30,12 @@ export default class SecretValues { ...@@ -30,12 +30,12 @@ export default class SecretValues {
updateDom(isRevealed) { updateDom(isRevealed) {
const values = this.container.querySelectorAll(this.valueSelector); const values = this.container.querySelectorAll(this.valueSelector);
values.forEach(value => { values.forEach((value) => {
value.classList.toggle('hide', !isRevealed); value.classList.toggle('hide', !isRevealed);
}); });
const placeholders = this.container.querySelectorAll(this.placeholderSelector); const placeholders = this.container.querySelectorAll(this.placeholderSelector);
placeholders.forEach(placeholder => { placeholders.forEach((placeholder) => {
placeholder.classList.toggle('hide', isRevealed); placeholder.classList.toggle('hide', isRevealed);
}); });
......
...@@ -49,10 +49,10 @@ export const keybindingGroups = [ ...@@ -49,10 +49,10 @@ export const keybindingGroups = [
// For each keybinding object, add a `customKeys` property populated with the // For each keybinding object, add a `customKeys` property populated with the
// user's custom keybindings (if the command has been customized). // user's custom keybindings (if the command has been customized).
// `customKeys` will be `undefined` if the command hasn't been customized. // `customKeys` will be `undefined` if the command hasn't been customized.
.map(group => { .map((group) => {
return { return {
...group, ...group,
keybindings: group.keybindings.map(binding => ({ keybindings: group.keybindings.map((binding) => ({
...binding, ...binding,
customKeys: customizations[binding.command], customKeys: customizations[binding.command],
})), })),
...@@ -66,7 +66,7 @@ export const keybindingGroups = [ ...@@ -66,7 +66,7 @@ export const keybindingGroups = [
* @example * @example
* { "globalShortcuts.togglePerformanceBar": ["p e r f"] } * { "globalShortcuts.togglePerformanceBar": ["p e r f"] }
*/ */
const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)).reduce( const commandToKeys = flatten(keybindingGroups.map((group) => group.keybindings)).reduce(
(acc, binding) => { (acc, binding) => {
acc[binding.command] = binding.customKeys || binding.defaultKeys; acc[binding.command] = binding.customKeys || binding.defaultKeys;
return acc; return acc;
...@@ -87,7 +87,7 @@ const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)). ...@@ -87,7 +87,7 @@ const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)).
* *
* Mousetrap.bind(keysFor(TOGGLE_PERFORMANCE_BAR), handler); * Mousetrap.bind(keysFor(TOGGLE_PERFORMANCE_BAR), handler);
*/ */
export const keysFor = command => { export const keysFor = (command) => {
if (shouldDisableShortcuts()) { if (shouldDisableShortcuts()) {
return []; return [];
} }
......
...@@ -197,7 +197,7 @@ export default class Shortcuts { ...@@ -197,7 +197,7 @@ export default class Shortcuts {
$textarea.data(LOCAL_MOUSETRAP_DATA_KEY, localMousetrap); $textarea.data(LOCAL_MOUSETRAP_DATA_KEY, localMousetrap);
toolbarBtnToShortcutsMap.forEach((keyboardShortcuts, $toolbarBtn) => { toolbarBtnToShortcutsMap.forEach((keyboardShortcuts, $toolbarBtn) => {
localMousetrap.bind(keyboardShortcuts, e => { localMousetrap.bind(keyboardShortcuts, (e) => {
e.preventDefault(); e.preventDefault();
handler($toolbarBtn); handler($toolbarBtn);
...@@ -231,7 +231,7 @@ export default class Shortcuts { ...@@ -231,7 +231,7 @@ export default class Shortcuts {
const localMousetrap = $textarea.data(LOCAL_MOUSETRAP_DATA_KEY); const localMousetrap = $textarea.data(LOCAL_MOUSETRAP_DATA_KEY);
if (localMousetrap) { if (localMousetrap) {
getToolbarBtnToShortcutsMap($textarea).forEach(keyboardShortcuts => { getToolbarBtnToShortcutsMap($textarea).forEach((keyboardShortcuts) => {
localMousetrap.unbind(keyboardShortcuts); localMousetrap.unbind(keyboardShortcuts);
}); });
} }
......
...@@ -53,7 +53,7 @@ export default class ShortcutsBlob extends Shortcuts { ...@@ -53,7 +53,7 @@ export default class ShortcutsBlob extends Shortcuts {
shortcircuitPermalinkButton() { shortcircuitPermalinkButton() {
const button = this.options.fileBlobPermalinkUrlElement; const button = this.options.fileBlobPermalinkUrlElement;
const handleButton = e => { const handleButton = (e) => {
if (!eventHasModifierKeys(e)) { if (!eventHasModifierKeys(e)) {
e.preventDefault(); e.preventDefault();
this.moveToFilePermalink(); this.moveToFilePermalink();
......
...@@ -39,7 +39,7 @@ export default class ShortcutsIssuable extends Shortcuts { ...@@ -39,7 +39,7 @@ export default class ShortcutsIssuable extends Shortcuts {
// ... Or come from a message // ... Or come from a message
if (!foundMessage) { if (!foundMessage) {
if (documentFragment.originalNodes) { if (documentFragment.originalNodes) {
documentFragment.originalNodes.forEach(e => { documentFragment.originalNodes.forEach((e) => {
let node = e; let node = e;
do { do {
// Text nodes don't define the `matches` method // Text nodes don't define the `matches` method
...@@ -62,7 +62,7 @@ export default class ShortcutsIssuable extends Shortcuts { ...@@ -62,7 +62,7 @@ export default class ShortcutsIssuable extends Shortcuts {
const blockquoteEl = document.createElement('blockquote'); const blockquoteEl = document.createElement('blockquote');
blockquoteEl.appendChild(el); blockquoteEl.appendChild(el);
CopyAsGFM.nodeToGFM(blockquoteEl) CopyAsGFM.nodeToGFM(blockquoteEl)
.then(text => { .then((text) => {
if (text.trim() === '') { if (text.trim() === '') {
return false; return false;
} }
......
...@@ -68,7 +68,7 @@ export default class Renderer { ...@@ -68,7 +68,7 @@ export default class Renderer {
} }
loadFile() { loadFile() {
this.loader.load(this.container.dataset.endpoint, geo => { this.loader.load(this.container.dataset.endpoint, (geo) => {
const obj = new MeshObject(geo); const obj = new MeshObject(geo);
this.objects.push(obj); this.objects.push(obj);
...@@ -99,7 +99,7 @@ export default class Renderer { ...@@ -99,7 +99,7 @@ export default class Renderer {
} }
changeObjectMaterials(type) { changeObjectMaterials(type) {
this.objects.forEach(obj => { this.objects.forEach((obj) => {
obj.changeMaterial(type); obj.changeMaterial(type);
}); });
} }
......
...@@ -28,7 +28,7 @@ class BalsamiqViewer { ...@@ -28,7 +28,7 @@ class BalsamiqViewer {
.then(({ data }) => { .then(({ data }) => {
this.renderFile(data); this.renderFile(data);
}) })
.catch(e => { .catch((e) => {
throw new Error(e); throw new Error(e);
}); });
} }
...@@ -39,7 +39,7 @@ class BalsamiqViewer { ...@@ -39,7 +39,7 @@ class BalsamiqViewer {
this.initDatabase(fileBuffer); this.initDatabase(fileBuffer);
const previews = this.getPreviews(); const previews = this.getPreviews();
previews.forEach(preview => { previews.forEach((preview) => {
const renderedPreview = this.renderPreview(preview); const renderedPreview = this.renderPreview(preview);
container.appendChild(renderedPreview); container.appendChild(renderedPreview);
......
...@@ -80,7 +80,7 @@ export default class BlobFileDropzone { ...@@ -80,7 +80,7 @@ export default class BlobFileDropzone {
}, },
}); });
submitButton.on('click', e => { submitButton.on('click', (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (dropzone[0].dropzone.getQueuedFiles().length === 0) { if (dropzone[0].dropzone.getQueuedFiles().length === 0) {
......
...@@ -2,12 +2,12 @@ import { getLocationHash } from '../lib/utils/url_utility'; ...@@ -2,12 +2,12 @@ import { getLocationHash } from '../lib/utils/url_utility';
const lineNumberRe = /^L[0-9]+/; const lineNumberRe = /^L[0-9]+/;
const updateLineNumbersOnBlobPermalinks = linksToUpdate => { const updateLineNumbersOnBlobPermalinks = (linksToUpdate) => {
const hash = getLocationHash(); const hash = getLocationHash();
if (hash && lineNumberRe.test(hash)) { if (hash && lineNumberRe.test(hash)) {
const hashUrlString = `#${hash}`; const hashUrlString = `#${hash}`;
[].concat(Array.prototype.slice.call(linksToUpdate)).forEach(permalinkButton => { [].concat(Array.prototype.slice.call(linksToUpdate)).forEach((permalinkButton) => {
const baseHref = const baseHref =
permalinkButton.getAttribute('data-original-href') || permalinkButton.getAttribute('data-original-href') ||
(() => { (() => {
...@@ -28,7 +28,7 @@ function BlobLinePermalinkUpdater(blobContentHolder, lineNumberSelector, element ...@@ -28,7 +28,7 @@ function BlobLinePermalinkUpdater(blobContentHolder, lineNumberSelector, element
}, 0); }, 0);
}; };
blobContentHolder.addEventListener('click', e => { blobContentHolder.addEventListener('click', (e) => {
if (e.target.matches(lineNumberSelector)) { if (e.target.matches(lineNumberSelector)) {
updateBlameAndBlobPermalinkCb(); updateBlameAndBlobPermalinkCb();
} }
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
}, },
renderErrorReason() { renderErrorReason() {
const defaultReasonPath = Object.keys(BLOB_RENDER_ERRORS.REASONS).find( const defaultReasonPath = Object.keys(BLOB_RENDER_ERRORS.REASONS).find(
reason => BLOB_RENDER_ERRORS.REASONS[reason].id === this.viewerError, (reason) => BLOB_RENDER_ERRORS.REASONS[reason].id === this.viewerError,
); );
const defaultReason = BLOB_RENDER_ERRORS.REASONS[defaultReasonPath].text; const defaultReason = BLOB_RENDER_ERRORS.REASONS[defaultReasonPath].text;
return this.notStoredExternally return this.notStoredExternally
......
...@@ -38,14 +38,14 @@ export default class FileTemplateMediator { ...@@ -38,14 +38,14 @@ export default class FileTemplateMediator {
MetricsDashboardSelector, MetricsDashboardSelector,
DockerfileSelector, DockerfileSelector,
LicenseSelector, LicenseSelector,
].map(TemplateSelectorClass => new TemplateSelectorClass({ mediator: this })); ].map((TemplateSelectorClass) => new TemplateSelectorClass({ mediator: this }));
} }
initTemplateTypeSelector() { initTemplateTypeSelector() {
this.typeSelector = new FileTemplateTypeSelector({ this.typeSelector = new FileTemplateTypeSelector({
mediator: this, mediator: this,
dropdownData: this.templateSelectors dropdownData: this.templateSelectors
.map(templateSelector => { .map((templateSelector) => {
const cfg = templateSelector.config; const cfg = templateSelector.config;
return { return {
...@@ -55,7 +55,7 @@ export default class FileTemplateMediator { ...@@ -55,7 +55,7 @@ export default class FileTemplateMediator {
}; };
}) })
.reduce( .reduce(
(acc, current) => (acc.find(item => item.id === current.id) ? acc : [...acc, current]), (acc, current) => (acc.find((item) => item.id === current.id) ? acc : [...acc, current]),
[], [],
), ),
}); });
...@@ -99,7 +99,7 @@ export default class FileTemplateMediator { ...@@ -99,7 +99,7 @@ export default class FileTemplateMediator {
} }
listenForPreviewMode() { listenForPreviewMode() {
this.$navLinks.on('click', 'a', e => { this.$navLinks.on('click', 'a', (e) => {
const urlPieces = e.target.href.split('#'); const urlPieces = e.target.href.split('#');
const hash = urlPieces[1]; const hash = urlPieces[1];
if (hash === 'preview') { if (hash === 'preview') {
...@@ -115,7 +115,7 @@ export default class FileTemplateMediator { ...@@ -115,7 +115,7 @@ export default class FileTemplateMediator {
e.preventDefault(); e.preventDefault();
} }
this.templateSelectors.forEach(selector => { this.templateSelectors.forEach((selector) => {
if (selector.config.key === item.key) { if (selector.config.key === item.key) {
selector.show(); selector.show();
} else { } else {
...@@ -138,7 +138,7 @@ export default class FileTemplateMediator { ...@@ -138,7 +138,7 @@ export default class FileTemplateMediator {
selector.renderLoading(); selector.renderLoading();
this.fetchFileTemplate(selector.config.type, query, data) this.fetchFileTemplate(selector.config.type, query, data)
.then(file => { .then((file) => {
this.setEditorContent(file); this.setEditorContent(file);
this.setFilename(name); this.setFilename(name);
selector.renderLoaded(); selector.renderLoaded();
...@@ -157,12 +157,12 @@ export default class FileTemplateMediator { ...@@ -157,12 +157,12 @@ export default class FileTemplateMediator {
initPopover(suggestCommitChanges); initPopover(suggestCommitChanges);
} }
}) })
.catch(err => new Flash(`An error occurred while fetching the template: ${err}`)); .catch((err) => new Flash(`An error occurred while fetching the template: ${err}`));
} }
displayMatchedTemplateSelector() { displayMatchedTemplateSelector() {
const currentInput = this.getFilename(); const currentInput = this.getFilename();
this.templateSelectors.forEach(selector => { this.templateSelectors.forEach((selector) => {
const match = selector.config.pattern.test(currentInput); const match = selector.config.pattern.test(currentInput);
if (match) { if (match) {
...@@ -174,8 +174,8 @@ export default class FileTemplateMediator { ...@@ -174,8 +174,8 @@ export default class FileTemplateMediator {
} }
fetchFileTemplate(type, query, data = {}) { fetchFileTemplate(type, query, data = {}) {
return new Promise(resolve => { return new Promise((resolve) => {
const resolveFile = file => resolve(file); const resolveFile = (file) => resolve(file);
Api.projectTemplate(this.projectId, type, query, data, resolveFile); Api.projectTemplate(this.projectId, type, query, data, resolveFile);
}); });
...@@ -194,7 +194,7 @@ export default class FileTemplateMediator { ...@@ -194,7 +194,7 @@ export default class FileTemplateMediator {
} }
findTemplateSelectorByKey(key) { findTemplateSelectorByKey(key) {
return this.templateSelectors.find(selector => selector.config.key === key); return this.templateSelectors.find((selector) => selector.config.key === key);
} }
hideTemplateSelectorMenu() { hideTemplateSelectorMenu() {
...@@ -250,6 +250,6 @@ export default class FileTemplateMediator { ...@@ -250,6 +250,6 @@ export default class FileTemplateMediator {
} }
getSelected() { getSelected() {
return this.templateSelectors.find(selector => selector.selected); return this.templateSelectors.find((selector) => selector.selected);
} }
} }
...@@ -45,12 +45,12 @@ export default { ...@@ -45,12 +45,12 @@ export default {
loadFile() { loadFile() {
axios axios
.get(this.endpoint) .get(this.endpoint)
.then(res => res.data) .then((res) => res.data)
.then(data => { .then((data) => {
this.json = data; this.json = data;
this.loading = false; this.loading = false;
}) })
.catch(e => { .catch((e) => {
if (e.status !== 200) { if (e.status !== 200) {
this.loadError = true; this.loadError = true;
} }
......
...@@ -12,7 +12,7 @@ export default () => { ...@@ -12,7 +12,7 @@ export default () => {
dom_id: '#js-openapi-viewer', dom_id: '#js-openapi-viewer',
}); });
}) })
.catch(error => { .catch((error) => {
flash(__('Something went wrong while initializing the OpenAPI viewer')); flash(__('Something went wrong while initializing the OpenAPI viewer'));
throw error; throw error;
}); });
......
...@@ -12,9 +12,9 @@ export default class SketchLoader { ...@@ -12,9 +12,9 @@ export default class SketchLoader {
load() { load() {
return this.getZipFile() return this.getZipFile()
.then(data => JSZip.loadAsync(data)) .then((data) => JSZip.loadAsync(data))
.then(asyncResult => asyncResult.files['previews/preview.png'].async('uint8array')) .then((asyncResult) => asyncResult.files['previews/preview.png'].async('uint8array'))
.then(content => { .then((content) => {
const url = window.URL || window.webkitURL; const url = window.URL || window.webkitURL;
const blob = new Blob([new Uint8Array(content)], { const blob = new Blob([new Uint8Array(content)], {
type: 'image/png', type: 'image/png',
......
...@@ -3,8 +3,8 @@ import Renderer from './3d_viewer'; ...@@ -3,8 +3,8 @@ import Renderer from './3d_viewer';
export default () => { export default () => {
const viewer = new Renderer(document.getElementById('js-stl-viewer')); const viewer = new Renderer(document.getElementById('js-stl-viewer'));
[].slice.call(document.querySelectorAll('.js-material-changer')).forEach(el => { [].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => {
el.addEventListener('click', e => { el.addEventListener('click', (e) => {
const { target } = e; const { target } = e;
e.preventDefault(); e.preventDefault();
......
import Vue from 'vue'; import Vue from 'vue';
import Popover from './components/popover.vue'; import Popover from './components/popover.vue';
export default el => export default (el) =>
new Vue({ new Vue({
el, el,
render(createElement) { render(createElement) {
......
...@@ -26,12 +26,12 @@ export default class TemplateSelector { ...@@ -26,12 +26,12 @@ export default class TemplateSelector {
data, data,
filterable: true, filterable: true,
selectable: true, selectable: true,
toggleLabel: item => item.name, toggleLabel: (item) => item.name,
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => this.onDropdownClicked(options), clicked: (options) => this.onDropdownClicked(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
...@@ -46,7 +46,7 @@ export default class TemplateSelector { ...@@ -46,7 +46,7 @@ export default class TemplateSelector {
} }
listenForFilenameInput() { listenForFilenameInput() {
return this.$filenameInput.on('keyup blur', e => this.renderMatchedDropdown(e)); return this.$filenameInput.on('keyup blur', (e) => this.renderMatchedDropdown(e));
} }
renderMatchedDropdown() { renderMatchedDropdown() {
......
...@@ -22,8 +22,8 @@ export default class BlobCiSyntaxYamlSelector extends FileTemplateSelector { ...@@ -22,8 +22,8 @@ export default class BlobCiSyntaxYamlSelector extends FileTemplateSelector {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => this.reportSelectionName(options), clicked: (options) => this.reportSelectionName(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -23,8 +23,8 @@ export default class BlobCiYamlSelector extends FileTemplateSelector { ...@@ -23,8 +23,8 @@ export default class BlobCiYamlSelector extends FileTemplateSelector {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => this.reportSelectionName(options), clicked: (options) => this.reportSelectionName(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -24,8 +24,8 @@ export default class DockerfileSelector extends FileTemplateSelector { ...@@ -24,8 +24,8 @@ export default class DockerfileSelector extends FileTemplateSelector {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => this.reportSelectionName(options), clicked: (options) => this.reportSelectionName(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -22,8 +22,8 @@ export default class BlobGitignoreSelector extends FileTemplateSelector { ...@@ -22,8 +22,8 @@ export default class BlobGitignoreSelector extends FileTemplateSelector {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => this.reportSelectionName(options), clicked: (options) => this.reportSelectionName(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -22,7 +22,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector { ...@@ -22,7 +22,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => { clicked: (options) => {
const { e } = options; const { e } = options;
const el = options.$el; const el = options.$el;
const query = options.selectedObj; const query = options.selectedObj;
...@@ -39,7 +39,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector { ...@@ -39,7 +39,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector {
data, data,
}); });
}, },
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -22,8 +22,8 @@ export default class MetricsDashboardSelector extends FileTemplateSelector { ...@@ -22,8 +22,8 @@ export default class MetricsDashboardSelector extends FileTemplateSelector {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
clicked: options => this.reportSelectionName(options), clicked: (options) => this.reportSelectionName(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -17,8 +17,8 @@ export default class FileTemplateTypeSelector extends FileTemplateSelector { ...@@ -17,8 +17,8 @@ export default class FileTemplateTypeSelector extends FileTemplateSelector {
data: this.config.dropdownData, data: this.config.dropdownData,
filterable: false, filterable: false,
selectable: true, selectable: true,
clicked: options => this.mediator.selectTemplateTypeOptions(options), clicked: (options) => this.mediator.selectTemplateTypeOptions(options),
text: item => item.name, text: (item) => item.name,
}); });
} }
} }
...@@ -7,7 +7,7 @@ import eventHub from '../../notes/event_hub'; ...@@ -7,7 +7,7 @@ import eventHub from '../../notes/event_hub';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { fixTitle } from '~/tooltips'; import { fixTitle } from '~/tooltips';
const loadRichBlobViewer = type => { const loadRichBlobViewer = (type) => {
switch (type) { switch (type) {
case 'balsamiq': case 'balsamiq':
return import(/* webpackChunkName: 'balsamiq_viewer' */ '../balsamiq_viewer'); return import(/* webpackChunkName: 'balsamiq_viewer' */ '../balsamiq_viewer');
...@@ -30,8 +30,8 @@ export const handleBlobRichViewer = (viewer, type) => { ...@@ -30,8 +30,8 @@ export const handleBlobRichViewer = (viewer, type) => {
if (!viewer || !type) return; if (!viewer || !type) return;
loadRichBlobViewer(type) loadRichBlobViewer(type)
.then(module => module?.default(viewer)) .then((module) => module?.default(viewer))
.catch(error => { .catch((error) => {
Flash(__('Error loading file viewer.')); Flash(__('Error loading file viewer.'));
throw error; throw error;
}); });
...@@ -84,7 +84,7 @@ export default class BlobViewer { ...@@ -84,7 +84,7 @@ export default class BlobViewer {
initBindings() { initBindings() {
if (this.switcherBtns.length) { if (this.switcherBtns.length) {
Array.from(this.switcherBtns).forEach(el => { Array.from(this.switcherBtns).forEach((el) => {
el.addEventListener('click', this.switchViewHandler.bind(this)); el.addEventListener('click', this.switchViewHandler.bind(this));
}); });
} }
...@@ -155,7 +155,7 @@ export default class BlobViewer { ...@@ -155,7 +155,7 @@ export default class BlobViewer {
this.toggleCopyButtonState(); this.toggleCopyButtonState();
BlobViewer.loadViewer(newViewer) BlobViewer.loadViewer(newViewer)
.then(viewer => { .then((viewer) => {
$(viewer).renderGFM(); $(viewer).renderGFM();
this.$fileHolder.trigger('highlight:line'); this.$fileHolder.trigger('highlight:line');
......
...@@ -75,7 +75,7 @@ export default () => { ...@@ -75,7 +75,7 @@ export default () => {
}); });
initPopovers(); initPopovers();
}) })
.catch(e => createFlash(e)); .catch((e) => createFlash(e));
cancelLink.on('click', () => { cancelLink.on('click', () => {
window.onbeforeunload = null; window.onbeforeunload = null;
......
...@@ -21,7 +21,7 @@ export default class EditBlob { ...@@ -21,7 +21,7 @@ export default class EditBlob {
this.editor.use(new MarkdownExtension()); this.editor.use(new MarkdownExtension());
addEditorMarkdownListeners(this.editor); addEditorMarkdownListeners(this.editor);
}) })
.catch(e => createFlash(`${BLOB_EDITOR_ERROR}: ${e}`)); .catch((e) => createFlash(`${BLOB_EDITOR_ERROR}: ${e}`));
} }
this.initModePanesAndLinks(); this.initModePanesAndLinks();
...@@ -66,7 +66,7 @@ export default class EditBlob { ...@@ -66,7 +66,7 @@ export default class EditBlob {
initModePanesAndLinks() { initModePanesAndLinks() {
this.$editModePanes = $('.js-edit-mode-pane'); this.$editModePanes = $('.js-edit-mode-pane');
this.$editModeLinks = $('.js-edit-mode a'); this.$editModeLinks = $('.js-edit-mode a');
this.$editModeLinks.on('click', e => this.editModeLinkClickHandler(e)); this.$editModeLinks.on('click', (e) => this.editModeLinkClickHandler(e));
} }
editModeLinkClickHandler(e) { editModeLinkClickHandler(e) {
......
...@@ -41,14 +41,14 @@ export function formatListIssues(listIssues) { ...@@ -41,14 +41,14 @@ export function formatListIssues(listIssues) {
const listData = listIssues.nodes.reduce((map, list) => { const listData = listIssues.nodes.reduce((map, list) => {
listIssuesCount = list.issues.count; listIssuesCount = list.issues.count;
let sortedIssues = list.issues.edges.map(issueNode => ({ let sortedIssues = list.issues.edges.map((issueNode) => ({
...issueNode.node, ...issueNode.node,
})); }));
sortedIssues = sortBy(sortedIssues, 'relativePosition'); sortedIssues = sortBy(sortedIssues, 'relativePosition');
return { return {
...map, ...map,
[list.id]: sortedIssues.map(i => { [list.id]: sortedIssues.map((i) => {
const id = getIdFromGraphQLId(i.id); const id = getIdFromGraphQLId(i.id);
const listIssue = { const listIssue = {
...@@ -97,23 +97,23 @@ export function moveIssueListHelper(issue, fromList, toList) { ...@@ -97,23 +97,23 @@ export function moveIssueListHelper(issue, fromList, toList) {
const updatedIssue = issue; const updatedIssue = issue;
if ( if (
toList.listType === ListType.label && toList.listType === ListType.label &&
!updatedIssue.labels.find(label => label.id === toList.label.id) !updatedIssue.labels.find((label) => label.id === toList.label.id)
) { ) {
updatedIssue.labels.push(toList.label); updatedIssue.labels.push(toList.label);
} }
if (fromList?.label && fromList.listType === ListType.label) { if (fromList?.label && fromList.listType === ListType.label) {
updatedIssue.labels = updatedIssue.labels.filter(label => fromList.label.id !== label.id); updatedIssue.labels = updatedIssue.labels.filter((label) => fromList.label.id !== label.id);
} }
if ( if (
toList.listType === ListType.assignee && toList.listType === ListType.assignee &&
!updatedIssue.assignees.find(assignee => assignee.id === toList.assignee.id) !updatedIssue.assignees.find((assignee) => assignee.id === toList.assignee.id)
) { ) {
updatedIssue.assignees.push(toList.assignee); updatedIssue.assignees.push(toList.assignee);
} }
if (fromList?.assignee && fromList.listType === ListType.assignee) { if (fromList?.assignee && fromList.listType === ListType.assignee) {
updatedIssue.assignees = updatedIssue.assignees.filter( updatedIssue.assignees = updatedIssue.assignees.filter(
assignee => assignee.id !== fromList.assignee.id, (assignee) => assignee.id !== fromList.assignee.id,
); );
} }
......
...@@ -119,7 +119,7 @@ export default { ...@@ -119,7 +119,7 @@ export default {
this.selected = this.selected.concat(name); this.selected = this.selected.concat(name);
}, },
unselect(name) { unselect(name) {
this.selected = this.selected.filter(user => user.username !== name); this.selected = this.selected.filter((user) => user.username !== name);
}, },
saveAssignees() { saveAssignees() {
this.setAssignees(this.selectedUserNames); this.setAssignees(this.selectedUserNames);
......
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
}, },
computed: { computed: {
multiSelectVisible() { multiSelectVisible() {
return this.multiSelect.list.findIndex(issue => issue.id === this.issue.id) > -1; return this.multiSelect.list.findIndex((issue) => issue.id === this.issue.id) > -1;
}, },
}, },
methods: { methods: {
......
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
// For each list we check if the destination list is // For each list we check if the destination list is
// a the list were we should clone the issue // a the list were we should clone the issue
const shouldClone = Object.entries(cloneActions).some( const shouldClone = Object.entries(cloneActions).some(
entry => fromBoardType === entry[0] && entry[1].includes(toBoardType), (entry) => fromBoardType === entry[0] && entry[1].includes(toBoardType),
); );
if (shouldClone) { if (shouldClone) {
...@@ -156,7 +156,7 @@ export default { ...@@ -156,7 +156,7 @@ export default {
}, },
revertClone: true, revertClone: true,
}, },
onStart: e => { onStart: (e) => {
const card = this.$refs.issue[e.oldIndex]; const card = this.$refs.issue[e.oldIndex];
card.showDetail = false; card.showDetail = false;
...@@ -171,15 +171,15 @@ export default { ...@@ -171,15 +171,15 @@ export default {
sortableStart(); sortableStart();
}, },
onAdd: e => { onAdd: (e) => {
const { items = [], newIndicies = [] } = e; const { items = [], newIndicies = [] } = e;
if (items.length) { if (items.length) {
// Not using e.newIndex here instead taking a min of all // Not using e.newIndex here instead taking a min of all
// the newIndicies. Basically we have to find that during // the newIndicies. Basically we have to find that during
// a drop what is the index we're going to start putting // a drop what is the index we're going to start putting
// all the dropped elements from. // all the dropped elements from.
const newIndex = Math.min(...newIndicies.map(obj => obj.index).filter(i => i !== -1)); const newIndex = Math.min(...newIndicies.map((obj) => obj.index).filter((i) => i !== -1));
const issues = items.map(item => const issues = items.map((item) =>
boardsStore.moving.list.findIssue(Number(item.dataset.issueId)), boardsStore.moving.list.findIssue(Number(item.dataset.issueId)),
); );
...@@ -201,23 +201,23 @@ export default { ...@@ -201,23 +201,23 @@ export default {
}); });
} }
}, },
onUpdate: e => { onUpdate: (e) => {
const sortedArray = this.sortable.toArray().filter(id => id !== '-1'); const sortedArray = this.sortable.toArray().filter((id) => id !== '-1');
const { items = [], newIndicies = [], oldIndicies = [] } = e; const { items = [], newIndicies = [], oldIndicies = [] } = e;
if (items.length) { if (items.length) {
const newIndex = Math.min(...newIndicies.map(obj => obj.index)); const newIndex = Math.min(...newIndicies.map((obj) => obj.index));
const issues = items.map(item => const issues = items.map((item) =>
boardsStore.moving.list.findIssue(Number(item.dataset.issueId)), boardsStore.moving.list.findIssue(Number(item.dataset.issueId)),
); );
boardsStore.moveMultipleIssuesInList({ boardsStore.moveMultipleIssuesInList({
list: this.list, list: this.list,
issues, issues,
oldIndicies: oldIndicies.map(obj => obj.index), oldIndicies: oldIndicies.map((obj) => obj.index),
newIndex, newIndex,
idArray: sortedArray, idArray: sortedArray,
}); });
e.items.forEach(el => { e.items.forEach((el) => {
Sortable.utils.deselect(el); Sortable.utils.deselect(el);
}); });
boardsStore.clearMultiSelect(); boardsStore.clearMultiSelect();
...@@ -232,7 +232,7 @@ export default { ...@@ -232,7 +232,7 @@ export default {
sortedArray, sortedArray,
); );
}, },
onEnd: e => { onEnd: (e) => {
const { items = [], clones = [], to } = e; const { items = [], clones = [], to } = e;
// This is not a multi select operation // This is not a multi select operation
...@@ -253,14 +253,14 @@ export default { ...@@ -253,14 +253,14 @@ export default {
*/ */
const isSameList = toList && toList.id === this.list.id; const isSameList = toList && toList.id === this.list.id;
if (toList && !isSameList && boardsStore.shouldRemoveIssue(this.list, toList)) { if (toList && !isSameList && boardsStore.shouldRemoveIssue(this.list, toList)) {
const issues = items.map(item => this.list.findIssue(Number(item.dataset.issueId))); const issues = items.map((item) => this.list.findIssue(Number(item.dataset.issueId)));
if ( if (
issues.filter(Boolean).length && issues.filter(Boolean).length &&
!boardsStore.issuesAreContiguous(this.list, issues) !boardsStore.issuesAreContiguous(this.list, issues)
) { ) {
const indexes = []; const indexes = [];
const ids = this.list.issues.map(i => i.id); const ids = this.list.issues.map((i) => i.id);
issues.forEach(issue => { issues.forEach((issue) => {
const index = ids.indexOf(issue.id); const index = ids.indexOf(issue.id);
if (index > -1) { if (index > -1) {
indexes.push(index); indexes.push(index);
...@@ -270,7 +270,7 @@ export default { ...@@ -270,7 +270,7 @@ export default {
// Descending sort because splice would cause index discrepancy otherwise // Descending sort because splice would cause index discrepancy otherwise
const sortedIndexes = indexes.sort((a, b) => (a < b ? 1 : -1)); const sortedIndexes = indexes.sort((a, b) => (a < b ? 1 : -1));
sortedIndexes.forEach(i => { sortedIndexes.forEach((i) => {
/** /**
* **setTimeout and splice each element one-by-one in a loop * **setTimeout and splice each element one-by-one in a loop
* is intended.** * is intended.**
...@@ -301,14 +301,14 @@ export default { ...@@ -301,14 +301,14 @@ export default {
// Since Vue's list does not re-render the same keyed item, we'll // Since Vue's list does not re-render the same keyed item, we'll
// remove `multi-select` class to express it's unselected // remove `multi-select` class to express it's unselected
if (clones && clones.length) { if (clones && clones.length) {
clones.forEach(el => el.classList.remove('multi-select')); clones.forEach((el) => el.classList.remove('multi-select'));
} }
// Due to some bug which I am unable to figure out // Due to some bug which I am unable to figure out
// Sortable does not deselect some pending items from the // Sortable does not deselect some pending items from the
// source list. // source list.
// We'll just do it forcefully here. // We'll just do it forcefully here.
Array.from(document.querySelectorAll('.js-multi-select') || []).forEach(item => { Array.from(document.querySelectorAll('.js-multi-select') || []).forEach((item) => {
Sortable.utils.deselect(item); Sortable.utils.deselect(item);
}); });
...@@ -322,7 +322,7 @@ export default { ...@@ -322,7 +322,7 @@ export default {
*/ */
this.$nextTick(() => { this.$nextTick(() => {
if (items && items.length) { if (items && items.length) {
items.forEach(item => { items.forEach((item) => {
item.remove(); item.remove();
}); });
} }
...@@ -346,7 +346,7 @@ export default { ...@@ -346,7 +346,7 @@ export default {
Sortable.utils.deselect(e.item); Sortable.utils.deselect(e.item);
} }
}, },
onDeselect: e => { onDeselect: (e) => {
const { const {
item: { dataset, classList }, item: { dataset, classList },
} = e; } = e;
......
...@@ -153,7 +153,7 @@ export default { ...@@ -153,7 +153,7 @@ export default {
let moveBeforeId; let moveBeforeId;
let moveAfterId; let moveAfterId;
const getIssueId = el => Number(el.dataset.issueId); const getIssueId = (el) => Number(el.dataset.issueId);
// If issue is being moved within the same list // If issue is being moved within the same list
if (from === to) { if (from === to) {
......
...@@ -65,8 +65,8 @@ export default { ...@@ -65,8 +65,8 @@ export default {
return this.addListNewIssue({ return this.addListNewIssue({
issueInput: { issueInput: {
title, title,
labelIds: labels?.map(l => l.id), labelIds: labels?.map((l) => l.id),
assigneeIds: assignees?.map(a => a?.id), assigneeIds: assignees?.map((a) => a?.id),
milestoneId: milestone?.id, milestoneId: milestone?.id,
projectPath: this.selectedProject.path, projectPath: this.selectedProject.path,
weight: weight >= 0 ? weight : null, weight: weight >= 0 ? weight : null,
......
...@@ -68,7 +68,7 @@ export default Vue.extend({ ...@@ -68,7 +68,7 @@ export default Vue.extend({
: __('Label'); : __('Label');
}, },
selectedLabels() { selectedLabels() {
return this.hasLabels ? this.issue.labels.map(l => l.title).join(',') : ''; return this.hasLabels ? this.issue.labels.map((l) => l.title).join(',') : '';
}, },
}, },
watch: { watch: {
......
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
return this.state.currentPage; return this.state.currentPage;
}, },
filteredBoards() { filteredBoards() {
return this.boards.filter(board => return this.boards.filter((board) =>
board.name.toLowerCase().includes(this.filterTerm.toLowerCase()), board.name.toLowerCase().includes(this.filterTerm.toLowerCase()),
); );
}, },
...@@ -181,10 +181,10 @@ export default { ...@@ -181,10 +181,10 @@ export default {
this.loadingRecentBoards = true; this.loadingRecentBoards = true;
boardsStore boardsStore
.recentBoards() .recentBoards()
.then(res => { .then((res) => {
this.recentBoards = res.data; this.recentBoards = res.data;
}) })
.catch(err => { .catch((err) => {
/** /**
* If user is unauthorized we'd still want to resolve the * If user is unauthorized we'd still want to resolve the
* request to display all boards. * request to display all boards.
......
...@@ -40,21 +40,21 @@ export default { ...@@ -40,21 +40,21 @@ export default {
const firstListIndex = 1; const firstListIndex = 1;
const list = this.modal.selectedList || this.state.lists[firstListIndex]; const list = this.modal.selectedList || this.state.lists[firstListIndex];
const selectedIssues = ModalStore.getSelectedIssues(); const selectedIssues = ModalStore.getSelectedIssues();
const issueIds = selectedIssues.map(issue => issue.id); const issueIds = selectedIssues.map((issue) => issue.id);
const req = this.buildUpdateRequest(list); const req = this.buildUpdateRequest(list);
// Post the data to the backend // Post the data to the backend
boardsStore.bulkUpdate(issueIds, req).catch(() => { boardsStore.bulkUpdate(issueIds, req).catch(() => {
Flash(__('Failed to update issues, please try again.')); Flash(__('Failed to update issues, please try again.'));
selectedIssues.forEach(issue => { selectedIssues.forEach((issue) => {
list.removeIssue(issue); list.removeIssue(issue);
list.issuesSize -= 1; list.issuesSize -= 1;
}); });
}); });
// Add the issues on the frontend // Add the issues on the frontend
selectedIssues.forEach(issue => { selectedIssues.forEach((issue) => {
list.addIssue(issue); list.addIssue(issue);
list.issuesSize += 1; list.issuesSize += 1;
}); });
......
...@@ -100,13 +100,13 @@ export default { ...@@ -100,13 +100,13 @@ export default {
page: this.page, page: this.page,
per: this.perPage, per: this.perPage,
}) })
.then(res => res.data) .then((res) => res.data)
.then(data => { .then((data) => {
if (clearIssues) { if (clearIssues) {
this.issues = []; this.issues = [];
} }
data.issues.forEach(issueObj => { data.issues.forEach((issueObj) => {
const issue = new ListIssue(issueObj); const issue = new ListIssue(issueObj);
const foundSelectedIssue = ModalStore.findSelectedIssue(issue); const foundSelectedIssue = ModalStore.findSelectedIssue(issue);
issue.selected = Boolean(foundSelectedIssue); issue.selected = Boolean(foundSelectedIssue);
......
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
try { try {
const projects = await Api.groupProjects(this.groupId, this.searchTerm, this.fetchOptions); const projects = await Api.groupProjects(this.groupId, this.searchTerm, this.fetchOptions);
this.projects = projects.map(project => { this.projects = projects.map((project) => {
return { return {
id: project.id, id: project.id,
name: project.name, name: project.name,
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
} }
}, },
selectProject(projectId) { selectProject(projectId) {
this.selectedProject = this.projects.find(project => project.id === projectId); this.selectedProject = this.projects.find((project) => project.id === projectId);
/* /*
TODO Remove eventhub, use Vuex for BoardNewIssue and GraphQL for BoardNewIssueNew TODO Remove eventhub, use Vuex for BoardNewIssue and GraphQL for BoardNewIssueNew
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
selectedLabels() { selectedLabels() {
const { labels = [] } = this.activeIssue; const { labels = [] } = this.activeIssue;
return labels.map(label => ({ return labels.map((label) => ({
...label, ...label,
id: getIdFromGraphQLId(label.id), id: getIdFromGraphQLId(label.id),
})); }));
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
issueLabels() { issueLabels() {
const { labels = [] } = this.activeIssue; const { labels = [] } = this.activeIssue;
return labels.map(label => ({ return labels.map((label) => ({
...label, ...label,
scoped: isScopedLabel(label), scoped: isScopedLabel(label),
})); }));
...@@ -46,10 +46,10 @@ export default { ...@@ -46,10 +46,10 @@ export default {
this.$refs.sidebarItem.collapse(); this.$refs.sidebarItem.collapse();
try { try {
const addLabelIds = payload.filter(label => label.set).map(label => label.id); const addLabelIds = payload.filter((label) => label.set).map((label) => label.id);
const removeLabelIds = this.selectedLabels const removeLabelIds = this.selectedLabels
.filter(label => !payload.find(selected => selected.id === label.id)) .filter((label) => !payload.find((selected) => selected.id === label.id))
.map(label => label.id); .map((label) => label.id);
const input = { addLabelIds, removeLabelIds, projectPath: this.projectPathForActiveIssue }; const input = { addLabelIds, removeLabelIds, projectPath: this.projectPathForActiveIssue };
await this.setActiveIssueLabels(input); await this.setActiveIssueLabels(input);
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
}, },
update(data) { update(data) {
const edges = data?.group?.milestones?.edges ?? []; const edges = data?.group?.milestones?.edges ?? [];
return edges.map(item => item.node); return edges.map((item) => item.node);
}, },
error() { error() {
createFlash({ message: this.$options.i18n.fetchMilestonesError }); createFlash({ message: this.$options.i18n.fetchMilestonesError });
......
...@@ -23,8 +23,8 @@ export default class FilteredSearchBoards extends FilteredSearchManager { ...@@ -23,8 +23,8 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
// Issue boards is slightly different, we handle all the requests async // Issue boards is slightly different, we handle all the requests async
// instead or reloading the page, we just re-fire the list ajax requests // instead or reloading the page, we just re-fire the list ajax requests
this.isHandledAsync = true; this.isHandledAsync = true;
this.cantEdit = cantEdit.filter(i => typeof i === 'string'); this.cantEdit = cantEdit.filter((i) => typeof i === 'string');
this.cantEditWithValue = cantEdit.filter(i => typeof i === 'object'); this.cantEditWithValue = cantEdit.filter((i) => typeof i === 'object');
if (vuexstore.getters.shouldUseGraphQL && vuexstore.state.boardConfig) { if (vuexstore.getters.shouldUseGraphQL && vuexstore.state.boardConfig) {
const boardConfigPath = transformBoardConfig(vuexstore.state.boardConfig); const boardConfigPath = transformBoardConfig(vuexstore.state.boardConfig);
...@@ -55,7 +55,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager { ...@@ -55,7 +55,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
const tokens = FilteredSearchContainer.container.querySelectorAll('.js-visual-token'); const tokens = FilteredSearchContainer.container.querySelectorAll('.js-visual-token');
// Remove all the tokens as they will be replaced by the search manager // Remove all the tokens as they will be replaced by the search manager
[].forEach.call(tokens, el => { [].forEach.call(tokens, (el) => {
el.parentNode.removeChild(el); el.parentNode.removeChild(el);
}); });
...@@ -75,7 +75,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager { ...@@ -75,7 +75,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
if (this.cantEdit.includes(tokenName)) return false; if (this.cantEdit.includes(tokenName)) return false;
return ( return (
this.cantEditWithValue.findIndex( this.cantEditWithValue.findIndex(
token => token.name === tokenName && token.value === tokenValue, (token) => token.name === tokenName && token.value === tokenValue,
) === -1 ) === -1
); );
} }
......
import Vue from 'vue'; import Vue from 'vue';
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
Vue.filter('due-date', value => { Vue.filter('due-date', (value) => {
const date = new Date(value); const date = new Date(value);
return dateFormat(date, 'mmm d, yyyy', true); return dateFormat(date, 'mmm d, yyyy', true);
}); });
...@@ -55,7 +55,7 @@ export default () => { ...@@ -55,7 +55,7 @@ export default () => {
const $boardApp = document.getElementById('board-app'); const $boardApp = document.getElementById('board-app');
// check for browser back and trigger a hard reload to circumvent browser caching. // check for browser back and trigger a hard reload to circumvent browser caching.
window.addEventListener('pageshow', event => { window.addEventListener('pageshow', (event) => {
const isNavTypeBackForward = const isNavTypeBackForward =
window.performance && window.performance.navigation.type === NavigationType.TYPE_BACK_FORWARD; window.performance && window.performance.navigation.type === NavigationType.TYPE_BACK_FORWARD;
...@@ -174,9 +174,9 @@ export default () => { ...@@ -174,9 +174,9 @@ export default () => {
initialBoardLoad() { initialBoardLoad() {
boardsStore boardsStore
.all() .all()
.then(res => res.data) .then((res) => res.data)
.then(lists => { .then((lists) => {
lists.forEach(list => boardsStore.addList(list)); lists.forEach((list) => boardsStore.addList(list));
this.loading = false; this.loading = false;
}) })
.catch(() => { .catch(() => {
...@@ -194,8 +194,8 @@ export default () => { ...@@ -194,8 +194,8 @@ export default () => {
setEpicFetchingState(newIssue, true); setEpicFetchingState(newIssue, true);
boardsStore boardsStore
.getIssueInfo(sidebarInfoEndpoint) .getIssueInfo(sidebarInfoEndpoint)
.then(res => res.data) .then((res) => res.data)
.then(data => { .then((data) => {
const { const {
subscribed, subscribed,
totalTimeSpent, totalTimeSpent,
...@@ -305,7 +305,7 @@ export default () => { ...@@ -305,7 +305,7 @@ export default () => {
if (!this.store) { if (!this.store) {
return true; return true;
} }
return !this.store.lists.filter(list => !list.preset).length; return !this.store.lists.filter((list) => !list.preset).length;
}, },
}, },
methods: { methods: {
......
...@@ -24,7 +24,7 @@ export function getBoardSortableDefaultOptions(obj) { ...@@ -24,7 +24,7 @@ export function getBoardSortableDefaultOptions(obj) {
onEnd: sortableEnd, onEnd: sortableEnd,
}; };
Object.keys(obj).forEach(key => { Object.keys(obj).forEach((key) => {
defaultSortOptions[key] = obj[key]; defaultSortOptions[key] = obj[key];
}); });
return defaultSortOptions; return defaultSortOptions;
......
...@@ -70,7 +70,7 @@ class ListIssue { ...@@ -70,7 +70,7 @@ class ListIssue {
} }
getLists() { getLists() {
return boardsStore.state.lists.filter(list => list.findIssue(this.id)); return boardsStore.state.lists.filter((list) => list.findIssue(this.id));
} }
updateData(newData) { updateData(newData) {
......
...@@ -134,7 +134,7 @@ class List { ...@@ -134,7 +134,7 @@ class List {
updateMultipleIssues(issues, listFrom, moveBeforeId, moveAfterId) { updateMultipleIssues(issues, listFrom, moveBeforeId, moveAfterId) {
boardsStore boardsStore
.moveMultipleIssues({ .moveMultipleIssues({
ids: issues.map(issue => issue.id), ids: issues.map((issue) => issue.id),
fromListId: listFrom.id, fromListId: listFrom.id,
toListId: this.id, toListId: this.id,
moveBeforeId, moveBeforeId,
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
const { lists, hideBacklogList } = data[boardType]?.board; const { lists, hideBacklogList } = data[boardType]?.board;
commit(types.RECEIVE_BOARD_LISTS_SUCCESS, formatBoardLists(lists)); commit(types.RECEIVE_BOARD_LISTS_SUCCESS, formatBoardLists(lists));
// Backlog list needs to be created if it doesn't exist and it's not hidden // Backlog list needs to be created if it doesn't exist and it's not hidden
if (!lists.nodes.find(l => l.listType === ListType.backlog) && !hideBacklogList) { if (!lists.nodes.find((l) => l.listType === ListType.backlog) && !hideBacklogList) {
dispatch('createList', { backlog: true }); dispatch('createList', { backlog: true });
} }
}) })
...@@ -390,7 +390,7 @@ export default { ...@@ -390,7 +390,7 @@ export default {
commit(types.ADD_ISSUE_TO_LIST, { list, issue, position: 0 }); commit(types.ADD_ISSUE_TO_LIST, { list, issue, position: 0 });
dispatch('createNewIssue', issueInput) dispatch('createNewIssue', issueInput)
.then(res => { .then((res) => {
commit(types.ADD_ISSUE_TO_LIST, { commit(types.ADD_ISSUE_TO_LIST, {
list, list,
issue: formatIssue({ ...res, id: getIdFromGraphQLId(res.id) }), issue: formatIssue({ ...res, id: getIdFromGraphQLId(res.id) }),
......
...@@ -124,7 +124,7 @@ const boardsStore = { ...@@ -124,7 +124,7 @@ const boardsStore = {
}, },
findIssueLabel(issue, findLabel) { findIssueLabel(issue, findLabel) {
return issue.labels.find(label => label.id === findLabel.id); return issue.labels.find((label) => label.id === findLabel.id);
}, },
goToNextPage(list) { goToNextPage(list) {
...@@ -182,7 +182,7 @@ const boardsStore = { ...@@ -182,7 +182,7 @@ const boardsStore = {
} }
}, },
findListIssue(list, id) { findListIssue(list, id) {
return list.issues.find(issue => issue.id === id); return list.issues.find((issue) => issue.id === id);
}, },
removeList(id, type = 'blank') { removeList(id, type = 'blank') {
...@@ -190,7 +190,7 @@ const boardsStore = { ...@@ -190,7 +190,7 @@ const boardsStore = {
if (!list) return; if (!list) return;
this.state.lists = this.state.lists.filter(list => list.id !== id); this.state.lists = this.state.lists.filter((list) => list.id !== id);
}, },
moveList(listFrom, orderLists) { moveList(listFrom, orderLists) {
orderLists.forEach((id, i) => { orderLists.forEach((id, i) => {
...@@ -205,7 +205,7 @@ const boardsStore = { ...@@ -205,7 +205,7 @@ const boardsStore = {
let moveBeforeId = null; let moveBeforeId = null;
let moveAfterId = null; let moveAfterId = null;
const listHasIssues = issues.every(issue => list.findIssue(issue.id)); const listHasIssues = issues.every((issue) => list.findIssue(issue.id));
if (!listHasIssues) { if (!listHasIssues) {
if (newIndex !== undefined) { if (newIndex !== undefined) {
...@@ -223,21 +223,21 @@ const boardsStore = { ...@@ -223,21 +223,21 @@ const boardsStore = {
} }
if (list.label) { if (list.label) {
issues.forEach(issue => issue.addLabel(list.label)); issues.forEach((issue) => issue.addLabel(list.label));
} }
if (list.assignee) { if (list.assignee) {
if (listFrom && listFrom.type === 'assignee') { if (listFrom && listFrom.type === 'assignee') {
issues.forEach(issue => issue.removeAssignee(listFrom.assignee)); issues.forEach((issue) => issue.removeAssignee(listFrom.assignee));
} }
issues.forEach(issue => issue.addAssignee(list.assignee)); issues.forEach((issue) => issue.addAssignee(list.assignee));
} }
if (IS_EE && list.milestone) { if (IS_EE && list.milestone) {
if (listFrom && listFrom.type === 'milestone') { if (listFrom && listFrom.type === 'milestone') {
issues.forEach(issue => issue.removeMilestone(listFrom.milestone)); issues.forEach((issue) => issue.removeMilestone(listFrom.milestone));
} }
issues.forEach(issue => issue.addMilestone(list.milestone)); issues.forEach((issue) => issue.addMilestone(list.milestone));
} }
if (listFrom) { if (listFrom) {
...@@ -249,7 +249,7 @@ const boardsStore = { ...@@ -249,7 +249,7 @@ const boardsStore = {
}, },
removeListIssues(list, removeIssue) { removeListIssues(list, removeIssue) {
list.issues = list.issues.filter(issue => { list.issues = list.issues.filter((issue) => {
const matchesRemove = removeIssue.id === issue.id; const matchesRemove = removeIssue.id === issue.id;
if (matchesRemove) { if (matchesRemove) {
...@@ -261,9 +261,9 @@ const boardsStore = { ...@@ -261,9 +261,9 @@ const boardsStore = {
}); });
}, },
removeListMultipleIssues(list, removeIssues) { removeListMultipleIssues(list, removeIssues) {
const ids = removeIssues.map(issue => issue.id); const ids = removeIssues.map((issue) => issue.id);
list.issues = list.issues.filter(issue => { list.issues = list.issues.filter((issue) => {
const matchesRemove = ids.includes(issue.id); const matchesRemove = ids.includes(issue.id);
if (matchesRemove) { if (matchesRemove) {
...@@ -289,9 +289,9 @@ const boardsStore = { ...@@ -289,9 +289,9 @@ const boardsStore = {
}, },
moveMultipleIssuesToList({ listFrom, listTo, issues, newIndex }) { moveMultipleIssuesToList({ listFrom, listTo, issues, newIndex }) {
const issueTo = issues.map(issue => listTo.findIssue(issue.id)); const issueTo = issues.map((issue) => listTo.findIssue(issue.id));
const issueLists = issues.map(issue => issue.getLists()).flat(); const issueLists = issues.map((issue) => issue.getLists()).flat();
const listLabels = issueLists.map(list => list.label); const listLabels = issueLists.map((list) => list.label);
const hasMoveableIssues = issueTo.filter(Boolean).length > 0; const hasMoveableIssues = issueTo.filter(Boolean).length > 0;
if (!hasMoveableIssues) { if (!hasMoveableIssues) {
...@@ -299,30 +299,30 @@ const boardsStore = { ...@@ -299,30 +299,30 @@ const boardsStore = {
if ( if (
listTo.type === ListType.assignee && listTo.type === ListType.assignee &&
listFrom.type === ListType.assignee && listFrom.type === ListType.assignee &&
issues.some(issue => issue.findAssignee(listTo.assignee)) issues.some((issue) => issue.findAssignee(listTo.assignee))
) { ) {
const targetIssues = issues.map(issue => listTo.findIssue(issue.id)); const targetIssues = issues.map((issue) => listTo.findIssue(issue.id));
targetIssues.forEach(targetIssue => targetIssue.removeAssignee(listFrom.assignee)); targetIssues.forEach((targetIssue) => targetIssue.removeAssignee(listFrom.assignee));
} else if (listTo.type === 'milestone') { } else if (listTo.type === 'milestone') {
const currentMilestones = issues.map(issue => issue.milestone); const currentMilestones = issues.map((issue) => issue.milestone);
const currentLists = this.state.lists const currentLists = this.state.lists
.filter(list => list.type === 'milestone' && list.id !== listTo.id) .filter((list) => list.type === 'milestone' && list.id !== listTo.id)
.filter(list => .filter((list) =>
list.issues.some(listIssue => issues.some(issue => listIssue.id === issue.id)), list.issues.some((listIssue) => issues.some((issue) => listIssue.id === issue.id)),
); );
issues.forEach(issue => { issues.forEach((issue) => {
currentMilestones.forEach(milestone => { currentMilestones.forEach((milestone) => {
issue.removeMilestone(milestone); issue.removeMilestone(milestone);
}); });
}); });
issues.forEach(issue => { issues.forEach((issue) => {
issue.addMilestone(listTo.milestone); issue.addMilestone(listTo.milestone);
}); });
currentLists.forEach(currentList => { currentLists.forEach((currentList) => {
issues.forEach(issue => { issues.forEach((issue) => {
currentList.removeIssue(issue); currentList.removeIssue(issue);
}); });
}); });
...@@ -334,36 +334,36 @@ const boardsStore = { ...@@ -334,36 +334,36 @@ const boardsStore = {
} }
} else { } else {
listTo.updateMultipleIssues(issues, listFrom); listTo.updateMultipleIssues(issues, listFrom);
issues.forEach(issue => { issues.forEach((issue) => {
issue.removeLabel(listFrom.label); issue.removeLabel(listFrom.label);
}); });
} }
if (listTo.type === ListType.closed && listFrom.type !== ListType.backlog) { if (listTo.type === ListType.closed && listFrom.type !== ListType.backlog) {
issueLists.forEach(list => { issueLists.forEach((list) => {
issues.forEach(issue => { issues.forEach((issue) => {
list.removeIssue(issue); list.removeIssue(issue);
}); });
}); });
issues.forEach(issue => { issues.forEach((issue) => {
issue.removeLabels(listLabels); issue.removeLabels(listLabels);
}); });
} else if (listTo.type === ListType.backlog && listFrom.type === ListType.assignee) { } else if (listTo.type === ListType.backlog && listFrom.type === ListType.assignee) {
issues.forEach(issue => { issues.forEach((issue) => {
issue.removeAssignee(listFrom.assignee); issue.removeAssignee(listFrom.assignee);
}); });
issueLists.forEach(list => { issueLists.forEach((list) => {
issues.forEach(issue => { issues.forEach((issue) => {
list.removeIssue(issue); list.removeIssue(issue);
}); });
}); });
} else if (listTo.type === ListType.backlog && listFrom.type === ListType.milestone) { } else if (listTo.type === ListType.backlog && listFrom.type === ListType.milestone) {
issues.forEach(issue => { issues.forEach((issue) => {
issue.removeMilestone(listFrom.milestone); issue.removeMilestone(listFrom.milestone);
}); });
issueLists.forEach(list => { issueLists.forEach((list) => {
issues.forEach(issue => { issues.forEach((issue) => {
list.removeIssue(issue); list.removeIssue(issue);
}); });
}); });
...@@ -380,8 +380,8 @@ const boardsStore = { ...@@ -380,8 +380,8 @@ const boardsStore = {
if (issues.length === 1) return true; if (issues.length === 1) return true;
// Create list of ids for issues involved. // Create list of ids for issues involved.
const listIssueIds = list.issues.map(issue => issue.id); const listIssueIds = list.issues.map((issue) => issue.id);
const movedIssueIds = issues.map(issue => issue.id); const movedIssueIds = issues.map((issue) => issue.id);
// Check if moved issue IDs is sub-array // Check if moved issue IDs is sub-array
// of source list issue IDs (i.e. contiguous selection). // of source list issue IDs (i.e. contiguous selection).
...@@ -391,7 +391,7 @@ const boardsStore = { ...@@ -391,7 +391,7 @@ const boardsStore = {
moveIssueToList(listFrom, listTo, issue, newIndex) { moveIssueToList(listFrom, listTo, issue, newIndex) {
const issueTo = listTo.findIssue(issue.id); const issueTo = listTo.findIssue(issue.id);
const issueLists = issue.getLists(); const issueLists = issue.getLists();
const listLabels = issueLists.map(listIssue => listIssue.label); const listLabels = issueLists.map((listIssue) => listIssue.label);
if (!issueTo) { if (!issueTo) {
// Check if target list assignee is already present in this issue // Check if target list assignee is already present in this issue
...@@ -405,12 +405,12 @@ const boardsStore = { ...@@ -405,12 +405,12 @@ const boardsStore = {
} else if (listTo.type === 'milestone') { } else if (listTo.type === 'milestone') {
const currentMilestone = issue.milestone; const currentMilestone = issue.milestone;
const currentLists = this.state.lists const currentLists = this.state.lists
.filter(list => list.type === 'milestone' && list.id !== listTo.id) .filter((list) => list.type === 'milestone' && list.id !== listTo.id)
.filter(list => list.issues.some(listIssue => issue.id === listIssue.id)); .filter((list) => list.issues.some((listIssue) => issue.id === listIssue.id));
issue.removeMilestone(currentMilestone); issue.removeMilestone(currentMilestone);
issue.addMilestone(listTo.milestone); issue.addMilestone(listTo.milestone);
currentLists.forEach(currentList => currentList.removeIssue(issue)); currentLists.forEach((currentList) => currentList.removeIssue(issue));
listTo.addIssue(issue, listFrom, newIndex); listTo.addIssue(issue, listFrom, newIndex);
} else { } else {
// Add to new lists issues if it doesn't already exist // Add to new lists issues if it doesn't already exist
...@@ -422,7 +422,7 @@ const boardsStore = { ...@@ -422,7 +422,7 @@ const boardsStore = {
} }
if (listTo.type === 'closed' && listFrom.type !== 'backlog') { if (listTo.type === 'closed' && listFrom.type !== 'backlog') {
issueLists.forEach(list => { issueLists.forEach((list) => {
list.removeIssue(issue); list.removeIssue(issue);
}); });
issue.removeLabels(listLabels); issue.removeLabels(listLabels);
...@@ -462,7 +462,7 @@ const boardsStore = { ...@@ -462,7 +462,7 @@ const boardsStore = {
}); });
}, },
findList(key, val, type = 'label') { findList(key, val, type = 'label') {
const filteredList = this.state.lists.filter(list => { const filteredList = this.state.lists.filter((list) => {
const byType = type const byType = type
? list.type === type || list.type === 'assignee' || list.type === 'milestone' ? list.type === type || list.type === 'assignee' || list.type === 'milestone'
: true; : true;
...@@ -472,7 +472,7 @@ const boardsStore = { ...@@ -472,7 +472,7 @@ const boardsStore = {
return filteredList[0]; return filteredList[0];
}, },
findListByLabelId(id) { findListByLabelId(id) {
return this.state.lists.find(list => list.type === 'label' && list.label.id === id); return this.state.lists.find((list) => list.type === 'label' && list.label.id === id);
}, },
toggleFilter(filter) { toggleFilter(filter) {
...@@ -589,8 +589,8 @@ const boardsStore = { ...@@ -589,8 +589,8 @@ const boardsStore = {
} }
return this.createList(entity.id, entityType) return this.createList(entity.id, entityType)
.then(res => res.data) .then((res) => res.data)
.then(data => { .then((data) => {
list.id = data.id; list.id = data.id;
list.type = data.list_type; list.type = data.list_type;
list.position = data.position; list.position = data.position;
...@@ -607,7 +607,7 @@ const boardsStore = { ...@@ -607,7 +607,7 @@ const boardsStore = {
}; };
if (list.label && data.label_name) { if (list.label && data.label_name) {
data.label_name = data.label_name.filter(label => label !== list.label.title); data.label_name = data.label_name.filter((label) => label !== list.label.title);
} }
if (emptyIssues) { if (emptyIssues) {
...@@ -615,8 +615,8 @@ const boardsStore = { ...@@ -615,8 +615,8 @@ const boardsStore = {
} }
return this.getIssuesForList(list.id, data) return this.getIssuesForList(list.id, data)
.then(res => res.data) .then((res) => res.data)
.then(data => { .then((data) => {
list.loading = false; list.loading = false;
list.issuesSize = data.size; list.issuesSize = data.size;
...@@ -624,7 +624,7 @@ const boardsStore = { ...@@ -624,7 +624,7 @@ const boardsStore = {
list.issues = []; list.issues = [];
} }
data.issues.forEach(issueObj => { data.issues.forEach((issueObj) => {
list.addIssue(new ListIssue(issueObj)); list.addIssue(new ListIssue(issueObj));
}); });
...@@ -634,7 +634,7 @@ const boardsStore = { ...@@ -634,7 +634,7 @@ const boardsStore = {
getIssuesForList(id, filter = {}) { getIssuesForList(id, filter = {}) {
const data = { id }; const data = { id };
Object.keys(filter).forEach(key => { Object.keys(filter).forEach((key) => {
data[key] = filter[key]; data[key] = filter[key];
}); });
...@@ -670,13 +670,13 @@ const boardsStore = { ...@@ -670,13 +670,13 @@ const boardsStore = {
}, },
moveListMultipleIssues({ list, issues, oldIndicies, newIndex, moveBeforeId, moveAfterId }) { moveListMultipleIssues({ list, issues, oldIndicies, newIndex, moveBeforeId, moveAfterId }) {
oldIndicies.reverse().forEach(index => { oldIndicies.reverse().forEach((index) => {
list.issues.splice(index, 1); list.issues.splice(index, 1);
}); });
list.issues.splice(newIndex, 0, ...issues); list.issues.splice(newIndex, 0, ...issues);
return this.moveMultipleIssues({ return this.moveMultipleIssues({
ids: issues.map(issue => issue.id), ids: issues.map((issue) => issue.id),
fromListId: null, fromListId: null,
toListId: null, toListId: null,
moveBeforeId, moveBeforeId,
...@@ -703,8 +703,8 @@ const boardsStore = { ...@@ -703,8 +703,8 @@ const boardsStore = {
} }
return this.newIssue(list.id, issue) return this.newIssue(list.id, issue)
.then(res => res.data) .then((res) => res.data)
.then(data => list.onNewIssueResponse(issue, data)); .then((data) => list.onNewIssueResponse(issue, data));
}, },
getBacklog(data) { getBacklog(data) {
...@@ -717,7 +717,7 @@ const boardsStore = { ...@@ -717,7 +717,7 @@ const boardsStore = {
}, },
removeIssueLabel(issue, removeLabel) { removeIssueLabel(issue, removeLabel) {
if (removeLabel) { if (removeLabel) {
issue.labels = issue.labels.filter(label => removeLabel.id !== label.id); issue.labels = issue.labels.filter((label) => removeLabel.id !== label.id);
} }
}, },
...@@ -762,7 +762,7 @@ const boardsStore = { ...@@ -762,7 +762,7 @@ const boardsStore = {
}, },
toggleMultiSelect(issue) { toggleMultiSelect(issue) {
const selectedIssueIds = this.multiSelect.list.map(issue => issue.id); const selectedIssueIds = this.multiSelect.list.map((issue) => issue.id);
const index = selectedIssueIds.indexOf(issue.id); const index = selectedIssueIds.indexOf(issue.id);
if (index === -1) { if (index === -1) {
...@@ -777,12 +777,12 @@ const boardsStore = { ...@@ -777,12 +777,12 @@ const boardsStore = {
}, },
removeIssueAssignee(issue, removeAssignee) { removeIssueAssignee(issue, removeAssignee) {
if (removeAssignee) { if (removeAssignee) {
issue.assignees = issue.assignees.filter(assignee => assignee.id !== removeAssignee.id); issue.assignees = issue.assignees.filter((assignee) => assignee.id !== removeAssignee.id);
} }
}, },
findIssueAssignee(issue, findAssignee) { findIssueAssignee(issue, findAssignee) {
return issue.assignees.find(assignee => assignee.id === findAssignee.id); return issue.assignees.find((assignee) => assignee.id === findAssignee.id);
}, },
clearMultiSelect() { clearMultiSelect() {
...@@ -837,11 +837,11 @@ const boardsStore = { ...@@ -837,11 +837,11 @@ const boardsStore = {
} }
if (obj.labels) { if (obj.labels) {
issue.labels = obj.labels.map(label => new ListLabel(label)); issue.labels = obj.labels.map((label) => new ListLabel(label));
} }
if (obj.assignees) { if (obj.assignees) {
issue.assignees = obj.assignees.map(a => new ListAssignee(a)); issue.assignees = obj.assignees.map((a) => new ListAssignee(a));
} }
}, },
addIssueLabel(issue, label) { addIssueLabel(issue, label) {
......
...@@ -2,18 +2,18 @@ import { find } from 'lodash'; ...@@ -2,18 +2,18 @@ import { find } from 'lodash';
import { inactiveId } from '../constants'; import { inactiveId } from '../constants';
export default { export default {
isSidebarOpen: state => state.activeId !== inactiveId, isSidebarOpen: (state) => state.activeId !== inactiveId,
isSwimlanesOn: () => false, isSwimlanesOn: () => false,
getIssueById: state => id => { getIssueById: (state) => (id) => {
return state.issues[id] || {}; return state.issues[id] || {};
}, },
getIssuesByList: (state, getters) => listId => { getIssuesByList: (state, getters) => (listId) => {
const listIssueIds = state.issuesByListId[listId] || []; const listIssueIds = state.issuesByListId[listId] || [];
return listIssueIds.map(id => getters.getIssueById(id)); return listIssueIds.map((id) => getters.getIssueById(id));
}, },
activeIssue: state => { activeIssue: (state) => {
return state.issues[state.activeId] || {}; return state.issues[state.activeId] || {};
}, },
...@@ -22,12 +22,12 @@ export default { ...@@ -22,12 +22,12 @@ export default {
return referencePath.slice(0, referencePath.indexOf('#')); return referencePath.slice(0, referencePath.indexOf('#'));
}, },
getListByLabelId: state => labelId => { getListByLabelId: (state) => (labelId) => {
return find(state.boardLists, l => l.label?.id === labelId); return find(state.boardLists, (l) => l.label?.id === labelId);
}, },
getListByTitle: state => title => { getListByTitle: (state) => (title) => {
return find(state.boardLists, l => l.title === title); return find(state.boardLists, (l) => l.title === title);
}, },
shouldUseGraphQL: () => { shouldUseGraphQL: () => {
......
...@@ -40,7 +40,7 @@ class ModalStore { ...@@ -40,7 +40,7 @@ class ModalStore {
toggleAll() { toggleAll() {
const select = this.selectedCount() !== this.store.issues.length; const select = this.selectedCount() !== this.store.issues.length;
this.store.issues.forEach(issue => { this.store.issues.forEach((issue) => {
const issueUpdate = issue; const issueUpdate = issue;
if (issueUpdate.selected !== select) { if (issueUpdate.selected !== select) {
...@@ -56,7 +56,7 @@ class ModalStore { ...@@ -56,7 +56,7 @@ class ModalStore {
} }
getSelectedIssues() { getSelectedIssues() {
return this.store.selectedIssues.filter(issue => issue.selected); return this.store.selectedIssues.filter((issue) => issue.selected);
} }
addSelectedIssue(issue) { addSelectedIssue(issue) {
...@@ -70,13 +70,13 @@ class ModalStore { ...@@ -70,13 +70,13 @@ class ModalStore {
removeSelectedIssue(issue, forcePurge = false) { removeSelectedIssue(issue, forcePurge = false) {
if (this.store.activeTab === 'all' || forcePurge) { if (this.store.activeTab === 'all' || forcePurge) {
this.store.selectedIssues = this.store.selectedIssues.filter( this.store.selectedIssues = this.store.selectedIssues.filter(
fIssue => fIssue.id !== issue.id, (fIssue) => fIssue.id !== issue.id,
); );
} }
} }
purgeUnselectedIssues() { purgeUnselectedIssues() {
this.store.selectedIssues.forEach(issue => { this.store.selectedIssues.forEach((issue) => {
if (!issue.selected) { if (!issue.selected) {
this.removeSelectedIssue(issue, true); this.removeSelectedIssue(issue, true);
} }
...@@ -88,7 +88,7 @@ class ModalStore { ...@@ -88,7 +88,7 @@ class ModalStore {
} }
findSelectedIssue(issue) { findSelectedIssue(issue) {
return this.store.selectedIssues.filter(filteredIssue => filteredIssue.id === issue.id)[0]; return this.store.selectedIssues.filter((filteredIssue) => filteredIssue.id === issue.id)[0];
} }
} }
......
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
state.boardLists = lists; state.boardLists = lists;
}, },
[mutationTypes.RECEIVE_BOARD_LISTS_FAILURE]: state => { [mutationTypes.RECEIVE_BOARD_LISTS_FAILURE]: (state) => {
state.error = s__( state.error = s__(
'Boards|An error occurred while fetching the board lists. Please reload the page.', 'Boards|An error occurred while fetching the board lists. Please reload the page.',
); );
...@@ -59,15 +59,15 @@ export default { ...@@ -59,15 +59,15 @@ export default {
state.filterParams = filterParams; state.filterParams = filterParams;
}, },
[mutationTypes.CREATE_LIST_FAILURE]: state => { [mutationTypes.CREATE_LIST_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while creating the list. Please try again.'); state.error = s__('Boards|An error occurred while creating the list. Please try again.');
}, },
[mutationTypes.RECEIVE_LABELS_FAILURE]: state => { [mutationTypes.RECEIVE_LABELS_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while fetching labels. Please reload the page.'); state.error = s__('Boards|An error occurred while fetching labels. Please reload the page.');
}, },
[mutationTypes.GENERATE_DEFAULT_LISTS_FAILURE]: state => { [mutationTypes.GENERATE_DEFAULT_LISTS_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while generating lists. Please reload the page.'); state.error = s__('Boards|An error occurred while generating lists. Please reload the page.');
}, },
...@@ -129,8 +129,8 @@ export default { ...@@ -129,8 +129,8 @@ export default {
Vue.set(state.listsFlags, listId, { isLoading: false, isLoadingMore: false }); Vue.set(state.listsFlags, listId, { isLoading: false, isLoadingMore: false });
}, },
[mutationTypes.RESET_ISSUES]: state => { [mutationTypes.RESET_ISSUES]: (state) => {
Object.keys(state.issuesByListId).forEach(listId => { Object.keys(state.issuesByListId).forEach((listId) => {
Vue.set(state.issuesByListId, listId, []); Vue.set(state.issuesByListId, listId, []);
}); });
}, },
...@@ -206,7 +206,7 @@ export default { ...@@ -206,7 +206,7 @@ export default {
notImplemented(); notImplemented();
}, },
[mutationTypes.CREATE_ISSUE_FAILURE]: state => { [mutationTypes.CREATE_ISSUE_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while creating the issue. Please try again.'); state.error = s__('Boards|An error occurred while creating the issue. Please try again.');
}, },
......
...@@ -21,7 +21,7 @@ export function createGraphVueApp(el, data, maxCommits) { ...@@ -21,7 +21,7 @@ export function createGraphVueApp(el, data, maxCommits) {
}); });
} }
export default endpoint => { export default (endpoint) => {
const names = [...document.querySelectorAll('.js-branch-item')].map( const names = [...document.querySelectorAll('.js-branch-item')].map(
({ dataset }) => dataset.name, ({ dataset }) => dataset.name,
); );
......
import $ from 'jquery'; import $ from 'jquery';
import { hide } from '~/tooltips'; import { hide } from '~/tooltips';
export const addTooltipToEl = el => { export const addTooltipToEl = (el) => {
const textEl = el.querySelector('.js-breadcrumb-item-text'); const textEl = el.querySelector('.js-breadcrumb-item-text');
if (textEl && textEl.scrollWidth > textEl.offsetWidth) { if (textEl && textEl.scrollWidth > textEl.offsetWidth) {
...@@ -16,14 +16,14 @@ export default () => { ...@@ -16,14 +16,14 @@ export default () => {
if (breadcrumbs) { if (breadcrumbs) {
const topLevelLinks = [...breadcrumbs.children] const topLevelLinks = [...breadcrumbs.children]
.filter(el => !el.classList.contains('dropdown')) .filter((el) => !el.classList.contains('dropdown'))
.map(el => el.querySelector('a')) .map((el) => el.querySelector('a'))
.filter(el => el); .filter((el) => el);
const $expander = $('.js-breadcrumbs-collapsed-expander'); const $expander = $('.js-breadcrumbs-collapsed-expander');
topLevelLinks.forEach(el => addTooltipToEl(el)); topLevelLinks.forEach((el) => addTooltipToEl(el));
$expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', e => { $expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', (e) => {
const $el = $('.js-breadcrumbs-collapsed-expander', e.currentTarget); const $el = $('.js-breadcrumbs-collapsed-expander', e.currentTarget);
$el.toggleClass('open'); $el.toggleClass('open');
......
...@@ -15,5 +15,5 @@ const handleOnDismiss = ({ currentTarget }) => { ...@@ -15,5 +15,5 @@ const handleOnDismiss = ({ currentTarget }) => {
export default () => { export default () => {
document document
.querySelectorAll('.js-dismiss-current-broadcast-notification') .querySelectorAll('.js-dismiss-current-broadcast-notification')
.forEach(dismissButton => dismissButton.addEventListener('click', handleOnDismiss)); .forEach((dismissButton) => dismissButton.addEventListener('click', handleOnDismiss));
}; };
...@@ -14,10 +14,10 @@ export default class BuildArtifacts { ...@@ -14,10 +14,10 @@ export default class BuildArtifacts {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
disablePropagation() { disablePropagation() {
$('.top-block').on('click', '.download', e => { $('.top-block').on('click', '.download', (e) => {
e.stopPropagation(); e.stopPropagation();
}); });
return $('.tree-holder').on('click', 'tr[data-link] a', e => { return $('.tree-holder').on('click', 'tr[data-link] a', (e) => {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
}); });
} }
...@@ -41,12 +41,12 @@ export default class BuildArtifacts { ...@@ -41,12 +41,12 @@ export default class BuildArtifacts {
// We want the tooltip to show if you hover anywhere on the row // We want the tooltip to show if you hover anywhere on the row
// But be placed below and in the middle of the file name // But be placed below and in the middle of the file name
$('.js-artifact-tree-row') $('.js-artifact-tree-row')
.on('mouseenter', e => { .on('mouseenter', (e) => {
const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip'); const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip');
show($el); show($el);
}) })
.on('mouseleave', e => { .on('mouseleave', (e) => {
const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip'); const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip');
hide($el); hide($el);
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import TriggersList from './components/triggers_list.vue'; import TriggersList from './components/triggers_list.vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
const parseJsonArray = triggers => { const parseJsonArray = (triggers) => {
try { try {
return convertObjectPropsToCamelCase(JSON.parse(triggers), { deep: true }); return convertObjectPropsToCamelCase(JSON.parse(triggers), { deep: true });
} catch { } catch {
......
...@@ -81,17 +81,17 @@ export default class VariableList { ...@@ -81,17 +81,17 @@ export default class VariableList {
this.initRow(rowEl); this.initRow(rowEl);
}); });
this.$container.on('click', '.js-row-remove-button', e => { this.$container.on('click', '.js-row-remove-button', (e) => {
e.preventDefault(); e.preventDefault();
this.removeRow($(e.currentTarget).closest('.js-row')); this.removeRow($(e.currentTarget).closest('.js-row'));
}); });
const inputSelector = Object.keys(this.inputMap) const inputSelector = Object.keys(this.inputMap)
.map(name => this.inputMap[name].selector) .map((name) => this.inputMap[name].selector)
.join(','); .join(',');
// Remove any empty rows except the last row // Remove any empty rows except the last row
this.$container.on('blur', inputSelector, e => { this.$container.on('blur', inputSelector, (e) => {
const $row = $(e.currentTarget).closest('.js-row'); const $row = $(e.currentTarget).closest('.js-row');
if ($row.is(':not(:last-child)') && !this.checkIfRowTouched($row)) { if ($row.is(':not(:last-child)') && !this.checkIfRowTouched($row)) {
...@@ -99,7 +99,7 @@ export default class VariableList { ...@@ -99,7 +99,7 @@ export default class VariableList {
} }
}); });
this.$container.on('input trigger-change', inputSelector, e => { this.$container.on('input trigger-change', inputSelector, (e) => {
// Always make sure there is an empty last row // Always make sure there is an empty last row
const $lastRow = this.$container.find('.js-row').last(); const $lastRow = this.$container.find('.js-row').last();
...@@ -149,7 +149,7 @@ export default class VariableList { ...@@ -149,7 +149,7 @@ export default class VariableList {
$rowClone.removeAttr('data-is-persisted'); $rowClone.removeAttr('data-is-persisted');
// Reset the inputs to their defaults // Reset the inputs to their defaults
Object.keys(this.inputMap).forEach(name => { Object.keys(this.inputMap).forEach((name) => {
const entry = this.inputMap[name]; const entry = this.inputMap[name];
$rowClone.find(entry.selector).val(entry.default); $rowClone.find(entry.selector).val(entry.default);
}); });
...@@ -184,7 +184,7 @@ export default class VariableList { ...@@ -184,7 +184,7 @@ export default class VariableList {
} }
checkIfRowTouched($row) { checkIfRowTouched($row) {
return Object.keys(this.inputMap).some(name => { return Object.keys(this.inputMap).some((name) => {
// Row should not qualify as touched if only switches have been touched // Row should not qualify as touched if only switches have been touched
if (['protected', 'masked'].includes(name)) return false; if (['protected', 'masked'].includes(name)) return false;
...@@ -225,9 +225,9 @@ export default class VariableList { ...@@ -225,9 +225,9 @@ export default class VariableList {
// a blank variable and run into validation problems. // a blank variable and run into validation problems.
const validRows = this.$container.find('.js-row').toArray().slice(0, -1); const validRows = this.$container.find('.js-row').toArray().slice(0, -1);
return validRows.map(rowEl => { return validRows.map((rowEl) => {
const resultant = {}; const resultant = {};
Object.keys(this.inputMap).forEach(name => { Object.keys(this.inputMap).forEach((name) => {
const entry = this.inputMap[name]; const entry = this.inputMap[name];
const $input = $(rowEl).find(entry.selector); const $input = $(rowEl).find(entry.selector);
if ($input.length) { if ($input.length) {
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
}, },
filteredResults() { filteredResults() {
const lowerCasedSearchTerm = this.searchTerm.toLowerCase(); const lowerCasedSearchTerm = this.searchTerm.toLowerCase();
return this.joinedEnvironments.filter(resultString => return this.joinedEnvironments.filter((resultString) =>
resultString.toLowerCase().includes(lowerCasedSearchTerm), resultString.toLowerCase().includes(lowerCasedSearchTerm),
); );
}, },
......
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
}, },
fields() { fields() {
if (this.isGroup) { if (this.isGroup) {
return this.$options.fields.filter(field => field.key !== 'environment_scope'); return this.$options.fields.filter((field) => field.key !== 'environment_scope');
} }
return this.$options.fields; return this.$options.fields;
}, },
......
const IS_EE = require('./config/helpers/is_ee_env'); const IS_EE = require('./config/helpers/is_ee_env');
const isESLint = require('./config/helpers/is_eslint'); const isESLint = require('./config/helpers/is_eslint');
module.exports = path => { module.exports = (path) => {
const reporters = ['default']; const reporters = ['default'];
// To have consistent date time parsing both in local and CI environments we set // To have consistent date time parsing both in local and CI environments we set
...@@ -27,7 +27,7 @@ module.exports = path => { ...@@ -27,7 +27,7 @@ module.exports = path => {
// workaround for eslint-import-resolver-jest only resolving in test files // workaround for eslint-import-resolver-jest only resolving in test files
// see https://github.com/JoinColony/eslint-import-resolver-jest#note // see https://github.com/JoinColony/eslint-import-resolver-jest#note
if (isESLint(module)) { if (isESLint(module)) {
testMatch = testMatch.map(path => path.replace('_spec.js', '')); testMatch = testMatch.map((path) => path.replace('_spec.js', ''));
} }
const TEST_FIXTURES_PATTERN = 'test_fixtures(/.*)$'; const TEST_FIXTURES_PATTERN = 'test_fixtures(/.*)$';
......
...@@ -4,7 +4,7 @@ module.exports = { ...@@ -4,7 +4,7 @@ module.exports = {
...baseConfig('spec/frontend'), ...baseConfig('spec/frontend'),
}; };
const karmaTestFile = process.argv.find(arg => arg.includes('spec/javascripts/')); const karmaTestFile = process.argv.find((arg) => arg.includes('spec/javascripts/'));
if (karmaTestFile) { if (karmaTestFile) {
console.error(` console.error(`
Files in spec/javascripts/ and ee/spec/javascripts need to be run with Karma. Files in spec/javascripts/ and ee/spec/javascripts need to be run with Karma.
......
...@@ -5,13 +5,13 @@ const dependencies = packageJson.dependencies; ...@@ -5,13 +5,13 @@ const dependencies = packageJson.dependencies;
const devDependencies = packageJson.devDependencies; const devDependencies = packageJson.devDependencies;
const blockedDependenciesNames = Object.keys(blockedDependencies); const blockedDependenciesNames = Object.keys(blockedDependencies);
const blockedDependenciesFound = blockedDependenciesNames.filter( const blockedDependenciesFound = blockedDependenciesNames.filter(
blockedDependency => dependencies[blockedDependency] || devDependencies[blockedDependency], (blockedDependency) => dependencies[blockedDependency] || devDependencies[blockedDependency],
); );
if (blockedDependenciesFound.length) { if (blockedDependenciesFound.length) {
console.log('The following package.json dependencies are not allowed:'); console.log('The following package.json dependencies are not allowed:');
blockedDependenciesFound.forEach(blockedDependency => { blockedDependenciesFound.forEach((blockedDependency) => {
const infoLink = blockedDependencies[blockedDependency]; const infoLink = blockedDependencies[blockedDependency];
console.log(`- ${blockedDependency}: See ${infoLink} for more information.`); console.log(`- ${blockedDependency}: See ${infoLink} for more information.`);
......
...@@ -27,7 +27,7 @@ const file = fs.readFileSync(paths[0], 'utf-8'); ...@@ -27,7 +27,7 @@ const file = fs.readFileSync(paths[0], 'utf-8');
const parsed = pjs.parse(file); const parsed = pjs.parse(file);
if (parsed.nodes.every(node => ['comment', 'atrule'].includes(node.type))) { if (parsed.nodes.every((node) => ['comment', 'atrule'].includes(node.type))) {
console.log('The file does not introduce any side effects, we are all good.'); console.log('The file does not introduce any side effects, we are all good.');
process.exit(0); process.exit(0);
} }
......
...@@ -45,7 +45,7 @@ function printJson() { ...@@ -45,7 +45,7 @@ function printJson() {
text += `\u0000${message.textPlural}`; text += `\u0000${message.textPlural}`;
} }
message.references.forEach(reference => { message.references.forEach((reference) => {
const filename = reference.replace(/:\d+$/, ''); const filename = reference.replace(/:\d+$/, '');
if (!Array.isArray(result[filename])) { if (!Array.isArray(result[filename])) {
......
...@@ -17,11 +17,11 @@ const sourceDirectories = ['app/assets/javascripts']; ...@@ -17,11 +17,11 @@ const sourceDirectories = ['app/assets/javascripts'];
const testDirectories = ['spec/javascripts', 'spec/frontend']; const testDirectories = ['spec/javascripts', 'spec/frontend'];
if (fs.existsSync('ee')) { if (fs.existsSync('ee')) {
sourceDirectories.forEach(dir => { sourceDirectories.forEach((dir) => {
sourceDirectories.push(`ee/${dir}`); sourceDirectories.push(`ee/${dir}`);
}); });
testDirectories.forEach(dir => { testDirectories.forEach((dir) => {
testDirectories.push(`ee/${dir}`); testDirectories.push(`ee/${dir}`);
}); });
} }
...@@ -29,10 +29,10 @@ if (fs.existsSync('ee')) { ...@@ -29,10 +29,10 @@ if (fs.existsSync('ee')) {
let numSourceFiles = 0; let numSourceFiles = 0;
let numTestFiles = 0; let numTestFiles = 0;
const isVerbose = process.argv.some(arg => arg === '-v'); const isVerbose = process.argv.some((arg) => arg === '-v');
const countSourceFiles = path => const countSourceFiles = (path) =>
forEachFileIn(path, fileName => { forEachFileIn(path, (fileName) => {
if (fileName.endsWith('.vue') || fileName.endsWith('.js')) { if (fileName.endsWith('.vue') || fileName.endsWith('.js')) {
if (isVerbose) { if (isVerbose) {
console.log(`source file: ${fileName}`); console.log(`source file: ${fileName}`);
...@@ -42,8 +42,8 @@ const countSourceFiles = path => ...@@ -42,8 +42,8 @@ const countSourceFiles = path =>
} }
}); });
const countTestFiles = path => const countTestFiles = (path) =>
forEachFileIn(path, fileName => { forEachFileIn(path, (fileName) => {
if (fileName.endsWith('_spec.js')) { if (fileName.endsWith('_spec.js')) {
if (isVerbose) { if (isVerbose) {
console.log(`test file: ${fileName}`); console.log(`test file: ${fileName}`);
...@@ -63,7 +63,7 @@ function forEachFileIn(dirPath, callback) { ...@@ -63,7 +63,7 @@ function forEachFileIn(dirPath, callback) {
return; return;
} }
files.forEach(fileName => { files.forEach((fileName) => {
const absolutePath = path.join(dirPath, fileName); const absolutePath = path.join(dirPath, fileName);
const stats = fs.statSync(absolutePath); const stats = fs.statSync(absolutePath);
if (stats.isFile()) { if (stats.isFile()) {
......
...@@ -9,10 +9,10 @@ const exec = (command, args) => { ...@@ -9,10 +9,10 @@ const exec = (command, args) => {
return execFileSync(command, args, options); return execFileSync(command, args, options);
}; };
const execGitCmd = args => exec('git', args).trim().toString().split('\n').filter(Boolean); const execGitCmd = (args) => exec('git', args).trim().toString().split('\n').filter(Boolean);
module.exports = { module.exports = {
getStagedFiles: fileExtensionFilter => { getStagedFiles: (fileExtensionFilter) => {
const gitOptions = ['diff', '--name-only', '--cached', '--diff-filter=ACMRTUB']; const gitOptions = ['diff', '--name-only', '--cached', '--diff-filter=ACMRTUB'];
if (fileExtensionFilter) gitOptions.push(...fileExtensionFilter); if (fileExtensionFilter) gitOptions.push(...fileExtensionFilter);
return execGitCmd(gitOptions); return execGitCmd(gitOptions);
......
...@@ -11,7 +11,7 @@ const reportFiles = sync(`${coverageDir}/*/coverage-final.json`); ...@@ -11,7 +11,7 @@ const reportFiles = sync(`${coverageDir}/*/coverage-final.json`);
// Normalize coverage report generated by jest that has additional "data" key // Normalize coverage report generated by jest that has additional "data" key
// https://github.com/facebook/jest/issues/2418#issuecomment-423806659 // https://github.com/facebook/jest/issues/2418#issuecomment-423806659
const normalizeReport = report => { const normalizeReport = (report) => {
const normalizedReport = Object.assign({}, report); const normalizedReport = Object.assign({}, report);
Object.entries(normalizedReport).forEach(([k, v]) => { Object.entries(normalizedReport).forEach(([k, v]) => {
if (v.data) normalizedReport[k] = v.data; if (v.data) normalizedReport[k] = v.data;
...@@ -20,12 +20,12 @@ const normalizeReport = report => { ...@@ -20,12 +20,12 @@ const normalizeReport = report => {
}; };
reportFiles reportFiles
.map(reportFile => require(reportFile)) .map((reportFile) => require(reportFile))
.map(normalizeReport) .map(normalizeReport)
.forEach(report => coverageMap.merge(report)); .forEach((report) => coverageMap.merge(report));
const context = createContext({ coverageMap: coverageMap, dir: 'coverage-frontend' }); const context = createContext({ coverageMap: coverageMap, dir: 'coverage-frontend' });
['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach(reporter => { ['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach((reporter) => {
create(reporter, {}).execute(context); create(reporter, {}).execute(context);
}); });
...@@ -35,7 +35,7 @@ console.log( ...@@ -35,7 +35,7 @@ console.log(
`Loading all ${allFiles ? '' : 'staged '}files ${globDir ? `within ${globDir} ` : ''}...`, `Loading all ${allFiles ? '' : 'staged '}files ${globDir ? `within ${globDir} ` : ''}...`,
); );
const globPatterns = matchExtensions.map(ext => `${globDir}**/*.${ext}`); const globPatterns = matchExtensions.map((ext) => `${globDir}**/*.${ext}`);
const matchedFiles = allFiles const matchedFiles = allFiles
? glob.sync(`{${globPatterns.join(',')}}`, { ignore: globIgnore }) ? glob.sync(`{${globPatterns.join(',')}}`, { ignore: globIgnore })
: getStagedFiles(globPatterns); : getStagedFiles(globPatterns);
...@@ -62,7 +62,7 @@ Please format each file listed below or run "${fixCommand}" ...@@ -62,7 +62,7 @@ Please format each file listed below or run "${fixCommand}"
`; `;
const checkFileWithOptions = (filePath, options) => const checkFileWithOptions = (filePath, options) =>
readFileAsync(filePath, 'utf8').then(input => { readFileAsync(filePath, 'utf8').then((input) => {
if (shouldSave) { if (shouldSave) {
const output = prettier.format(input, options); const output = prettier.format(input, options);
if (input === output) { if (input === output) {
...@@ -92,7 +92,7 @@ const checkFileWithOptions = (filePath, options) => ...@@ -92,7 +92,7 @@ const checkFileWithOptions = (filePath, options) =>
} }
}); });
const checkFileWithPrettierConfig = filePath => const checkFileWithPrettierConfig = (filePath) =>
prettier prettier
.getFileInfo(filePath, { ignorePath: '.prettierignore' }) .getFileInfo(filePath, { ignorePath: '.prettierignore' })
.then(({ ignored, inferredParser }) => { .then(({ ignored, inferredParser }) => {
...@@ -100,7 +100,7 @@ const checkFileWithPrettierConfig = filePath => ...@@ -100,7 +100,7 @@ const checkFileWithPrettierConfig = filePath =>
ignoredCount += 1; ignoredCount += 1;
return; return;
} }
return prettier.resolveConfig(filePath).then(fileOptions => { return prettier.resolveConfig(filePath).then((fileOptions) => {
const options = { ...fileOptions, parser: inferredParser }; const options = { ...fileOptions, parser: inferredParser };
return checkFileWithOptions(filePath, options); return checkFileWithOptions(filePath, options);
}); });
...@@ -115,7 +115,7 @@ Promise.all(matchedFiles.map(checkFileWithPrettierConfig)) ...@@ -115,7 +115,7 @@ Promise.all(matchedFiles.map(checkFileWithPrettierConfig))
if (didWarn) process.exit(1); if (didWarn) process.exit(1);
}) })
.catch(e => { .catch((e) => {
console.log(`\nAn error occurred while processing files with prettier: ${e.message}\n`); console.log(`\nAn error occurred while processing files with prettier: ${e.message}\n`);
process.exit(1); process.exit(1);
}); });
...@@ -32,7 +32,7 @@ sass.render( ...@@ -32,7 +32,7 @@ sass.render(
// This suppresses a postcss warning // This suppresses a postcss warning
from: undefined, from: undefined,
}) })
.then(result => { .then((result) => {
const selectorGroups = {}; const selectorGroups = {};
utils.createPropertiesHashmap(result.root, result, null, null, selectorGroups, true); utils.createPropertiesHashmap(result.root, result, null, null, selectorGroups, true);
......
...@@ -9,7 +9,7 @@ module.exports.createPropertiesHashmap = ( ...@@ -9,7 +9,7 @@ module.exports.createPropertiesHashmap = (
selectorGroups, selectorGroups,
addSelectors, addSelectors,
) => { ) => {
ruleRoot.walkRules(rule => { ruleRoot.walkRules((rule) => {
const selector = rule.selector.replace(/(?:\r\n|\r|\n)/g, ' '); const selector = rule.selector.replace(/(?:\r\n|\r|\n)/g, ' ');
if ( if (
......
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