Commit 4ad3f344 authored by Paul Slaughter's avatar Paul Slaughter

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

Format files with prettier arrowParens [7/15]

See merge request gitlab-org/gitlab!50533
parents ff9a62a2 d46581c1
......@@ -848,178 +848,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue
app/assets/javascripts/snippets/components/snippet_header.vue
app/assets/javascripts/snippets/mixins/snippets.js
## lucid-lalande
app/assets/javascripts/snippets/utils/blob.js
app/assets/javascripts/static_site_editor/graphql/index.js
app/assets/javascripts/static_site_editor/graphql/resolvers/file.js
app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js
app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js
app/assets/javascripts/static_site_editor/image_repository.js
app/assets/javascripts/static_site_editor/index.js
app/assets/javascripts/static_site_editor/pages/home.vue
app/assets/javascripts/static_site_editor/services/formatter.js
app/assets/javascripts/static_site_editor/services/front_matterify.js
app/assets/javascripts/static_site_editor/services/image_service.js
app/assets/javascripts/static_site_editor/services/load_source_content.js
app/assets/javascripts/static_site_editor/services/parse_source_file.js
app/assets/javascripts/static_site_editor/services/renderers/render_image.js
app/assets/javascripts/static_site_editor/services/submit_content_changes.js
app/assets/javascripts/static_site_editor/services/templater.js
app/assets/javascripts/task_list.js
app/assets/javascripts/terminal/terminal.js
app/assets/javascripts/terraform/components/terraform_list.vue
app/assets/javascripts/test_utils/simulate_input.js
app/assets/javascripts/toggle_buttons.js
app/assets/javascripts/tooltips/components/tooltips.vue
app/assets/javascripts/tooltips/index.js
app/assets/javascripts/tracking.js
app/assets/javascripts/tree.js
app/assets/javascripts/ui_development_kit.js
app/assets/javascripts/usage_ping_consent.js
app/assets/javascripts/user_callout.js
app/assets/javascripts/user_lists/store/edit/actions.js
app/assets/javascripts/user_lists/store/edit/index.js
app/assets/javascripts/user_lists/store/new/actions.js
app/assets/javascripts/user_lists/store/new/index.js
## nostalgic-morse
app/assets/javascripts/user_lists/store/show/actions.js
app/assets/javascripts/user_lists/store/show/index.js
app/assets/javascripts/user_lists/store/show/mutations.js
app/assets/javascripts/user_popovers.js
app/assets/javascripts/users_select/index.js
app/assets/javascripts/vue_alerts.js
app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue
app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue
app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue
app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue
app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js
app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue
app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue
app/assets/javascripts/vue_merge_request_widget/extensions/issues.js
app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js
app/assets/javascripts/vue_shared/components/actions_button.vue
app/assets/javascripts/vue_shared/components/awards_list.vue
app/assets/javascripts/vue_shared/components/commit.vue
app/assets/javascripts/vue_shared/components/confirm_modal.vue
## thirsty-mccarthy
app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue
app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue
app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_lib.js
app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue
app/assets/javascripts/vue_shared/components/dismissible_container.vue
app/assets/javascripts/vue_shared/components/file_finder/index.vue
app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue
app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js
app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/actions.js
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/branch_token.vue
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/label_token.vue
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue
app/assets/javascripts/vue_shared/components/gfm_autocomplete/gfm_autocomplete.vue
app/assets/javascripts/vue_shared/components/gfm_autocomplete/utils.js
app/assets/javascripts/vue_shared/components/lib/utils/diff_utils.js
app/assets/javascripts/vue_shared/components/markdown/field.vue
app/assets/javascripts/vue_shared/components/markdown/header.vue
app/assets/javascripts/vue_shared/components/markdown/suggestions.vue
app/assets/javascripts/vue_shared/components/modal_copy_button.vue
app/assets/javascripts/vue_shared/components/ordered_layout.vue
app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue
app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/utils.js
app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue
app/assets/javascripts/vue_shared/components/registry/list_item.vue
app/assets/javascripts/vue_shared/components/registry/title_area.vue
app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue
app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_custom_renderer.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/editor_service.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_html_block.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_softbreak.js
app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_utils.js
## practical-wozniak
app/assets/javascripts/vue_shared/components/rich_content_editor/services/sanitize_html.js
app/assets/javascripts/vue_shared/components/select2_select.vue
app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue
app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed.vue
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/getters.js
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js
app/assets/javascripts/vue_shared/components/split_button.vue
app/assets/javascripts/vue_shared/components/tabs/tabs.js
app/assets/javascripts/vue_shared/components/timezone_dropdown.vue
app/assets/javascripts/vue_shared/components/web_ide_link.vue
app/assets/javascripts/vue_shared/directives/autofocusonshow.js
app/assets/javascripts/vue_shared/directives/validation.js
app/assets/javascripts/vue_shared/gl_feature_flags_plugin.js
app/assets/javascripts/vue_shared/mixins/ci_pagination_api_mixin.js
app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue
app/assets/javascripts/vue_shared/security_reports/store/getters.js
app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js
app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js
app/assets/javascripts/vue_shared/security_reports/store/utils.js
app/assets/javascripts/vue_shared/translate.js
app/assets/javascripts/vuex_shared/bindings.js
app/assets/javascripts/whats_new/components/app.vue
app/assets/javascripts/whats_new/index.js
app/assets/javascripts/whats_new/utils/get_drawer_body_height.js
app/assets/javascripts/whats_new/utils/notification.js
app/assets/javascripts/zen_mode.js
config/helpers/is_eslint.js
config/helpers/vendor_dll_hash.js
config/karma.config.js
## frosty-kare
config/plugins/monaco_webpack.js
config/webpack.config.js
ee/app/assets/javascripts/add_gitlab_slack_application/components/add_gitlab_slack_application.vue
ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_app.vue
ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_segment_modal.vue
ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_table.vue
ee/app/assets/javascripts/admin/dev_ops_report/graphql.js
ee/app/assets/javascripts/admin/dev_ops_report/utils/cache_updates.js
ee/app/assets/javascripts/analytics/code_review_analytics/components/app.vue
ee/app/assets/javascripts/analytics/code_review_analytics/components/filter_bar.vue
ee/app/assets/javascripts/analytics/code_review_analytics/filtered_search_code_review_analytics.js
ee/app/assets/javascripts/analytics/code_review_analytics/store/modules/merge_requests/actions.js
ee/app/assets/javascripts/analytics/code_review_analytics/utils.js
ee/app/assets/javascripts/analytics/contribution_analytics/components/column_chart.vue
ee/app/assets/javascripts/analytics/contribution_analytics/contribution_analytics_bundle.js
ee/app/assets/javascripts/analytics/cycle_analytics/components/create_value_stream_form/utils.js
ee/app/assets/javascripts/analytics/cycle_analytics/components/custom_stage_form.vue
ee/app/assets/javascripts/analytics/cycle_analytics/components/filter_bar.vue
ee/app/assets/javascripts/analytics/cycle_analytics/components/stage_dropdown_filter.vue
ee/app/assets/javascripts/analytics/cycle_analytics/components/stage_table_nav.vue
ee/app/assets/javascripts/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue
ee/app/assets/javascripts/analytics/cycle_analytics/components/time_metrics_card.vue
ee/app/assets/javascripts/analytics/cycle_analytics/index.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/getters.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/actions.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/mutations.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart/actions.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart/getters.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/type_of_work/actions.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
## frosty-sammet
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/index.js
ee/app/assets/javascripts/analytics/merge_request_analytics/components/filter_bar.vue
......
......@@ -12,7 +12,7 @@ import { SNIPPET_MARK_BLOBS_CONTENT, SNIPPET_MEASURE_BLOBS_CONTENT } from '~/per
const createLocalId = () => uniqueId('blob_local_');
export const decorateBlob = blob => ({
export const decorateBlob = (blob) => ({
...blob,
id: createLocalId(),
isLoaded: false,
......@@ -54,7 +54,7 @@ const diff = ({ content, path }, origBlob) => {
*/
export const diffAll = (blobs, origBlobs) => {
const deletedEntries = Object.values(origBlobs)
.filter(x => !blobs[x.id])
.filter((x) => !blobs[x.id])
.map(({ path, content }) => ({
action: SNIPPET_BLOB_ACTION_DELETE,
previousPath: path,
......@@ -63,15 +63,15 @@ export const diffAll = (blobs, origBlobs) => {
}));
const newEntries = Object.values(blobs)
.map(blob => diff(blob, origBlobs[blob.id]))
.filter(x => x);
.map((blob) => diff(blob, origBlobs[blob.id]))
.filter((x) => x);
return [...deletedEntries, ...newEntries];
};
export const defaultSnippetVisibilityLevels = arr => {
export const defaultSnippetVisibilityLevels = (arr) => {
if (Array.isArray(arr)) {
return arr.map(l => {
return arr.map((l) => {
const translatedLevel = SNIPPET_LEVELS_MAP[l];
return {
value: translatedLevel,
......
......@@ -8,7 +8,7 @@ import hasSubmittedChangesResolver from './resolvers/has_submitted_changes';
Vue.use(VueApollo);
const createApolloProvider = appData => {
const createApolloProvider = (appData) => {
const defaultClient = createDefaultClient(
{
Project: {
......@@ -26,7 +26,7 @@ const createApolloProvider = appData => {
);
// eslint-disable-next-line @gitlab/require-i18n-strings
const mounts = appData.mounts.map(mount => ({ __typename: 'Mount', ...mount }));
const mounts = appData.mounts.map((mount) => ({ __typename: 'Mount', ...mount }));
defaultClient.cache.writeData({
data: {
......
import loadSourceContent from '../../services/load_source_content';
const fileResolver = ({ fullPath: projectId }, { path: sourcePath }) => {
return loadSourceContent({ projectId, sourcePath }).then(sourceContent => ({
return loadSourceContent({ projectId, sourcePath }).then((sourceContent) => ({
// eslint-disable-next-line @gitlab/require-i18n-strings
__typename: 'File',
...sourceContent,
......
......@@ -4,7 +4,7 @@ import query from '../queries/app_data.query.graphql';
const hasSubmittedChangesResolver = (_, { input: { hasSubmittedChanges } }, { cache }) => {
const oldData = cache.readQuery({ query });
const data = produce(oldData, draftState => {
const data = produce(oldData, (draftState) => {
// punctually modifying draftState as per immer docs upsets our linters
return {
...draftState,
......
......@@ -25,8 +25,8 @@ const submitContentChangesResolver = (
images,
mergeRequestMeta,
formattedMarkdown,
}).then(savedContentMeta => {
const data = produce(savedContentMeta, draftState => {
}).then((savedContentMeta) => {
const data = produce(savedContentMeta, (draftState) => {
return {
savedContentMeta: {
__typename: 'SavedContentMeta',
......
......@@ -4,15 +4,15 @@ import { getBinary } from './services/image_service';
const imageRepository = () => {
const images = new Map();
const flash = message => new Flash(message);
const flash = (message) => new Flash(message);
const add = (file, url) => {
getBinary(file)
.then(content => images.set(url, content))
.then((content) => images.set(url, content))
.catch(() => flash(__('Something went wrong while inserting your image. Please try again.')));
};
const get = path => images.get(path);
const get = (path) => images.get(path);
const getAll = () => images;
......
......@@ -4,7 +4,7 @@ import App from './components/app.vue';
import createRouter from './router';
import createApolloProvider from './graphql';
const initStaticSiteEditor = el => {
const initStaticSiteEditor = (el) => {
const {
isSupportedContent,
path: sourcePath,
......
......@@ -118,7 +118,7 @@ export default {
},
},
})
.catch(e => {
.catch((e) => {
this.submitChangesError = e.message;
})
.finally(() => {
......
......@@ -24,7 +24,7 @@ const nestedLineRegexp = /^\s+/;
* This function attempts to correct this problem before the content is loaded
* by Toast UI.
*/
const correctNestedContentIndenation = source => {
const correctNestedContentIndenation = (source) => {
const lines = source.split('\n');
let topLevelOrderedListDetected = false;
......@@ -40,7 +40,7 @@ const correctNestedContentIndenation = source => {
.join('\n');
};
const removeOrphanedBrTags = source => {
const removeOrphanedBrTags = (source) => {
/* Until the underlying Squire editor of Toast UI Editor resolves duplicate `<br>` tags, this
`replace` solution will clear out orphaned `<br>` tags that it generates. Additionally,
it cleans up orphaned `<br>` tags in the source markdown document that should be new lines.
......@@ -49,7 +49,7 @@ const removeOrphanedBrTags = source => {
return source.replace(/\n^<br>$/gm, '');
};
const format = source => {
const format = (source) => {
return correctNestedContentIndenation(removeOrphanedBrTags(source));
};
......
......@@ -8,7 +8,7 @@ const hasMatter = (firstThreeChars, fourthChar) => {
return isYamlDelimiter && isFourthCharNewline;
};
export const frontMatterify = source => {
export const frontMatterify = (source) => {
let index = 3;
let offset;
const delimiter = source.slice(0, index);
......
export const getBinary = file => {
export const getBinary = (file) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result.split(',')[1]);
reader.onerror = error => reject(error);
reader.onerror = (error) => reject(error);
});
};
import Api from '~/api';
const extractTitle = content => {
const extractTitle = (content) => {
const matches = content.match(/title: (.+)\n/i);
return matches ? Array.from(matches)[1] : '';
......
import { frontMatterify, stringify } from './front_matterify';
const parseSourceFile = raw => {
const parseSourceFile = (raw) => {
let editable;
const syncContent = (newVal, isBody) => {
......@@ -20,7 +20,7 @@ const parseSourceFile = raw => {
const matter = () => editable.matter;
const syncMatter = settings => {
const syncMatter = (settings) => {
editable.matter = settings;
};
......
......@@ -4,16 +4,16 @@ const canRender = ({ type }) => type === 'image';
let metadata;
const getCachedContent = basePath => metadata.imageRepository.get(basePath);
const getCachedContent = (basePath) => metadata.imageRepository.get(basePath);
const isRelativeToCurrentDirectory = basePath => !basePath.startsWith('/');
const isRelativeToCurrentDirectory = (basePath) => !basePath.startsWith('/');
const extractSourceDirectory = url => {
const extractSourceDirectory = (url) => {
const sourceDir = /^(.+)\/([^/]+)$/.exec(url); // Extracts the base path and fileName from an image path
return sourceDir || [null, null, url]; // If no source directory was extracted it means only a fileName was specified (e.g. url='file.png')
};
const parseCurrentDirectory = basePath => {
const parseCurrentDirectory = (basePath) => {
const baseUrl = decodeURIComponent(metadata.baseUrl);
const sourceDirectory = extractSourceDirectory(baseUrl)[1];
const currentDirectory = sourceDirectory.split(`/-/sse/${metadata.branch}`)[1];
......@@ -23,7 +23,7 @@ const parseCurrentDirectory = basePath => {
// For more context around this logic, please see the following comment:
// https://gitlab.com/gitlab-org/gitlab/-/issues/241166#note_409413500
const generateSourceDirectory = basePath => {
const generateSourceDirectory = (basePath) => {
let sourceDir = '';
let defaultSourceDir = '';
......
......@@ -32,7 +32,7 @@ const createImageActions = (images, markdown) => {
}
images.forEach((imageContent, filePath) => {
const imageExistsInMarkdown = path => new RegExp(`!\\[([^[\\]\\n]*)\\](\\(${path})\\)`); // matches the image markdown syntax: ![<any-string-except-newline>](<path>)
const imageExistsInMarkdown = (path) => new RegExp(`!\\[([^[\\]\\n]*)\\](\\(${path})\\)`); // matches the image markdown syntax: ![<any-string-except-newline>](<path>)
if (imageExistsInMarkdown(filePath).test(markdown)) {
actions.push(
......
......@@ -40,10 +40,10 @@ const mark = (source, groups) => {
const hash = {};
Object.entries(groups).forEach(([groupKey, group]) => {
group.forEach(pattern => {
group.forEach((pattern) => {
const matches = text.match(pattern);
if (matches) {
matches.forEach(match => {
matches.forEach((match) => {
const key = `${markPrefix}-${groupKey}-${id}`;
text = text.replace(match, key);
hash[key] = match;
......@@ -67,12 +67,12 @@ const unmark = (text, hash) => {
return source;
};
const unwrap = source => {
const unwrap = (source) => {
let text = source;
const matches = text.match(reTemplated);
if (matches) {
matches.forEach(match => {
matches.forEach((match) => {
const initial = match.replace(`${wrapPrefix}`, '').replace(`${wrapPostfix}`, '');
text = text.replace(match, initial);
});
......@@ -81,7 +81,7 @@ const unwrap = source => {
return text;
};
const wrap = source => {
const wrap = (source) => {
const { text, hash } = mark(unwrap(source), patternGroups);
return unmark(text, hash);
};
......
......@@ -35,7 +35,7 @@ export default class TaskList {
`${this.taskListContainerSelector} .js-task-list-field[data-value]`,
);
taskListFields.forEach(taskListField => {
taskListFields.forEach((taskListField) => {
// eslint-disable-next-line no-param-reassign
taskListField.value = taskListField.dataset.value;
});
......
......@@ -64,11 +64,11 @@ export default class GLTerminal {
const decoder = new TextDecoder('utf-8');
const encoder = new TextEncoder('utf-8');
this.terminal.on('data', data => {
this.terminal.on('data', (data) => {
this.socket.send(encoder.encode(data));
});
this.socket.addEventListener('message', ev => {
this.socket.addEventListener('message', (ev) => {
this.terminal.write(decoder.decode(ev.data));
});
......@@ -110,7 +110,7 @@ export default class GLTerminal {
this.terminal.dispose();
this.socket.close();
this.onDispose.forEach(fn => fn());
this.onDispose.forEach((fn) => fn());
this.onDispose.length = 0;
}
......
......@@ -15,7 +15,7 @@ export default {
...this.cursor,
};
},
update: data => data,
update: (data) => data,
error() {
this.states = null;
},
......
......@@ -12,7 +12,7 @@ export default function simulateInput(target, text) {
}
if (text.length > 0) {
Array.prototype.forEach.call(text, char => {
Array.prototype.forEach.call(text, (char) => {
input.value += char;
triggerEvents(input);
});
......
......@@ -49,7 +49,7 @@ function onToggleClicked(toggle, input, clickCallback) {
export default function setupToggleButtons(container, clickCallback = () => {}) {
const toggles = container.querySelectorAll('.js-project-feature-toggle');
toggles.forEach(toggle => {
toggles.forEach((toggle) => {
const input = toggle.querySelector('.js-project-feature-toggle-input');
const isOn = parseBoolean(input.value);
......
......@@ -2,7 +2,7 @@
import { GlTooltip, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { uniqueId } from 'lodash';
const getTooltipTitle = element => {
const getTooltipTitle = (element) => {
return element.getAttribute('title') || element.dataset.title;
};
......@@ -37,8 +37,8 @@ export default {
};
},
created() {
this.observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
this.observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.removedNodes.forEach(this.dispose);
});
});
......@@ -49,11 +49,11 @@ export default {
methods: {
addTooltips(elements, config) {
const newTooltips = elements
.filter(element => !this.tooltipExists(element))
.map(element => newTooltip(element, config))
.filter(tooltip => tooltip.title);
.filter((element) => !this.tooltipExists(element))
.map((element) => newTooltip(element, config))
.filter((tooltip) => tooltip.title);
newTooltips.forEach(tooltip => this.observe(tooltip));
newTooltips.forEach((tooltip) => this.observe(tooltip));
this.tooltips.push(...newTooltips);
},
......@@ -91,7 +91,7 @@ export default {
return Boolean(this.findTooltipByTarget(element));
},
findTooltipByTarget(element) {
return this.tooltips.find(tooltip => tooltip.target === element);
return this.tooltips.find((tooltip) => tooltip.target === element);
},
},
safeHtmlConfig: {
......
......@@ -81,12 +81,12 @@ const tooltipApiInvoker = ({ glHandler, bsHandler }) => (elements, ...params) =>
export const initTooltips = (config = {}) => {
if (isGlTooltipsEnabled()) {
const triggers = config?.triggers || DEFAULT_TRIGGER;
const events = triggers.split(' ').map(trigger => EVENTS_MAP[trigger]);
const events = triggers.split(' ').map((trigger) => EVENTS_MAP[trigger]);
events.forEach(event => {
events.forEach((event) => {
document.addEventListener(
event,
e => handleTooltipEvent(document, e, config.selector, config),
(e) => handleTooltipEvent(document, e, config.selector, config),
true,
);
});
......@@ -103,28 +103,28 @@ export const add = (elements, config = {}) => {
return invokeBootstrapApi(elements, config);
};
export const dispose = tooltipApiInvoker({
glHandler: element => tooltipsApp().dispose(element),
bsHandler: elements => invokeBootstrapApi(elements, 'dispose'),
glHandler: (element) => tooltipsApp().dispose(element),
bsHandler: (elements) => invokeBootstrapApi(elements, 'dispose'),
});
export const fixTitle = tooltipApiInvoker({
glHandler: element => tooltipsApp().fixTitle(element),
bsHandler: elements => invokeBootstrapApi(elements, '_fixTitle'),
glHandler: (element) => tooltipsApp().fixTitle(element),
bsHandler: (elements) => invokeBootstrapApi(elements, '_fixTitle'),
});
export const enable = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'enable'),
bsHandler: elements => invokeBootstrapApi(elements, 'enable'),
glHandler: (element) => tooltipsApp().triggerEvent(element, 'enable'),
bsHandler: (elements) => invokeBootstrapApi(elements, 'enable'),
});
export const disable = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'disable'),
bsHandler: elements => invokeBootstrapApi(elements, 'disable'),
glHandler: (element) => tooltipsApp().triggerEvent(element, 'disable'),
bsHandler: (elements) => invokeBootstrapApi(elements, 'disable'),
});
export const hide = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'close'),
bsHandler: elements => invokeBootstrapApi(elements, 'hide'),
glHandler: (element) => tooltipsApp().triggerEvent(element, 'close'),
bsHandler: (elements) => invokeBootstrapApi(elements, 'hide'),
});
export const show = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'open'),
bsHandler: elements => invokeBootstrapApi(elements, 'show'),
glHandler: (element) => tooltipsApp().triggerEvent(element, 'open'),
bsHandler: (elements) => invokeBootstrapApi(elements, 'show'),
});
export const destroy = () => {
tooltipsApp().$destroy();
......
......@@ -43,7 +43,7 @@ const eventHandler = (e, func, opts = {}) => {
};
const eventHandlers = (category, func) => {
const handler = opts => e => eventHandler(e, func, { ...{ category }, ...opts });
const handler = (opts) => (e) => eventHandler(e, func, { ...{ category }, ...opts });
const handlers = [];
handlers.push({ name: 'click', func: handler() });
handlers.push({ name: 'show.bs.dropdown', func: handler({ suffix: '_show' }) });
......@@ -79,7 +79,7 @@ export default class Tracking {
parent.trackingBound = true;
const handlers = eventHandlers(category, (...args) => this.event(...args));
handlers.forEach(event => parent.addEventListener(event.name, event.func));
handlers.forEach((event) => parent.addEventListener(event.name, event.func));
return handlers;
}
......@@ -88,7 +88,7 @@ export default class Tracking {
const loadEvents = parent.querySelectorAll('[data-track-event="render"]');
loadEvents.forEach(element => {
loadEvents.forEach((element) => {
const { action, data } = createEventPayload(element);
this.event(category, action, data);
});
......
......@@ -26,7 +26,7 @@ export default class TreeView {
initKeyNav() {
const li = $('tr.tree-item');
let liSelected = null;
return $('body').keydown(e => {
return $('body').keydown((e) => {
let next, path;
if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) {
return false;
......
......@@ -10,19 +10,19 @@ export default () => {
{
order_by: 'last_activity_at',
},
data => {
(data) => {
callback(data);
},
);
},
text: project => project.name_with_namespace || project.name,
text: (project) => project.name_with_namespace || project.name,
selectable: true,
fieldName: 'author_id',
filterable: true,
search: {
fields: ['name_with_namespace'],
},
id: data => data.id,
isSelected: data => data.id === 2,
id: (data) => data.id,
isSelected: (data) => data.id === 2,
});
};
......@@ -5,7 +5,7 @@ import { parseBoolean } from './lib/utils/common_utils';
import { __ } from './locale';
export default () => {
$('body').on('click', '.js-usage-consent-action', e => {
$('body').on('click', '.js-usage-consent-action', (e) => {
e.preventDefault();
e.stopImmediatePropagation(); // overwrite rails listener
......
......@@ -15,7 +15,7 @@ export default class UserCallout {
init() {
if (!this.isCalloutDismissed || this.isCalloutDismissed === 'false') {
this.userCalloutBody.find('.js-close-callout').on('click', e => this.dismissCallout(e));
this.userCalloutBody.find('.js-close-callout').on('click', (e) => this.dismissCallout(e));
}
}
......
......@@ -7,7 +7,7 @@ export const fetchUserList = ({ commit, state }) => {
commit(types.REQUEST_USER_LIST);
return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid)
.then(({ data }) => commit(types.RECEIVE_USER_LIST_SUCCESS, data))
.catch(response => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response)));
.catch((response) => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response)));
};
export const dismissErrorAlert = ({ commit }) => commit(types.DISMISS_ERROR_ALERT);
......@@ -18,5 +18,5 @@ export const updateUserList = ({ commit, state }, userList) => {
name: userList.name,
})
.then(({ data }) => redirectTo(data.path))
.catch(response => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response)));
.catch((response) => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response)));
};
......@@ -3,7 +3,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -11,5 +11,5 @@ export const createUserList = ({ commit, state }, userList) => {
...userList,
})
.then(({ data }) => redirectTo(data.path))
.catch(response => commit(types.RECEIVE_CREATE_USER_LIST_ERROR, getErrorMessages(response)));
.catch((response) => commit(types.RECEIVE_CREATE_USER_LIST_ERROR, getErrorMessages(response)));
};
......@@ -3,7 +3,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -5,7 +5,7 @@ import * as types from './mutation_types';
export const fetchUserList = ({ commit, state }) => {
commit(types.REQUEST_USER_LIST);
return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid)
.then(response => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.then((response) => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.catch(() => commit(types.RECEIVE_USER_LIST_ERROR));
};
......@@ -27,6 +27,6 @@ export const updateUserList = ({ commit, state }) => {
...state.userList,
user_xids: stringifyUserIds(state.userIds),
})
.then(response => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.then((response) => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.catch(() => commit(types.RECEIVE_USER_LIST_ERROR));
};
......@@ -3,7 +3,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -20,10 +20,10 @@ export default {
[types.ADD_USER_IDS](state, ids) {
state.userIds = [
...state.userIds,
...parseUserIds(ids).filter(id => id && !state.userIds.includes(id)),
...parseUserIds(ids).filter((id) => id && !state.userIds.includes(id)),
];
},
[types.REMOVE_USER_ID](state, id) {
state.userIds = state.userIds.filter(uid => uid !== id);
state.userIds = state.userIds.filter((uid) => uid !== id);
},
};
......@@ -5,14 +5,14 @@ import { sanitize } from '~/lib/dompurify';
import UsersCache from './lib/utils/users_cache';
import UserPopover from './vue_shared/components/user_popover/user_popover.vue';
const removeTitle = el => {
const removeTitle = (el) => {
// Removing titles so its not showing tooltips also
el.dataset.originalTitle = '';
el.setAttribute('title', '');
};
const getPreloadedUserInfo = dataset => {
const getPreloadedUserInfo = (dataset) => {
const userId = dataset.user || dataset.userId;
const { username, name, avatarUrl } = dataset;
......@@ -28,7 +28,7 @@ const getPreloadedUserInfo = dataset => {
* Adds a UserPopover component to the body, hands over as much data as the target element has in data attributes.
* loads based on data-user-id more data about a user from the API and sets it on the popover
*/
const populateUserInfo = user => {
const populateUserInfo = (user) => {
const { userId } = user;
return Promise.all([UsersCache.retrieveById(userId), UsersCache.retrieveStatusById(userId)]).then(
......@@ -66,7 +66,7 @@ export default (elements = document.querySelectorAll('.js-user-link')) => {
return userLinks
.filter(({ dataset }) => dataset.user || dataset.userId)
.map(el => {
.map((el) => {
if (initializedPopovers.has(el)) {
return initializedPopovers.get(el);
}
......
......@@ -145,14 +145,14 @@ function UsersSelect(currentUser, els, options = {}) {
};
const getMultiSelectDropdownTitle = function (selectedUser, isSelected) {
const selectedUsers = getSelected().filter(u => u !== 0);
const selectedUsers = getSelected().filter((u) => u !== 0);
const firstUser = getSelectedUserInputs()
.map((index, input) => ({
name: input.dataset.meta,
value: parseInt(input.value, 10),
}))
.filter(u => u.id !== 0)
.filter((u) => u.id !== 0)
.get(0);
if (selectedUsers.length === 0) {
......@@ -160,7 +160,7 @@ function UsersSelect(currentUser, els, options = {}) {
} else if (selectedUsers.length === 1) {
return firstUser.name;
} else if (isSelected) {
const otherSelected = selectedUsers.filter(s => s !== selectedUser.id);
const otherSelected = selectedUsers.filter((s) => s !== selectedUser.id);
return sprintf(s__('UsersSelect|%{name} + %{length} more'), {
name: selectedUser.name,
length: otherSelected.length,
......@@ -172,7 +172,7 @@ function UsersSelect(currentUser, els, options = {}) {
});
};
$assignToMeLink.on('click', e => {
$assignToMeLink.on('click', (e) => {
e.preventDefault();
$(e.currentTarget).hide();
......@@ -196,7 +196,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
});
$block.on('click', '.js-assign-yourself', e => {
$block.on('click', '.js-assign-yourself', (e) => {
e.preventDefault();
return assignTo(userSelect.currentUser.id);
});
......@@ -250,7 +250,7 @@ function UsersSelect(currentUser, els, options = {}) {
return initDeprecatedJQueryDropdown($dropdown, {
showMenuAbove,
data(term, callback) {
return userSelect.users(term, options, users => {
return userSelect.users(term, options, (users) => {
// GitLabDropdownFilter returns this.instance
// GitLabDropdownRemote returns this.options.instance
const deprecatedJQueryDropdown = this.instance || this.options.instance;
......@@ -266,14 +266,14 @@ function UsersSelect(currentUser, els, options = {}) {
// Potential duplicate entries when dealing with issue board
// because issue board is also managed by vue
const selectedUsers = uniqBy(selectedInputs, a => a.value)
.filter(input => {
const selectedUsers = uniqBy(selectedInputs, (a) => a.value)
.filter((input) => {
const userId = parseInt(input.value, 10);
const inUsersArray = users.find(u => u.id === userId);
const inUsersArray = users.find((u) => u.id === userId);
return !inUsersArray && userId !== 0;
})
.map(input => {
.map((input) => {
const userId = parseInt(input.value, 10);
const { avatarUrl, avatar_url, name, username, canMerge } = input.dataset;
return {
......@@ -334,7 +334,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
if ($dropdown.hasClass('js-multiselect')) {
const selected = getSelected().filter(i => i !== 0);
const selected = getSelected().filter((i) => i !== 0);
if (selected.length > 0) {
if ($dropdown.data('dropdownHeader')) {
......@@ -346,12 +346,12 @@ function UsersSelect(currentUser, els, options = {}) {
}
const selectedUsers = users
.filter(u => selected.indexOf(u.id) !== -1)
.filter((u) => selected.indexOf(u.id) !== -1)
.sort((a, b) => a.name > b.name);
users = users.filter(u => selected.indexOf(u.id) === -1);
users = users.filter((u) => selected.indexOf(u.id) === -1);
selectedUsers.forEach(selectedUser => {
selectedUsers.forEach((selectedUser) => {
showDivider += 1;
users.splice(showDivider, 0, selectedUser);
});
......@@ -477,7 +477,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
}
if (getSelected().find(u => u === gon.current_user_id)) {
if (getSelected().find((u) => u === gon.current_user_id)) {
$assignToMeLink.hide();
} else {
$assignToMeLink.show();
......@@ -544,7 +544,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
if (selected.length > 0) {
getSelected().forEach(selectedId => highlightSelected(selectedId));
getSelected().forEach((selectedId) => highlightSelected(selectedId));
} else if ($dropdown.hasClass('js-issue-board-sidebar')) {
highlightSelected(0);
} else {
......@@ -559,7 +559,7 @@ function UsersSelect(currentUser, els, options = {}) {
let selected = false;
if (this.multiSelect) {
selected = getSelected().find(u => user.id === u);
selected = getSelected().find((u) => user.id === u);
const { fieldName } = this;
const field = $dropdown
......@@ -613,7 +613,7 @@ function UsersSelect(currentUser, els, options = {}) {
multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0,
query(query) {
return userSelect.users(query.term, options, users => {
return userSelect.users(query.term, options, (users) => {
let name;
const data = {
results: users,
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import DismissibleAlert from '~/vue_shared/components/dismissible_alert.vue';
const mountVueAlert = el => {
const mountVueAlert = (el) => {
const props = {
html: el.innerHTML,
};
......
......@@ -74,7 +74,7 @@ export default {
return this.mr.approvals || {};
},
approvedBy() {
return this.approvals.approved_by ? this.approvals.approved_by.map(x => x.user) : [];
return this.approvals.approved_by ? this.approvals.approved_by.map((x) => x.user) : [];
},
userHasApproved() {
return Boolean(this.approvals.user_has_approved);
......@@ -136,7 +136,7 @@ export default {
approveWithAuth(data) {
this.updateApproval(
() => this.service.approveMergeRequestWithAuth(data),
error => {
(error) => {
if (error && error.response && error.response.status === 401) {
this.hasApprovalAuthError = true;
return;
......@@ -155,7 +155,7 @@ export default {
this.isApproving = true;
this.clearError();
return serviceFn()
.then(data => {
.then((data) => {
this.mr.setApprovals(data);
eventHub.$emit('MRWidgetUpdateRequested');
this.$emit('updated');
......
......@@ -121,7 +121,7 @@ export default {
this.actionInProgress = actionName;
MRWidgetService.executeInlineAction(endpoint)
.then(resp => {
.then((resp) => {
const redirectUrl = resp?.data?.redirect_url;
if (redirectUrl) {
visitUrl(redirectUrl);
......
......@@ -57,7 +57,7 @@ export default {
return this.deployment.changes && this.deployment.changes.length > 1;
},
filteredChanges() {
return this.deployment?.changes?.filter(change => change.path.includes(this.searchTerm));
return this.deployment?.changes?.filter((change) => change.path.includes(this.searchTerm));
},
},
};
......
......@@ -102,7 +102,7 @@ export default {
loadMetrics() {
backOff((next, stop) => {
MRWidgetService.fetchMetrics(this.metricsUrl)
.then(res => {
.then((res) => {
if (res.status === statusCodes.NO_CONTENT) {
this.backOffRequestCounter += 1;
/* eslint-disable no-unused-expressions */
......@@ -113,14 +113,14 @@ export default {
})
.catch(stop);
})
.then(res => {
.then((res) => {
if (res.status === statusCodes.NO_CONTENT) {
return res;
}
return res.data;
})
.then(data => {
.then((data) => {
this.computeGraphData(data.metrics, data.deployment_time);
return data;
})
......
......@@ -67,11 +67,11 @@ export default {
},
mounted() {
this.fetchCollapsedData(this.$props)
.then(data => {
.then((data) => {
this.collapsedData = data;
this.loadingState = null;
})
.catch(e => {
.catch((e) => {
this.loadingState = LOADING_STATES.collapsedError;
throw e;
});
......@@ -86,11 +86,11 @@ export default {
this.loadingState = LOADING_STATES.expandedLoading;
this.fetchFullData(this.$props)
.then(data => {
.then((data) => {
this.loadingState = null;
this.fullData = data;
})
.catch(e => {
.catch((e) => {
this.loadingState = null;
throw e;
});
......
......@@ -11,7 +11,7 @@ export default {
return h(
'div',
{},
extensions.map(extension =>
extensions.map((extension) =>
h(extension, {
props: extensions[0].props.reduce(
(acc, key) => ({
......
......@@ -3,7 +3,7 @@ import ExtensionBase from './base.vue';
// Holds all the currently registered extensions
export const extensions = [];
export const registerExtension = extension => {
export const registerExtension = (extension) => {
// Pushes into the extenions array a dynamically created Vue component
// that gets exteneded from `base.vue`
extensions.push({
......
......@@ -13,7 +13,7 @@ export default {
type: String,
required: false,
default: DANGER,
validator: value => [WARNING, DANGER].includes(value),
validator: (value) => [WARNING, DANGER].includes(value),
},
helpPath: {
type: String,
......
......@@ -51,8 +51,8 @@ export default {
this.isCancellingAutoMerge = true;
this.service
.cancelAutomaticMerge()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
eventHub.$emit('UpdateWidgetData', data);
})
.catch(() => {
......@@ -70,8 +70,8 @@ export default {
this.isRemovingSourceBranch = true;
this.service
.merge(options)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
if (AUTO_MERGE_STRATEGIES.includes(data.status)) {
eventHub.$emit('MRWidgetUpdateRequested');
}
......
......@@ -30,7 +30,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest.userPermissions,
update: (data) => data.project.mergeRequest.userPermissions,
},
stateData: {
query: conflictsStateQuery,
......@@ -40,7 +40,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest,
update: (data) => data.project.mergeRequest,
},
},
props: {
......
......@@ -83,8 +83,8 @@ export default {
this.service
.removeSourceBranch()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26
// eslint-disable-next-line @gitlab/require-i18n-strings
if (data.message === 'Branch was deleted') {
......
......@@ -25,7 +25,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest,
update: (data) => data.project.mergeRequest,
},
},
props: {
......
......@@ -65,7 +65,7 @@ export default {
.then(() => {
simplePoll(this.checkRebaseStatus);
})
.catch(error => {
.catch((error) => {
this.isMakingRequest = false;
if (error.response && error.response.data && error.response.data.merge_error) {
......@@ -78,8 +78,8 @@ export default {
checkRebaseStatus(continuePolling, stopPolling) {
this.service
.poll()
.then(res => res.data)
.then(res => {
.then((res) => res.data)
.then((res) => {
if (res.rebase_in_progress) {
continuePolling();
} else {
......
......@@ -188,8 +188,8 @@ export default {
this.isMakingRequest = true;
this.service
.merge(options)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
const hasError =
data.status === MERGE_FAILED_STATUS ||
data.status === MERGE_HOOK_VALIDATION_ERROR_STATUS;
......@@ -228,8 +228,8 @@ export default {
handleMergePolling(continuePolling, stopPolling) {
this.service
.poll()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
if (data.state === 'merged') {
// If state is merged we should update the widget and stop the polling
eventHub.$emit('MRWidgetUpdateRequested');
......@@ -270,8 +270,8 @@ export default {
handleRemoveBranchPolling(continuePolling, stopPolling) {
this.service
.poll()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
// If source branch exists then we should continue polling
// because removing a source branch is a background task and takes time
if (data.source_branch_exists) {
......
......@@ -46,7 +46,7 @@ export default {
name="squash"
class="qa-squash-checkbox js-squash-checkbox gl-mb-0 gl-mr-2"
:title="tooltipTitle"
@change="checked => $emit('input', checked)"
@change="(checked) => $emit('input', checked)"
>
{{ $options.i18n.checkboxLabel }}
</gl-form-checkbox>
......
......@@ -29,7 +29,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest.userPermissions,
update: (data) => data.project.mergeRequest.userPermissions,
},
},
props: {
......@@ -86,7 +86,7 @@ export default {
variables: mergeRequestQueryVariables,
});
const data = produce(sourceData, draftState => {
const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign
draftState.project.mergeRequest.workInProgress = workInProgress;
// eslint-disable-next-line no-param-reassign
......@@ -137,8 +137,8 @@ export default {
this.isMakingRequest = true;
this.service
.removeWIP()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
eventHub.$emit('UpdateWidgetData', data);
MergeRequest.toggleDraftStatus(this.mr.title, true);
})
......
......@@ -40,7 +40,7 @@ export default {
);
},
numberOfInvalidPlans() {
return Object.values(this.plansObject).filter(plan => plan.tf_report_error).length;
return Object.values(this.plansObject).filter((plan) => plan.tf_report_error).length;
},
numberOfPlans() {
return Object.keys(this.plansObject).length;
......
......@@ -38,7 +38,7 @@ export default {
.query({ query: issuesQuery, variables: { projectPath: targetProjectFullPath } })
.then(({ data }) => {
// Return some transformed data to be rendered in the expanded state
return data.project.issues.nodes.map(issue => ({
return data.project.issues.nodes.map((issue) => ({
id: issue.id, // Required: The ID of the object
text: issue.title, // Required: The text to get used on each row
// Icon to get rendered on the side of each row
......
......@@ -11,7 +11,7 @@ export default {
}
},
refreshApprovals() {
return this.service.fetchApprovals().then(data => {
return this.service.fetchApprovals().then((data) => {
this.mr.setApprovals(data);
});
},
......
......@@ -358,7 +358,7 @@ export default {
fetchActionsContent() {
this.service
.fetchMergeActionsContent()
.then(res => {
.then((res) => {
if (res.data) {
const el = document.createElement('div');
el.innerHTML = res.data;
......@@ -388,26 +388,26 @@ export default {
this.pollingInterval.stopTimer();
},
bindEventHubListeners() {
eventHub.$on('MRWidgetUpdateRequested', cb => {
eventHub.$on('MRWidgetUpdateRequested', (cb) => {
this.checkStatus(cb);
});
eventHub.$on('MRWidgetRebaseSuccess', cb => {
eventHub.$on('MRWidgetRebaseSuccess', (cb) => {
this.checkStatus(cb, true);
});
// `params` should be an Array contains a Boolean, like `[true]`
// Passing parameter as Boolean didn't work.
eventHub.$on('SetBranchRemoveFlag', params => {
eventHub.$on('SetBranchRemoveFlag', (params) => {
[this.mr.isRemovingSourceBranch] = params;
});
eventHub.$on('FailedToMerge', mergeError => {
eventHub.$on('FailedToMerge', (mergeError) => {
this.mr.state = 'failedToMerge';
this.mr.mergeError = mergeError;
});
eventHub.$on('UpdateWidgetData', data => {
eventHub.$on('UpdateWidgetData', (data) => {
this.mr.setData(data);
});
......
......@@ -60,15 +60,15 @@ export default class MRWidgetService {
}
fetchApprovals() {
return axios.get(this.apiApprovalsPath).then(res => res.data);
return axios.get(this.apiApprovalsPath).then((res) => res.data);
}
approveMergeRequest() {
return axios.post(this.apiApprovePath).then(res => res.data);
return axios.post(this.apiApprovePath).then((res) => res.data);
}
unapproveMergeRequest() {
return axios.post(this.apiUnapprovePath).then(res => res.data);
return axios.post(this.apiUnapprovePath).then((res) => res.data);
}
static executeInlineAction(url) {
......
import { s__, n__ } from '~/locale';
export const title = state => {
export const title = (state) => {
if (state.isLoading) {
return s__('BuildArtifacts|Loading artifacts');
}
......
......@@ -43,7 +43,7 @@ export default {
return this.actions.length > 1;
},
selectedAction() {
return this.actions.find(x => x.key === this.selectedKey) || this.actions[0];
return this.actions.find((x) => x.key === this.selectedKey) || this.actions[0];
},
},
methods: {
......
......@@ -48,7 +48,7 @@ export default {
groupedAwards() {
const { thumbsup, thumbsdown, ...rest } = {
...this.groupedDefaultAwards,
...groupBy(this.awards, x => x.name),
...groupBy(this.awards, (x) => x.name),
};
return [
......@@ -73,7 +73,7 @@ export default {
return false;
}
return awardList.some(award => award.user.id === this.currentUserId);
return awardList.some((award) => award.user.id === this.currentUserId);
},
createAwardList(name, list) {
return {
......@@ -95,11 +95,11 @@ export default {
// Filter myself from list if I am awarded.
if (hasReactionByCurrentUser) {
awardList = awardList.filter(award => award.user.id !== this.currentUserId);
awardList = awardList.filter((award) => award.user.id !== this.currentUserId);
}
// Get only 9-10 usernames to show in tooltip text.
const namesToShow = awardList.slice(0, TOOLTIP_NAME_COUNT).map(award => award.user.name);
const namesToShow = awardList.slice(0, TOOLTIP_NAME_COUNT).map((award) => award.user.name);
// Get the remaining list to use in `and x more` text.
const remainingAwardList = awardList.slice(TOOLTIP_NAME_COUNT, awardList.length);
......
......@@ -54,7 +54,7 @@ export default {
type: Object,
required: false,
default: undefined,
validator: ref =>
validator: (ref) =>
ref === undefined || (Number.isFinite(ref.iid) && isString(ref.path) && !isEmpty(ref.path)),
},
......
......@@ -30,8 +30,8 @@ export default {
};
},
mounted() {
document.querySelectorAll(this.selector).forEach(button => {
button.addEventListener('click', e => {
document.querySelectorAll(this.selector).forEach((button) => {
button.addEventListener('click', (e) => {
e.preventDefault();
this.path = button.dataset.path;
......
......@@ -202,7 +202,7 @@ export default {
<template>
<tooltip-on-truncate
:title="timeWindowText"
:truncate-target="elem => elem.querySelector('.gl-dropdown-toggle-text')"
:truncate-target="(elem) => elem.querySelector('.gl-dropdown-toggle-text')"
placement="top"
class="d-inline-block"
>
......
......@@ -20,12 +20,12 @@ export default {
state: {
default: null,
required: true,
validator: prop => typeof prop === 'boolean' || prop === null,
validator: (prop) => typeof prop === 'boolean' || prop === null,
},
value: {
default: null,
required: false,
validator: prop => typeof prop === 'string' || prop === null,
validator: (prop) => typeof prop === 'string' || prop === null,
},
label: {
type: String,
......
......@@ -25,7 +25,7 @@ export const defaultTimeRanges = [
},
];
export const defaultTimeRange = defaultTimeRanges.find(tr => tr.default);
export const defaultTimeRange = defaultTimeRanges.find((tr) => tr.default);
export const dateFormats = {
/**
......@@ -49,7 +49,7 @@ export const dateFormats = {
* @param {string} value - Value as typed by the user
* @returns true if the value can be parsed as a valid date, false otherwise
*/
export const isValidInputString = value => {
export const isValidInputString = (value) => {
try {
// dateformat throws error that can be caught.
// This is better than using `new Date()`
......
......@@ -21,7 +21,7 @@ export default {
type: String,
required: false,
default: 'md',
validator: value => sizeVariants.includes(value),
validator: (value) => sizeVariants.includes(value),
},
headerTitleText: {
type: String,
......@@ -32,7 +32,7 @@ export default {
type: String,
required: false,
default: 'primary',
validator: value => buttonVariants.includes(value),
validator: (value) => buttonVariants.includes(value),
},
footerPrimaryButtonText: {
type: String,
......
......@@ -22,7 +22,7 @@ export default {
.post(this.path, {
feature_name: this.featureId,
})
.catch(e => {
.catch((e) => {
// eslint-disable-next-line @gitlab/require-i18n-strings, no-console
console.error('Failed to dismiss message.', e);
});
......
......@@ -128,7 +128,7 @@ export default {
this.focusedIndex = 0;
}
Mousetrap.bind(['t', 'mod+p'], e => {
Mousetrap.bind(['t', 'mod+p'], (e) => {
if (e.preventDefault) {
e.preventDefault();
}
......
......@@ -59,7 +59,7 @@ export default {
type: String,
required: false,
default: '',
validator: value => value === '' || /(_desc)|(_asc)/g.test(value),
validator: (value) => value === '' || /(_desc)|(_asc)/g.test(value),
},
showCheckbox: {
type: Boolean,
......@@ -89,7 +89,7 @@ export default {
if (this.initialSortBy) {
selectedSortOption = this.sortOptions
.filter(
sortBy =>
(sortBy) =>
sortBy.sortDirection.ascending === this.initialSortBy ||
sortBy.sortDirection.descending === this.initialSortBy,
)
......@@ -204,12 +204,12 @@ export default {
this.recentSearchesStore = new RecentSearchesStore({
isLocalStorageAvailable: RecentSearchesService.isAvailable(),
allowedKeys: this.tokens.map(token => token.type),
allowedKeys: this.tokens.map((token) => token.type),
});
this.recentSearchesPromise = this.recentSearchesService
.fetch()
.catch(error => {
.catch((error) => {
if (error.name === 'RecentSearchesServiceError') return undefined;
createFlash(__('An error occurred while parsing recent searches'));
......@@ -217,7 +217,7 @@ export default {
// Gracefully fail to empty array
return [];
})
.then(searches => {
.then((searches) => {
if (!searches) return;
// Put any searches that may have come in before
......@@ -250,7 +250,7 @@ export default {
* spaces.
*/
removeQuotesEnclosure(filters = []) {
return filters.map(filter => {
return filters.map((filter) => {
if (typeof filter === 'object') {
const valueString = filter.value.data;
return {
......@@ -305,8 +305,8 @@ export default {
},
historyTokenOptionTitle(historyToken) {
const tokenOption = this.tokens
.find(token => token.type === historyToken.type)
?.options?.find(option => option.value === historyToken.value.data);
.find((token) => token.type === historyToken.type)
?.options?.find((option) => option.value === historyToken.value.data);
if (!tokenOption?.title) {
return historyToken.value.data;
......
......@@ -8,7 +8,7 @@ import { queryToObject } from '~/lib/utils/url_utility';
*
* @returns {String} String without any enclosure
*/
export const stripQuotes = value => value.replace(/^('|")(.*)('|")$/, '$2');
export const stripQuotes = (value) => value.replace(/^('|")(.*)('|")$/, '$2');
/**
* This method removes duplicate tokens from tokens array.
......@@ -17,7 +17,7 @@ export const stripQuotes = value => value.replace(/^('|")(.*)('|")$/, '$2');
*
* @returns {Array} Unique array of tokens
*/
export const uniqueTokens = tokens => {
export const uniqueTokens = (tokens) => {
const knownTokens = [];
return tokens.reduce((uniques, token) => {
if (typeof token === 'object' && token.type !== 'filtered-search-term') {
......@@ -61,7 +61,7 @@ export function prepareTokens(filters = {}) {
return memo;
}
if (Array.isArray(value)) {
return [...memo, ...value.map(filterValue => createToken(key, filterValue))];
return [...memo, ...value.map((filterValue) => createToken(key, filterValue))];
}
return [...memo, createToken(key, value)];
......@@ -99,8 +99,8 @@ export function filterToQueryObject(filters = {}) {
let selected;
let unselected;
if (Array.isArray(filter)) {
selected = filter.filter(item => item.operator === '=').map(item => item.value);
unselected = filter.filter(item => item.operator === '!=').map(item => item.value);
selected = filter.filter((item) => item.operator === '=').map((item) => item.value);
unselected = filter.filter((item) => item.operator === '!=').map((item) => item.value);
} else {
selected = filter?.operator === '=' ? filter.value : null;
unselected = filter?.operator === '!=' ? filter.value : null;
......@@ -155,7 +155,7 @@ export function urlQueryToFilter(query = '') {
previousValues = memo[filterName];
}
if (Array.isArray(value)) {
const newAdditions = value.filter(Boolean).map(item => ({ value: item, operator }));
const newAdditions = value.filter(Boolean).map((item) => ({ value: item, operator }));
return { ...memo, [filterName]: [...previousValues, ...newAdditions] };
}
......
......@@ -17,7 +17,7 @@ export function fetchBranches({ commit, state }, search = '') {
commit(types.REQUEST_BRANCHES);
return Api.branches(projectEndpoint, search)
.then(response => {
.then((response) => {
commit(types.RECEIVE_BRANCHES_SUCCESS, response.data);
return response;
})
......@@ -34,7 +34,7 @@ export const fetchMilestones = ({ commit, state }, search_title = '') => {
return axios
.get(milestonesEndpoint, { params: { search_title } })
.then(response => {
.then((response) => {
commit(types.RECEIVE_MILESTONES_SUCCESS, response.data);
return response;
})
......@@ -50,7 +50,7 @@ export const fetchLabels = ({ commit, state }, search = '') => {
return axios
.get(state.labelsEndpoint, { params: { search } })
.then(response => {
.then((response) => {
commit(types.RECEIVE_LABELS_SUCCESS, response.data);
return response;
})
......@@ -67,13 +67,13 @@ function fetchUser(options = {}) {
let fetchUserPromise;
if (projectEndpoint) {
fetchUserPromise = Api.projectUsers(projectEndpoint, query).then(data => ({ data }));
fetchUserPromise = Api.projectUsers(projectEndpoint, query).then((data) => ({ data }));
} else {
fetchUserPromise = Api.groupMembers(groupEndpoint, { query });
}
return fetchUserPromise
.then(response => {
.then((response) => {
commit(`RECEIVE_${action}_SUCCESS`, response.data);
return response;
})
......
......@@ -43,7 +43,7 @@ export default {
return this.value.data.toLowerCase();
},
activeAuthor() {
return this.authors.find(author => author.username.toLowerCase() === this.currentValue);
return this.authors.find((author) => author.username.toLowerCase() === this.currentValue);
},
},
watch: {
......@@ -63,7 +63,7 @@ export default {
: this.config.fetchAuthors(searchTerm);
fetchPromise
.then(res => {
.then((res) => {
// We'd want to avoid doing this check but
// users.json and /groups/:id/members & /projects/:id/users
// return response differently.
......
......@@ -43,7 +43,7 @@ export default {
return this.value.data.toLowerCase();
},
activeBranch() {
return this.branches.find(branch => branch.name.toLowerCase() === this.currentValue);
return this.branches.find((branch) => branch.name.toLowerCase() === this.currentValue);
},
},
watch: {
......
......@@ -47,7 +47,7 @@ export default {
},
activeLabel() {
return this.labels.find(
label => label.title.toLowerCase() === stripQuotes(this.currentValue),
(label) => label.title.toLowerCase() === stripQuotes(this.currentValue),
);
},
containerStyle() {
......@@ -74,7 +74,7 @@ export default {
this.loading = true;
this.config
.fetchLabels(searchTerm)
.then(res => {
.then((res) => {
// We'd want to avoid doing this check but
// labels.json and /groups/:id/labels & /projects/:id/labels
// return response differently.
......
......@@ -43,7 +43,7 @@ export default {
},
activeMilestone() {
return this.milestones.find(
milestone => milestone.title.toLowerCase() === stripQuotes(this.currentValue),
(milestone) => milestone.title.toLowerCase() === stripQuotes(this.currentValue),
);
},
},
......
......@@ -28,7 +28,7 @@ export default {
},
computed: {
config() {
return this.autocompleteTypes.map(type => ({
return this.autocompleteTypes.map((type) => ({
...tributeConfig[type].config,
loadingItemTemplate: `<span class="gl-spinner gl-vertical-align-text-bottom gl-ml-3 gl-mr-2"></span>${__(
'Loading',
......@@ -56,7 +56,7 @@ export default {
if (!this.assignees || !isAssigneesLengthSame) {
this.assignees =
SidebarMediator.singleton?.store?.assignees?.map(assignee => assignee.username) || [];
SidebarMediator.singleton?.store?.assignees?.map((assignee) => assignee.username) || [];
}
},
filterValues(type) {
......@@ -88,7 +88,7 @@ export default {
} else if (this.dataSources[type]) {
axios
.get(this.dataSources[type])
.then(response => {
.then((response) => {
this.cache[type] = response.data;
processValues(this.filterValues(type));
})
......
......@@ -27,7 +27,7 @@ export const tributeConfig = {
[GfmAutocompleteType.Emojis]: {
config: {
trigger: ':',
lookup: value => value,
lookup: (value) => value,
menuItemTemplate: ({ original }) => `${original} ${Emoji.glEmojiTag(original)}`,
selectTemplate: ({ original }) => `:${original}:`,
},
......@@ -36,7 +36,7 @@ export const tributeConfig = {
[GfmAutocompleteType.Issues]: {
config: {
trigger: '#',
lookup: value => `${value.iid}${value.title}`,
lookup: (value) => `${value.iid}${value.title}`,
menuItemTemplate: ({ original }) =>
`<small>${original.reference || original.iid}</small> ${escape(original.title)}`,
selectTemplate: ({ original }) => original.reference || `#${original.iid}`,
......@@ -57,11 +57,11 @@ export const tributeConfig = {
},
filterValues({ collection, fullText, selectionStart }) {
if (doesCurrentLineStartWith('/label', fullText, selectionStart)) {
return collection.filter(label => !label.set);
return collection.filter((label) => !label.set);
}
if (doesCurrentLineStartWith('/unlabel', fullText, selectionStart)) {
return collection.filter(label => label.set);
return collection.filter((label) => label.set);
}
return collection;
......@@ -72,7 +72,7 @@ export const tributeConfig = {
config: {
trigger: '@',
fillAttr: 'username',
lookup: value =>
lookup: (value) =>
value.type === groupType ? last(value.name.split(' / ')) : `${value.name}${value.username}`,
menuItemTemplate: ({ original }) => {
const commonClasses = 'gl-avatar gl-avatar-s24 gl-flex-shrink-0';
......@@ -113,11 +113,11 @@ export const tributeConfig = {
},
filterValues({ assignees, collection, fullText, selectionStart }) {
if (doesCurrentLineStartWith('/assign', fullText, selectionStart)) {
return collection.filter(member => !assignees.includes(member.username));
return collection.filter((member) => !assignees.includes(member.username));
}
if (doesCurrentLineStartWith('/unassign', fullText, selectionStart)) {
return collection.filter(member => assignees.includes(member.username));
return collection.filter((member) => assignees.includes(member.username));
}
return collection;
......@@ -127,7 +127,7 @@ export const tributeConfig = {
[GfmAutocompleteType.MergeRequests]: {
config: {
trigger: '!',
lookup: value => `${value.iid}${value.title}`,
lookup: (value) => `${value.iid}${value.title}`,
menuItemTemplate: ({ original }) =>
`<small>${original.reference || original.iid}</small> ${escape(original.title)}`,
selectTemplate: ({ original }) => original.reference || `!${original.iid}`,
......@@ -147,7 +147,7 @@ export const tributeConfig = {
config: {
trigger: '/',
fillAttr: 'name',
lookup: value => `${value.name}${value.aliases.join()}`,
lookup: (value) => `${value.name}${value.aliases.join()}`,
menuItemTemplate: ({ original }) => {
const aliases = original.aliases.length
? `<small>(or /${original.aliases.join(', /')})</small>`
......@@ -175,7 +175,7 @@ export const tributeConfig = {
config: {
trigger: '$',
fillAttr: 'id',
lookup: value => `${value.id}${value.title}`,
lookup: (value) => `${value.id}${value.title}`,
menuItemTemplate: ({ original }) => `<small>${original.id}</small> ${escape(original.title)}`,
},
},
......
......@@ -15,5 +15,5 @@ function cleanSuggestionLine(line = {}) {
}
export function selectDiffLines(lines) {
return lines.filter(line => line.type !== 'match').map(line => cleanSuggestionLine(line));
return lines.filter((line) => line.type !== 'match').map((line) => cleanSuggestionLine(line));
}
......@@ -158,7 +158,7 @@ export default {
const mediaInPreview = this.$refs['markdown-preview'].querySelectorAll('video, audio');
if (mediaInPreview) {
mediaInPreview.forEach(media => {
mediaInPreview.forEach((media) => {
media.pause();
});
}
......@@ -199,7 +199,7 @@ export default {
this.markdownPreview = __('Loading…');
axios
.post(this.markdownPreviewPath, { text: this.textareaValue })
.then(response => this.renderMarkdown(response.data))
.then((response) => this.renderMarkdown(response.data))
.catch(() => new Flash(__('Error loading markdown preview')));
} else {
this.renderMarkdown();
......
......@@ -110,7 +110,7 @@ export default {
const area = this.$el.parentNode.querySelector('textarea');
CopyAsGFM.nodeToGFM(transformed)
.then(gfm => {
.then((gfm) => {
CopyAsGFM.insertPastedText(area, documentFragment.textContent, CopyAsGFM.quoted(gfm));
})
.catch(() => {});
......
......@@ -98,11 +98,11 @@ export default {
this.$emit('applyBatch', { flashContainer: this.$el });
});
suggestionDiff.$on('addToBatch', suggestionId => {
suggestionDiff.$on('addToBatch', (suggestionId) => {
this.$emit('addToBatch', suggestionId);
});
suggestionDiff.$on('removeFromBatch', suggestionId => {
suggestionDiff.$on('removeFromBatch', (suggestionId) => {
this.$emit('removeFromBatch', suggestionId);
});
......
......@@ -70,14 +70,14 @@ export default {
document.body,
});
this.clipboard
.on('success', e => {
.on('success', (e) => {
this.$root.$emit('bv::hide::tooltip', this.id);
this.$emit('success', e);
// Clear the selection and blur the trigger so it loses its border
e.clearSelection();
e.trigger.blur();
})
.on('error', e => this.$emit('error', e));
.on('error', (e) => this.$emit('error', e));
});
},
destroyed() {
......
......@@ -4,7 +4,7 @@ export default {
render(h, context) {
const { slotKeys } = context.props;
const slots = context.slots();
const children = slotKeys.map(key => slots[key]).filter(x => x);
const children = slotKeys.map((key) => slots[key]).filter((x) => x);
return children;
},
......
......@@ -203,7 +203,7 @@ export default {
this.resetPagination();
const filterParams = { authorUsername: '', assigneeUsername: '', search: '' };
filters.forEach(filter => {
filters.forEach((filter) => {
if (typeof filter === 'object') {
switch (filter.type) {
case 'author_username':
......
......@@ -6,6 +6,6 @@ import { __ } from '~/locale';
* @param {String} value
* @returns {String}
*/
export const isAny = value => {
export const isAny = (value) => {
return value === __('Any') ? '' : value;
};
......@@ -13,7 +13,7 @@ export default {
project: {
type: Object,
required: true,
validator: p =>
validator: (p) =>
(Number.isFinite(p.id) || isString(p.id)) &&
isString(p.name) &&
(isString(p.name_with_namespace) || isString(p.nameWithNamespace)),
......
......@@ -39,7 +39,7 @@ export default {
},
},
mounted() {
this.detailsSlots = Object.keys(this.$slots).filter(k => k.startsWith('details-'));
this.detailsSlots = Object.keys(this.$slots).filter((k) => k.startsWith('details-'));
},
methods: {
toggleDetails() {
......
......@@ -38,11 +38,11 @@ export default {
},
async mounted() {
const METADATA_PREFIX = 'metadata-';
this.metadataSlots = Object.keys(this.$slots).filter(k => k.startsWith(METADATA_PREFIX));
this.metadataSlots = Object.keys(this.$slots).filter((k) => k.startsWith(METADATA_PREFIX));
// we need to wait for next tick to ensure that dynamic names slots are picked up
await this.$nextTick();
this.metadataSlots = Object.keys(this.$slots).filter(k => k.startsWith(METADATA_PREFIX));
this.metadataSlots = Object.keys(this.$slots).filter((k) => k.startsWith(METADATA_PREFIX));
},
};
</script>
......
......@@ -20,7 +20,7 @@ export default {
components: {
ToastEditor: () =>
import(/* webpackChunkName: 'toast_editor' */ '@toast-ui/vue-editor').then(
toast => toast.Editor,
(toast) => toast.Editor,
),
AddImageModal,
InsertVideoModal,
......
......@@ -17,12 +17,12 @@ const listItemRenderers = [renderListItem];
const softbreakRenderers = [renderSoftbreak];
const executeRenderer = (renderers, node, context) => {
const availableRenderer = renderers.find(renderer => renderer.canRender(node, context));
const availableRenderer = renderers.find((renderer) => renderer.canRender(node, context));
return availableRenderer ? availableRenderer.render(node, context) : context.origin();
};
const buildCustomHTMLRenderer = customRenderers => {
const buildCustomHTMLRenderer = (customRenderers) => {
const renderersByType = {
...customRenderers,
htmlBlock: union(htmlBlockRenderers, customRenderers?.htmlBlock),
......@@ -34,7 +34,7 @@ const buildCustomHTMLRenderer = customRenderers => {
softbreak: union(softbreakRenderers, customRenderers?.softbreak),
};
return mapValues(renderersByType, renderers => {
return mapValues(renderersByType, (renderers) => {
return (node, context) => executeRenderer(renderers, node, context);
});
};
......
......@@ -9,7 +9,7 @@ const DEFAULTS = {
emphasis: '_',
};
const countIndentSpaces = text => {
const countIndentSpaces = (text) => {
const matches = text.match(/^\s+/m);
return matches ? matches[0].length : 0;
......@@ -52,7 +52,7 @@ const buildHTMLToMarkdownRender = (baseRenderer, formattingPreferences = {}) =>
const firstLevelIndentSpacesCount = countIndentSpaces(baseResult) || 1;
const reindentedList = baseResult
.split('\n')
.map(line => {
.map((line) => {
const itemIndentSpacesCount = countIndentSpaces(line);
const nestingLevel = Math.ceil(itemIndentSpacesCount / firstLevelIndentSpacesCount);
const indentSpaces = repeat(' ', subListIndentSpaces * nestingLevel);
......
......@@ -6,7 +6,7 @@ import buildCustomHTMLRenderer from './build_custom_renderer';
import { TOOLBAR_ITEM_CONFIGS, VIDEO_ATTRIBUTES } from '../constants';
import sanitizeHTML from './sanitize_html';
const buildWrapper = propsData => {
const buildWrapper = (propsData) => {
const instance = new Vue({
render(createElement) {
return createElement(ToolbarItem, propsData);
......@@ -17,7 +17,7 @@ const buildWrapper = propsData => {
return instance.$el;
};
const buildVideoIframe = src => {
const buildVideoIframe = (src) => {
const wrapper = document.createElement('figure');
const iframe = document.createElement('iframe');
const videoAttributes = { ...VIDEO_ATTRIBUTES, src };
......@@ -48,7 +48,7 @@ const buildImg = (alt, originalSrc, file) => {
return img;
};
export const generateToolbarItem = config => {
export const generateToolbarItem = (config) => {
const { icon, classes, event, command, tooltip, isDivider } = config;
if (isDivider) {
......@@ -92,14 +92,14 @@ export const insertVideo = ({ editor }, url) => {
}
};
export const getMarkdown = editorInstance => editorInstance.invoke('getMarkdown');
export const getMarkdown = (editorInstance) => editorInstance.invoke('getMarkdown');
/**
* This function allow us to extend Toast UI HTML to Markdown renderer. It is
* a temporary measure because Toast UI does not provide an API
* to achieve this goal.
*/
export const registerHTMLToMarkdownRenderer = editorApi => {
export const registerHTMLToMarkdownRenderer = (editorApi) => {
const { renderer } = editorApi.toMarkOptions;
Object.assign(editorApi.toMarkOptions, {
......@@ -107,10 +107,10 @@ export const registerHTMLToMarkdownRenderer = editorApi => {
});
};
export const getEditorOptions = externalOptions => {
export const getEditorOptions = (externalOptions) => {
return defaults({
customHTMLRenderer: buildCustomHTMLRenderer(externalOptions?.customRenderers),
toolbarItems: TOOLBAR_ITEM_CONFIGS.map(toolbarItem => generateToolbarItem(toolbarItem)),
customHTMLSanitizer: html => sanitizeHTML(html),
toolbarItems: TOOLBAR_ITEM_CONFIGS.map((toolbarItem) => generateToolbarItem(toolbarItem)),
customHTMLSanitizer: (html) => sanitizeHTML(html),
});
};
......@@ -32,20 +32,20 @@ export const buildUneditableCloseTokens = (token, tagType = TAG_TYPES.block) =>
// Complete helpers (open plus close)
export const buildTextToken = content => buildToken('text', null, { content });
export const buildTextToken = (content) => buildToken('text', null, { content });
export const buildUneditableBlockTokens = token => {
export const buildUneditableBlockTokens = (token) => {
return [...buildUneditableOpenTokens(token), buildUneditableCloseToken()];
};
export const buildUneditableInlineTokens = token => {
export const buildUneditableInlineTokens = (token) => {
return [
...buildUneditableOpenTokens(token, TAG_TYPES.inline),
buildUneditableCloseToken(TAG_TYPES.inline),
];
};
export const buildUneditableHtmlAsTextTokens = node => {
export const buildUneditableHtmlAsTextTokens = (node) => {
/*
Toast UI internally appends ' data-tomark-pass ' attribute flags so it can target certain
nested nodes for internal use during Markdown <=> WYSIWYG conversions. In our case, we want
......
......@@ -2,7 +2,7 @@ import { buildUneditableHtmlAsTextTokens } from './build_uneditable_token';
import { ALLOWED_VIDEO_ORIGINS } from '../../constants';
import { getURLOrigin } from '~/lib/utils/url_utility';
const isVideoFrame = html => {
const isVideoFrame = (html) => {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const {
......@@ -18,6 +18,6 @@ const canRender = ({ type, literal }) => {
return type === 'htmlBlock' && !isVideoFrame(literal);
};
const render = node => buildUneditableHtmlAsTextTokens(node);
const render = (node) => buildUneditableHtmlAsTextTokens(node);
export default { canRender, render };
......@@ -17,7 +17,7 @@ Regexp notes:
*/
const identifierInstanceRegex = /((?:\[.+?\]){1}(?:\[\]|\[.+?\])?(?!:))/g;
const isIdentifierInstance = literal => {
const isIdentifierInstance = (literal) => {
// Reset lastIndex as global flag in regexp are stateful (https://stackoverflow.com/a/11477448)
identifierInstanceRegex.lastIndex = 0;
return identifierInstanceRegex.test(literal);
......@@ -25,9 +25,9 @@ const isIdentifierInstance = literal => {
const canRender = ({ literal }) => isIdentifierInstance(literal);
const tokenize = text => {
const tokenize = (text) => {
const matches = text.split(identifierInstanceRegex);
const tokens = matches.map(match => {
const tokens = matches.map((match) => {
const token = buildTextToken(match);
return isIdentifierInstance(match) ? buildUneditableInlineTokens(token) : token;
});
......
const identifierRegex = /(^\[.+\]: .+)/;
const isIdentifier = text => {
const isIdentifier = (text) => {
return identifierRegex.test(text);
};
......
const canRender = node => ['emph', 'strong'].includes(node.parent?.type);
const canRender = (node) => ['emph', 'strong'].includes(node.parent?.type);
const render = () => ({
type: 'text',
content: ' ',
......
......@@ -11,9 +11,9 @@ export const renderUneditableBranch = (_, { entering, origin }) =>
const attributeDefinitionRegexp = /(^{:.+}$)/;
export const isAttributeDefinition = text => attributeDefinitionRegexp.test(text);
export const isAttributeDefinition = (text) => attributeDefinitionRegexp.test(text);
const findAttributeDefinition = node => {
const findAttributeDefinition = (node) => {
const literal =
node?.next?.firstChild?.literal || node?.firstChild?.firstChild?.next?.next?.literal; // for headings // for list items;
......
......@@ -5,7 +5,7 @@ import { getURLOrigin } from '~/lib/utils/url_utility';
const sanitizer = createSanitizer(window);
const ADD_TAGS = ['iframe'];
sanitizer.addHook('uponSanitizeElement', node => {
sanitizer.addHook('uponSanitizeElement', (node) => {
if (node.tagName !== 'IFRAME') {
return;
}
......@@ -17,6 +17,6 @@ sanitizer.addHook('uponSanitizeElement', node => {
}
});
const sanitize = content => sanitizer.sanitize(content, { ADD_TAGS });
const sanitize = (content) => sanitizer.sanitize(content, { ADD_TAGS });
export default sanitize;
......@@ -26,7 +26,7 @@ export default {
$(this.$refs.dropdownInput)
.val(this.value)
.select2(this.options)
.on('change', event => this.$emit('input', event.target.value));
.on('change', (event) => this.$emit('input', event.target.value));
})
.catch(() => {});
},
......
......@@ -18,7 +18,7 @@ export default {
},
created() {
const rawLabelsColors = gon.suggested_label_colors;
this.suggestedColors = Object.keys(rawLabelsColors).map(colorCode => ({
this.suggestedColors = Object.keys(rawLabelsColors).map((colorCode) => ({
colorCode,
title: rawLabelsColors[colorCode],
}));
......
......@@ -20,7 +20,7 @@ export default {
const labelsString = this.labels.length
? this.labels
.slice(0, 5)
.map(label => label.title)
.map((label) => label.title)
.join(', ')
: s__('LabelSelect|Labels');
......
......@@ -25,7 +25,7 @@ export default {
},
suggestedColors() {
const colorsMap = gon.suggested_label_colors;
return Object.keys(colorsMap).map(color => ({ [color]: colorsMap[color] }));
return Object.keys(colorsMap).map((color) => ({ [color]: colorsMap[color] }));
},
},
methods: {
......
......@@ -182,9 +182,9 @@ export default {
!state.showDropdownButton &&
!state.showDropdownContents
) {
let filterFn = label => label.touched;
let filterFn = (label) => label.touched;
if (this.isDropdownVariantEmbedded) {
filterFn = label => label.set;
filterFn = (label) => label.set;
}
this.handleDropdownClose(state.labels.filter(filterFn));
}
......@@ -204,13 +204,13 @@ export default {
'js-btn-cancel-create',
'js-sidebar-dropdown-toggle',
].some(
className =>
(className) =>
target?.classList.contains(className) ||
target?.parentElement?.classList.contains(className),
);
const hadExceptionParent = ['.js-btn-back', '.js-labels-list'].some(
className => $(target).parents(className).length,
(className) => $(target).parents(className).length,
);
if (
......
......@@ -9,7 +9,7 @@ import { DropdownVariant } from '../constants';
*/
export const dropdownButtonText = (state, getters) => {
const selectedLabels = getters.isDropdownVariantSidebar
? state.labels.filter(label => label.set)
? state.labels.filter((label) => label.set)
: state.selectedLabels;
if (!selectedLabels.length) {
......@@ -28,25 +28,25 @@ export const dropdownButtonText = (state, getters) => {
* selectedLabels array.
* @param {object} state
*/
export const selectedLabelsList = state => state.selectedLabels.map(label => label.id);
export const selectedLabelsList = (state) => state.selectedLabels.map((label) => label.id);
/**
* Returns boolean representing whether dropdown variant
* is `sidebar`
* @param {object} state
*/
export const isDropdownVariantSidebar = state => state.variant === DropdownVariant.Sidebar;
export const isDropdownVariantSidebar = (state) => state.variant === DropdownVariant.Sidebar;
/**
* Returns boolean representing whether dropdown variant
* is `standalone`
* @param {object} state
*/
export const isDropdownVariantStandalone = state => state.variant === DropdownVariant.Standalone;
export const isDropdownVariantStandalone = (state) => state.variant === DropdownVariant.Standalone;
/**
* Returns boolean representing whether dropdown variant
* is `embedded`
* @param {object} state
*/
export const isDropdownVariantEmbedded = state => state.variant === DropdownVariant.Embedded;
export const isDropdownVariantEmbedded = (state) => state.variant === DropdownVariant.Embedded;
......@@ -33,7 +33,7 @@ export default {
// Iterate over every label and add a `set` prop
// to determine whether it is already a part of
// selectedLabels array.
const selectedLabelIds = state.selectedLabels.map(label => label.id);
const selectedLabelIds = state.selectedLabels.map((label) => label.id);
state.labelsFetchInProgress = false;
state.labels = labels.reduce((allLabels, label) => {
allLabels.push({
......@@ -61,7 +61,7 @@ export default {
// Find the label to update from all the labels
// and change `set` prop value to represent their current state.
const labelId = labels.pop()?.id;
const candidateLabel = state.labels.find(label => labelId === label.id);
const candidateLabel = state.labels.find((label) => labelId === label.id);
if (candidateLabel) {
candidateLabel.touched = true;
candidateLabel.set = !candidateLabel.set;
......
......@@ -2,7 +2,7 @@
import { isString } from 'lodash';
import { GlDropdown, GlDropdownDivider, GlDropdownItem } from '@gitlab/ui';
const isValidItem = item =>
const isValidItem = (item) =>
isString(item.eventName) && isString(item.title) && isString(item.description);
export default {
......
......@@ -17,8 +17,8 @@ export default {
},
methods: {
updateTabs() {
this.tabs = this.$children.filter(child => child.isTab);
this.currentIndex = this.tabs.findIndex(tab => tab.localActive);
this.tabs = this.$children.filter((child) => child.isTab);
this.currentIndex = this.tabs.findIndex((tab) => tab.localActive);
},
setTab(e, index) {
if (this.stopPropagation) {
......@@ -48,7 +48,7 @@ export default {
href: '#',
},
on: {
click: e => this.setTab(e, i),
click: (e) => this.setTab(e, i),
},
},
tab.$slots.title || tab.title,
......
......@@ -36,14 +36,14 @@ export default {
},
computed: {
timezones() {
return this.timezoneData.map(timezone => ({
return this.timezoneData.map((timezone) => ({
formattedTimezone: this.formatTimezone(timezone),
identifier: timezone.identifier,
}));
},
filteredResults() {
const lowerCasedSearchTerm = this.searchTerm.toLowerCase();
return this.timezones.filter(timezone =>
return this.timezones.filter((timezone) =>
timezone.formattedTimezone.toLowerCase().includes(lowerCasedSearchTerm),
);
},
......
......@@ -72,7 +72,7 @@ export default {
},
computed: {
actions() {
return [this.webIdeAction, this.editAction, this.gitpodAction].filter(action => action);
return [this.webIdeAction, this.editAction, this.gitpodAction].filter((action) => action);
},
editAction() {
if (!this.showEditButton) {
......
......@@ -11,8 +11,8 @@ export default {
inserted(el) {
if ('IntersectionObserver' in window) {
// Element visibility is dynamic, so we attach observer
el.visibilityObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
el.visibilityObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
// Combining `intersectionRatio > 0` and
// element's `offsetParent` presence will
// deteremine if element is truely visible
......
......@@ -12,19 +12,19 @@ import { s__ } from '~/locale';
*/
const defaultFeedbackMap = {
valueMissing: {
isInvalid: el => el.validity?.valueMissing,
isInvalid: (el) => el.validity?.valueMissing,
message: s__('Please fill out this field.'),
},
urlTypeMismatch: {
isInvalid: el => el.type === 'url' && el.validity?.typeMismatch,
isInvalid: (el) => el.type === 'url' && el.validity?.typeMismatch,
message: s__('Please enter a valid URL format, ex: http://www.example.com/home'),
},
};
const getFeedbackForElement = (feedbackMap, el) =>
Object.values(feedbackMap).find(f => f.isInvalid(el))?.message || el.validationMessage;
Object.values(feedbackMap).find((f) => f.isInvalid(el))?.message || el.validationMessage;
const focusFirstInvalidInput = e => {
const focusFirstInvalidInput = (e) => {
const { target: formEl } = e;
const invalidInput = formEl.querySelector('input:invalid');
......@@ -33,7 +33,7 @@ const focusFirstInvalidInput = e => {
}
};
const isEveryFieldValid = form => Object.values(form.fields).every(({ state }) => state === true);
const isEveryFieldValid = (form) => Object.values(form.fields).every(({ state }) => state === true);
const createValidator = (context, feedbackMap) => ({ el, reportInvalidInput = false }) => {
const { form } = context;
......
export default Vue => {
export default (Vue) => {
Vue.mixin({
provide: {
glFeatures: { ...((window.gon && window.gon.features) || {}) },
......
......@@ -48,7 +48,7 @@ export default {
this.poll.stop();
const queryString = Object.keys(parameters)
.map(parameter => {
.map((parameter) => {
const value = parameters[parameter];
// update internal state for UI
this[parameter] = value;
......
......@@ -97,7 +97,7 @@ export default {
projectPath: this.targetProjectFullPath,
iid: String(this.mrIid),
reportTypes: this.$options.reportTypes.map(
reportType => reportTypeToSecurityReportTypeEnum[reportType],
(reportType) => reportTypeToSecurityReportTypeEnum[reportType],
),
};
},
......@@ -151,7 +151,7 @@ export default {
created() {
if (!this.canShowDownloads) {
this.checkAvailableSecurityReports(this.$options.reportTypes)
.then(availableSecurityReports => {
.then((availableSecurityReports) => {
this.onCheckingAvailableSecurityReports(Array.from(availableSecurityReports));
})
.catch(this.showError);
......
......@@ -3,7 +3,7 @@ import { countVulnerabilities, groupedTextBuilder } from './utils';
import { LOADING, ERROR, SUCCESS } from '~/reports/constants';
import { TRANSLATION_IS_LOADING } from './messages';
export const summaryCounts = state =>
export const summaryCounts = (state) =>
countVulnerabilities(
state.reportTypes.reduce((acc, reportType) => {
acc.push(...state[reportType].newIssues);
......@@ -50,17 +50,17 @@ export const summaryStatus = (state, getters) => {
return SUCCESS;
};
export const areReportsLoading = state =>
state.reportTypes.some(reportType => state[reportType].isLoading);
export const areReportsLoading = (state) =>
state.reportTypes.some((reportType) => state[reportType].isLoading);
export const areAllReportsLoading = state =>
state.reportTypes.every(reportType => state[reportType].isLoading);
export const areAllReportsLoading = (state) =>
state.reportTypes.every((reportType) => state[reportType].isLoading);
export const allReportsHaveError = state =>
state.reportTypes.every(reportType => state[reportType].hasError);
export const allReportsHaveError = (state) =>
state.reportTypes.every((reportType) => state[reportType].hasError);
export const anyReportHasError = state =>
state.reportTypes.some(reportType => state[reportType].hasError);
export const anyReportHasError = (state) =>
state.reportTypes.some((reportType) => state[reportType].hasError);
export const anyReportHasIssues = state =>
state.reportTypes.some(reportType => state[reportType].newIssues.length > 0);
export const anyReportHasIssues = (state) =>
state.reportTypes.some((reportType) => state[reportType].newIssues.length > 0);
......@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'sast')
.then(data => {
.then((data) => {
dispatch('receiveDiffSuccess', data);
})
.catch(() => {
......
......@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection')
.then(data => {
.then((data) => {
dispatch('receiveDiffSuccess', data);
})
.catch(() => {
......
......@@ -29,7 +29,7 @@ export const fetchDiffData = (state, endpoint, category) => {
*/
export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) =>
feedback
.filter(fb => fb.project_fingerprint === vulnerability.project_fingerprint)
.filter((fb) => fb.project_fingerprint === vulnerability.project_fingerprint)
.reduce((vuln, fb) => {
if (fb.feedback_type === FEEDBACK_TYPE_DISMISSAL) {
return {
......@@ -63,7 +63,7 @@ export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) =>
* @returns {Object}
*/
export const parseDiff = (diff, enrichData) => {
const enrichVulnerability = vulnerability => ({
const enrichVulnerability = (vulnerability) => ({
...enrichVulnerabilityWithFeedback(vulnerability, enrichData),
category: vulnerability.report_type,
title: vulnerability.message || vulnerability.name,
......
import { __, n__, s__, sprintf } from '../locale';
export default Vue => {
export default (Vue) => {
Vue.mixin({
methods: {
/**
......
......@@ -11,7 +11,7 @@
*/
export const mapComputed = (list, defaultUpdateFn, root) => {
const result = {};
list.forEach(item => {
list.forEach((item) => {
const [getter, key, updateFn] =
typeof item === 'string'
? [false, item, defaultUpdateFn]
......
......@@ -71,7 +71,7 @@ export default {
this.setDrawerBodyHeight(height);
},
featuresForVersion(version) {
return this.features.filter(feature => {
return this.features.filter((feature) => {
return feature.release === parseFloat(version);
});
},
......
......@@ -6,7 +6,7 @@ import { getStorageKey, setNotification } from './utils/notification';
let whatsNewApp;
export default el => {
export default (el) => {
if (whatsNewApp) {
store.dispatch('openDrawer');
} else {
......
export const getDrawerBodyHeight = drawer => {
export const getDrawerBodyHeight = (drawer) => {
const drawerViewableHeight = drawer.clientHeight - drawer.getBoundingClientRect().top;
const drawerHeaderHeight = drawer.querySelector('.gl-drawer-header').clientHeight;
......
export const getStorageKey = appEl => appEl.getAttribute('data-storage-key');
export const getStorageKey = (appEl) => appEl.getAttribute('data-storage-key');
export const setNotification = appEl => {
export const setNotification = (appEl) => {
const storageKey = getStorageKey(appEl);
const notificationEl = document.querySelector('.header-help');
let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count');
......
......@@ -39,21 +39,21 @@ export default class ZenMode {
constructor() {
this.active_backdrop = null;
this.active_textarea = null;
$(document).on('click', '.js-zen-enter', e => {
$(document).on('click', '.js-zen-enter', (e) => {
e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:enter');
});
$(document).on('click', '.js-zen-leave', e => {
$(document).on('click', '.js-zen-leave', (e) => {
e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:leave');
});
$(document).on('zen_mode:enter', e => {
$(document).on('zen_mode:enter', (e) => {
this.enter($(e.target).closest('.md-area').find('.zen-backdrop'));
});
$(document).on('zen_mode:leave', () => {
this.exit();
});
$(document).on('keydown', e => {
$(document).on('keydown', (e) => {
// Esc
if (e.keyCode === 27) {
e.preventDefault();
......
/**
* Returns true if the given module is required from eslint
*/
const isESLint = mod => {
const isESLint = (mod) => {
let parent = mod.parent;
while (parent) {
......
......@@ -9,9 +9,9 @@ const CACHE_PATHS = [
'./yarn.lock',
];
const resolvePath = file => path.resolve(__dirname, '../..', file);
const readFile = file => fs.readFileSync(file);
const fileHash = buffer => crypto.createHash('md5').update(buffer).digest('hex');
const resolvePath = (file) => path.resolve(__dirname, '../..', file);
const readFile = (file) => fs.readFileSync(file);
const fileHash = (buffer) => crypto.createHash('md5').update(buffer).digest('hex');
module.exports = () => {
const fileBuffers = CACHE_PATHS.map(resolvePath).map(readFile);
......
......@@ -71,13 +71,13 @@ const createContext = (specFiles, regex, suffix) => {
if (specFilters.length) {
// resolve filters
let filteredSpecFiles = specFilters.map(filter =>
let filteredSpecFiles = specFilters.map((filter) =>
glob
.sync(filter, {
root: ROOT_PATH,
matchBase: true,
})
.filter(path => path.endsWith('spec.js')),
.filter((path) => path.endsWith('spec.js')),
);
// flatten
......@@ -92,14 +92,14 @@ if (specFilters.length) {
exit('Your filter did not match any test files.', isError);
}
if (!filteredSpecFiles.every(file => SPECS_PATH.test(file))) {
if (!filteredSpecFiles.every((file) => SPECS_PATH.test(file))) {
exitError('Test files must be located within /spec/javascripts.');
}
const CE_FILES = filteredSpecFiles.filter(file => !file.startsWith('ee'));
const CE_FILES = filteredSpecFiles.filter((file) => !file.startsWith('ee'));
createContext(CE_FILES, /[^e]{2}[\\\/]spec[\\\/]javascripts$/, 'spec/javascripts');
const EE_FILES = filteredSpecFiles.filter(file => file.startsWith('ee'));
const EE_FILES = filteredSpecFiles.filter((file) => file.startsWith('ee'));
createContext(EE_FILES, /ee[\\\/]spec[\\\/]javascripts$/, 'ee/spec/javascripts');
}
......
......@@ -6,7 +6,7 @@ const { languagesArr } = require('monaco-editor-webpack-plugin/out/languages');
// a known issue in the library and this workaround was suggested here:
// https://github.com/pengx17/monaco-yaml/issues/20
const yamlLang = languagesArr.find(t => t.label === 'yaml');
const yamlLang = languagesArr.find((t) => t.label === 'yaml');
yamlLang.entry = [yamlLang.entry, '../../monaco-yaml/lib/esm/monaco.contribution'];
yamlLang.worker = {
......
......@@ -63,13 +63,13 @@ function generateEntries() {
autoEntriesMap[chunkName] = `${prefix}/${path}`;
}
pageEntries.forEach(path => generateAutoEntries(path));
pageEntries.forEach((path) => generateAutoEntries(path));
if (IS_EE) {
const eePageEntries = glob.sync('pages/**/index.js', {
cwd: path.join(ROOT_PATH, 'ee/app/assets/javascripts'),
});
eePageEntries.forEach(path => generateAutoEntries(path, 'ee'));
eePageEntries.forEach((path) => generateAutoEntries(path, 'ee'));
watchAutoEntries.push(path.join(ROOT_PATH, 'ee/app/assets/javascripts/pages/'));
}
......@@ -77,7 +77,7 @@ function generateEntries() {
autoEntriesCount = autoEntryKeys.length;
// import ancestor entrypoints within their children
autoEntryKeys.forEach(entry => {
autoEntryKeys.forEach((entry) => {
const entryPaths = [autoEntriesMap[entry]];
const segments = entry.split('.');
while (segments.pop()) {
......@@ -188,7 +188,7 @@ module.exports = {
},
{
test: /\.js$/,
exclude: path =>
exclude: (path) =>
/node_modules\/(?!tributejs)|node_modules|vendor[\\/]assets/.test(path) &&
!/\.vue\.js/.test(path),
loader: 'babel-loader',
......@@ -448,7 +448,7 @@ module.exports = {
]),
!IS_EE &&
new webpack.NormalModuleReplacementPlugin(/^ee_component\/(.*)\.vue/, resource => {
new webpack.NormalModuleReplacementPlugin(/^ee_component\/(.*)\.vue/, (resource) => {
resource.request = path.join(
ROOT_PATH,
'app/assets/javascripts/vue_shared/components/empty_component.js',
......@@ -485,14 +485,14 @@ module.exports = {
const missingDeps = Array.from(compilation.missingDependencies);
const nodeModulesPath = path.join(ROOT_PATH, 'node_modules');
const hasMissingNodeModules = missingDeps.some(
file => file.indexOf(nodeModulesPath) !== -1,
(file) => file.indexOf(nodeModulesPath) !== -1,
);
// watch for changes to missing node_modules
if (hasMissingNodeModules) compilation.contextDependencies.add(nodeModulesPath);
// watch for changes to automatic entrypoints
watchAutoEntries.forEach(watchPath => compilation.contextDependencies.add(watchPath));
watchAutoEntries.forEach((watchPath) => compilation.contextDependencies.add(watchPath));
// report our auto-generated bundle count
console.log(
......@@ -518,7 +518,7 @@ module.exports = {
);
}
const memoryUsage = process.memoryUsage().heapUsed;
const toMB = bytes => Math.floor(bytes / 1024 / 1024);
const toMB = (bytes) => Math.floor(bytes / 1024 / 1024);
console.log(`Webpack heap size: ${toMB(memoryUsage)} MB`);
......
......@@ -76,7 +76,7 @@ export default {
addToSlack() {
GitlabSlackService.addToSlack(this.slackLinkPath, this.selectedProjectId)
.then(response => redirectTo(response.data.add_to_slack_link))
.then((response) => redirectTo(response.data.add_to_slack_link))
.catch(() => Flash(__('Unable to build Slack link.')));
},
},
......
......@@ -74,7 +74,7 @@ export default {
return Boolean(this.devopsAdoptionSegments?.nodes?.length);
},
hasLoadingError() {
return Object.values(this.errors).some(error => error === true);
return Object.values(this.errors).some((error) => error === true);
},
timestamp() {
return dateformat(
......@@ -128,7 +128,7 @@ export default {
this.isLoadingGroups = false;
}
})
.catch(error => this.handleError(DEVOPS_ADOPTION_ERROR_KEYS.groups, error));
.catch((error) => this.handleError(DEVOPS_ADOPTION_ERROR_KEYS.groups, error));
},
setSelectedSegment(segment) {
this.selectedSegment = segment;
......
......@@ -83,7 +83,7 @@ export default {
},
filteredOptions() {
return this.filter
? this.checkboxOptions.filter(option =>
? this.checkboxOptions.filter((option) =>
option.label.toLowerCase().includes(this.filter.toLowerCase()),
)
: this.checkboxOptions;
......
......@@ -32,7 +32,7 @@ const headers = [
'pipelineSucceeded',
'deploySucceeded',
'securityScanSucceeded',
].map(key => ({ key, ...i18n.headers[key], ...fieldOptions }));
].map((key) => ({ key, ...i18n.headers[key], ...fieldOptions }));
export default {
name: 'DevopsAdoptionTable',
......
......@@ -26,7 +26,7 @@ export const resolvers = {
// eslint-disable-next-line @gitlab/require-i18n-strings
__typename: 'Groups',
// eslint-disable-next-line @gitlab/require-i18n-strings
nodes: data.map(group => ({ ...group, __typename: 'Group' })),
nodes: data.map((group) => ({ ...group, __typename: 'Group' })),
pageInfo,
};
......
......@@ -6,7 +6,7 @@ export const addSegmentToCache = (store, segment) => {
query: devopsAdoptionSegmentsQuery,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.devopsAdoptionSegments.nodes = [...draftData.devopsAdoptionSegments.nodes, segment];
});
......@@ -22,7 +22,7 @@ export const deleteSegmentFromCache = (store, segmentId) => {
query: devopsAdoptionSegmentsQuery,
});
const updatedData = produce(sourceData, draftData => {
const updatedData = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.devopsAdoptionSegments.nodes = draftData.devopsAdoptionSegments.nodes.filter(
({ id }) => id !== segmentId,
......
......@@ -34,9 +34,9 @@ export default {
computed: {
...mapState('mergeRequests', {
isLoading: 'isLoading',
perPage: state => state.pageInfo.perPage,
totalItems: state => state.pageInfo.total,
page: state => state.pageInfo.page,
perPage: (state) => state.pageInfo.perPage,
totalItems: (state) => state.pageInfo.total,
page: (state) => state.pageInfo.page,
}),
currentPage: {
get() {
......
......@@ -28,10 +28,10 @@ export default {
},
computed: {
...mapState('filters', {
selectedMilestone: state => state.milestones.selected,
selectedLabelList: state => state.labels.selectedList,
milestonesData: state => state.milestones.data,
labelsData: state => state.labels.data,
selectedMilestone: (state) => state.milestones.selected,
selectedLabelList: (state) => state.labels.selectedList,
milestonesData: (state) => state.milestones.data,
labelsData: (state) => state.labels.data,
}),
tokens() {
return [
......
......@@ -23,7 +23,7 @@ export default class FilteredSearchCodeReviewAnalytics extends FilteredSearchMan
/**
* Updates filters in code review analytics store
*/
updateObject = path => {
updateObject = (path) => {
const filters = urlParamsToObject(path);
const { selectedLabels: selectedLabelList, selectedMilestone } = transformFilters(filters);
......
......@@ -29,7 +29,7 @@ export const fetchMergeRequests = ({ commit, state, rootState }) => {
};
return API.codeReviewAnalytics(params)
.then(response => {
.then((response) => {
const { headers, data } = response;
const normalizedHeaders = normalizeHeaders(headers);
commit(types.RECEIVE_MERGE_REQUESTS_SUCCESS, {
......
......@@ -9,7 +9,7 @@
* @param {Object} filters
* @returns {Object}
*/
const transformFilters = filters => {
const transformFilters = (filters) => {
const {
label_name: labelNames,
milestone_title: milestoneTitle,
......@@ -17,13 +17,13 @@ const transformFilters = filters => {
'not[milestone_title]': notMilestoneTitle,
} = filters;
let selectedLabels = labelNames?.map(label => ({ value: label, operator: '=' })) || [];
let selectedLabels = labelNames?.map((label) => ({ value: label, operator: '=' })) || [];
let selectedMilestone = null;
if (notLabelNames) {
selectedLabels = [
...selectedLabels,
...notLabelNames.map(label => ({ value: label, operator: '!=' })),
...notLabelNames.map((label) => ({ value: label, operator: '!=' })),
];
}
......
......@@ -71,12 +71,12 @@ export default {
methods: {
setSvg(name) {
return getSvgIconPathContent(name)
.then(path => {
.then((path) => {
if (path) {
this.$set(this.svgs, name, `path://${path}`);
}
})
.catch(e => {
.catch((e) => {
// eslint-disable-next-line no-console, @gitlab/require-i18n-strings
console.error('SVG could not be rendered correctly: ', e);
});
......
......@@ -3,12 +3,12 @@ import { sortBy } from 'lodash';
import ColumnChart from './components/column_chart.vue';
import { __ } from '~/locale';
const sortByValue = data => sortBy(data, item => item[1]).reverse();
const sortByValue = (data) => sortBy(data, (item) => item[1]).reverse();
const allValuesEmpty = graphData =>
const allValuesEmpty = (graphData) =>
graphData.reduce((acc, data) => acc + Math.min(0, data[1]), 0) === 0;
export default dataEl => {
export default (dataEl) => {
if (!dataEl) return;
const data = JSON.parse(dataEl.innerHTML);
......@@ -23,7 +23,7 @@ export default dataEl => {
merge_requests_created: [],
};
outputElIds.forEach(id => {
outputElIds.forEach((id) => {
data[id].data.forEach((d, index) => {
formattedData[id].push([data.labels[index], d]);
});
......
......@@ -21,7 +21,7 @@ import { DEFAULT_STAGE_NAMES } from '../../constants';
* @param {CustomStageEvents[]} events
* @returns {DropdownData[]} array of start events formatted for dropdowns
*/
export const startEventOptions = eventsList => [
export const startEventOptions = (eventsList) => [
{ value: null, text: I18N.SELECT_START_EVENT },
...eventsList.filter(isStartEvent).map(eventToOption),
];
......@@ -82,7 +82,7 @@ export const initializeFormData = ({ fields, errors }) => {
* @param {Object} fields key value pair of form field values
* @returns {Object} key value pair of form fields with an array of errors
*/
export const validateFields = fields => {
export const validateFields = (fields) => {
const newErrors = {};
if (fields?.name) {
......
......@@ -51,7 +51,7 @@ export default {
hasErrors() {
return (
this.eventMismatchError || Object.values(this.errors).some(errArray => errArray?.length)
this.eventMismatchError || Object.values(this.errors).some((errArray) => errArray?.length)
);
},
startEventRequiresLabel() {
......@@ -82,7 +82,7 @@ export default {
requiredFields.push(endEventLabelId);
}
return requiredFields.every(
fieldValue => fieldValue && (fieldValue.length > 0 || fieldValue > 0),
(fieldValue) => fieldValue && (fieldValue.length > 0 || fieldValue > 0),
);
},
isDirty() {
......
......@@ -30,14 +30,14 @@ export default {
},
computed: {
...mapState('filters', {
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedLabelList: state => state.labels.selectedList,
selectedAssigneeList: state => state.assignees.selectedList,
milestonesData: state => state.milestones.data,
labelsData: state => state.labels.data,
authorsData: state => state.authors.data,
assigneesData: state => state.assignees.data,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedLabelList: (state) => state.labels.selectedList,
selectedAssigneeList: (state) => state.assignees.selectedList,
milestonesData: (state) => state.milestones.data,
labelsData: (state) => state.labels.data,
authorsData: (state) => state.authors.data,
assigneesData: (state) => state.assignees.data,
}),
tokens() {
return [
......
......@@ -49,7 +49,7 @@ export default {
},
onClick({ stage, isMarking }) {
this.selectedStages = isMarking
? this.selectedStages.filter(s => s.id !== stage.id)
? this.selectedStages.filter((s) => s.id !== stage.id)
: this.selectedStages.concat([stage]);
this.$emit('selected', this.selectedStages);
......
......@@ -53,7 +53,7 @@ export default {
if (this.allowCustomOrdering) {
const options = {
...sortableDefaultOptions(),
onUpdate: event => {
onUpdate: (event) => {
const el = event.item;
const { previousElementSibling, nextElementSibling } = el;
......
......@@ -121,7 +121,7 @@ export default {
:checked="subjectFilter"
:options="subjectFilterOptions"
@input="
value =>
(value) =>
$emit('updateFilter', { filter: $options.TASKS_BY_TYPE_FILTERS.SUBJECT, value })
"
/>
......
......@@ -35,7 +35,7 @@ export default {
requestType: {
type: String,
required: true,
validator: t => OVERVIEW_METRICS[t],
validator: (t) => OVERVIEW_METRICS[t],
},
},
data() {
......
......@@ -52,7 +52,7 @@ export default () => {
name: 'CycleAnalyticsApp',
apolloProvider,
store,
render: createElement =>
render: (createElement) =>
createElement(CycleAnalytics, {
props: {
emptyStateSvgPath,
......
......@@ -12,7 +12,7 @@ import {
flashErrorIfStatusNotOk,
} from '../utils';
const appendExtension = path => (path.indexOf('.') > -1 ? path : `${path}.json`);
const appendExtension = (path) => (path.indexOf('.') > -1 ? path : `${path}.json`);
export const setPaths = ({ dispatch }, options) => {
const { groupPath, milestonesPath = '', labelsPath = '' } = options;
......@@ -66,7 +66,7 @@ export const fetchStageData = ({ dispatch, getters }, stageId) => {
})
.then(checkForDataError)
.then(({ data }) => dispatch('receiveStageDataSuccess', data))
.catch(error => dispatch('receiveStageDataError', error));
.catch((error) => dispatch('receiveStageDataError', error));
};
export const requestStageMedianValues = ({ commit }) => commit(types.REQUEST_STAGE_MEDIANS);
......@@ -96,11 +96,11 @@ export const fetchStageMedianValues = ({ dispatch, commit, getters }) => {
activeStages,
currentValueStreamId,
} = getters;
const stageIds = activeStages.map(s => s.slug);
const stageIds = activeStages.map((s) => s.slug);
dispatch('requestStageMedianValues');
return Promise.all(
stageIds.map(stageId =>
stageIds.map((stageId) =>
fetchStageMedian({
groupId: currentGroupPath,
valueStreamId: currentValueStreamId,
......@@ -109,8 +109,8 @@ export const fetchStageMedianValues = ({ dispatch, commit, getters }) => {
}),
),
)
.then(data => commit(types.RECEIVE_STAGE_MEDIANS_SUCCESS, data))
.catch(error => dispatch('receiveStageMedianValuesError', error));
.then((data) => commit(types.RECEIVE_STAGE_MEDIANS_SUCCESS, data))
.catch((error) => dispatch('receiveStageMedianValuesError', error));
};
export const requestCycleAnalyticsData = ({ commit }) => commit(types.REQUEST_CYCLE_ANALYTICS_DATA);
......@@ -136,7 +136,7 @@ export const fetchCycleAnalyticsData = ({ dispatch }) => {
.then(() => dispatch('requestCycleAnalyticsData'))
.then(() => dispatch('fetchValueStreams'))
.then(() => dispatch('receiveCycleAnalyticsDataSuccess'))
.catch(error => {
.catch((error) => {
return Promise.all([
dispatch('receiveCycleAnalyticsDataError', error),
dispatch('durationChart/setLoading', false),
......@@ -193,7 +193,7 @@ export const fetchGroupStagesAndEvents = ({ dispatch, getters }) => {
dispatch('receiveGroupStagesSuccess', stages);
dispatch('customStages/setStageEvents', events);
})
.catch(error => {
.catch((error) => {
throwIfUserForbidden(error);
return dispatch('receiveGroupStagesError', error);
});
......@@ -267,7 +267,7 @@ export const removeStage = ({ dispatch, getters }, stageId) => {
stageId,
})
.then(() => dispatch('receiveRemoveStageSuccess'))
.catch(error => dispatch('receiveRemoveStageError', error));
.catch((error) => dispatch('receiveRemoveStageError', error));
};
export const initializeCycleAnalyticsSuccess = ({ commit }) =>
......@@ -400,7 +400,7 @@ export const fetchValueStreams = ({ commit, dispatch, getters, state }) => {
return Api.cycleAnalyticsValueStreams(currentGroupPath)
.then(({ data }) => dispatch('receiveValueStreamsSuccess', data))
.catch(error => {
.catch((error) => {
const {
response: { status },
} = error;
......
......@@ -7,7 +7,7 @@ import { dateFormats } from '../../shared/constants';
import { transformStagesForPathNavigation } from '../utils';
import { DEFAULT_VALUE_STREAM_ID } from '../constants';
export const hasNoAccessError = state => state.errorCode === httpStatus.FORBIDDEN;
export const hasNoAccessError = (state) => state.errorCode === httpStatus.FORBIDDEN;
export const currentValueStreamId = ({ selectedValueStream }) =>
selectedValueStream?.id || DEFAULT_VALUE_STREAM_ID;
......@@ -51,7 +51,7 @@ export const hiddenStages = ({ stages }) => filterStagesByHiddenStatus(stages);
export const activeStages = ({ stages }) => filterStagesByHiddenStatus(stages, false);
export const enableCustomOrdering = ({ stages, errorSavingStageOrder }) =>
stages.some(stage => isNumber(stage.id)) && !errorSavingStageOrder;
stages.some((stage) => isNumber(stage.id)) && !errorSavingStageOrder;
export const customStageFormActive = ({ isCreatingCustomStage, isEditingCustomStage }) =>
Boolean(isCreatingCustomStage || isEditingCustomStage);
......
......@@ -76,7 +76,7 @@ export const createStage = ({ dispatch, rootGetters }, data) => {
valueStreamId: currentValueStreamId,
data,
})
.then(response => {
.then((response) => {
const { status, data: responseData } = response;
return dispatch('receiveCreateStageSuccess', { status, data: responseData });
})
......
......@@ -25,7 +25,7 @@ const extractFormFields = (rawStage = {}) => {
export default {
[types.SET_STAGE_EVENTS](state, data = []) {
state.formEvents = data.map(ev => convertObjectPropsToCamelCase(ev, { deep: true }));
state.formEvents = data.map((ev) => convertObjectPropsToCamelCase(ev, { deep: true }));
},
[types.SET_STAGE_FORM_ERRORS](state, errors) {
state.formErrors = convertObjectPropsToCamelCase(errors, { deep: true });
......
......@@ -24,7 +24,7 @@ export const fetchDurationData = ({ dispatch, commit, rootGetters }) => {
currentValueStreamId,
} = rootGetters;
return Promise.all(
activeStages.map(stage => {
activeStages.map((stage) => {
const { slug } = stage;
return Api.cycleAnalyticsDurationChart({
......@@ -37,13 +37,13 @@ export const fetchDurationData = ({ dispatch, commit, rootGetters }) => {
.then(({ data }) => ({ slug, selected: true, data }));
}),
)
.then(data => commit(types.RECEIVE_DURATION_DATA_SUCCESS, data))
.catch(error => dispatch('receiveDurationDataError', error));
.then((data) => commit(types.RECEIVE_DURATION_DATA_SUCCESS, data))
.catch((error) => dispatch('receiveDurationDataError', error));
};
export const updateSelectedDurationChartStages = ({ state, commit }, stages) => {
const setSelectedPropertyOnStages = data =>
data.map(stage => {
const setSelectedPropertyOnStages = (data) =>
data.map((stage) => {
const selected = stages.reduce((result, object) => {
if (object.slug === stage.slug) return true;
return result;
......
......@@ -3,7 +3,7 @@ import { getDurationChartData } from '../../../utils';
export const durationChartPlottableData = (state, _, rootState) => {
const { startDate, endDate } = rootState;
const { durationData } = state;
const selectedStagesDurationData = durationData.filter(stage => stage.selected);
const selectedStagesDurationData = durationData.filter((stage) => stage.selected);
const plottableData = getDurationChartData(selectedStagesDurationData, startDate, endDate);
return plottableData.length ? plottableData : [];
......
......@@ -44,7 +44,7 @@ export const fetchTopRankedGroupLabels = ({ dispatch, commit, state, rootGetters
})
.then(checkForDataError)
.then(({ data }) => dispatch('receiveTopRankedGroupLabelsSuccess', data))
.catch(error => {
.catch((error) => {
throwIfUserForbidden(error);
return dispatch('receiveTopRankedGroupLabelsError', error);
});
......@@ -90,7 +90,7 @@ export const fetchTasksByTypeData = ({ dispatch, commit, state, rootGetters }) =
})
.then(checkForDataError)
.then(({ data }) => commit(types.RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS, data))
.catch(error => dispatch('receiveTasksByTypeDataError', error));
.catch((error) => dispatch('receiveTasksByTypeDataError', error));
}
return commit(types.RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS, []);
};
......
......@@ -33,7 +33,7 @@ export default {
state.selectedStageError = '';
},
[types.RECEIVE_STAGE_DATA_SUCCESS](state, events = []) {
state.currentStageEvents = events.map(fields =>
state.currentStageEvents = events.map((fields) =>
convertObjectPropsToCamelCase(fields, { deep: true }),
);
state.isEmptyStage = !events.length;
......
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