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

Run prettier on 32 files - 29 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -848,40 +848,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue ...@@ -848,40 +848,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue
app/assets/javascripts/snippets/components/snippet_header.vue app/assets/javascripts/snippets/components/snippet_header.vue
app/assets/javascripts/snippets/mixins/snippets.js 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 ## nostalgic-morse
app/assets/javascripts/user_lists/store/show/actions.js 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/index.js
......
...@@ -12,7 +12,7 @@ import { SNIPPET_MARK_BLOBS_CONTENT, SNIPPET_MEASURE_BLOBS_CONTENT } from '~/per ...@@ -12,7 +12,7 @@ import { SNIPPET_MARK_BLOBS_CONTENT, SNIPPET_MEASURE_BLOBS_CONTENT } from '~/per
const createLocalId = () => uniqueId('blob_local_'); const createLocalId = () => uniqueId('blob_local_');
export const decorateBlob = blob => ({ export const decorateBlob = (blob) => ({
...blob, ...blob,
id: createLocalId(), id: createLocalId(),
isLoaded: false, isLoaded: false,
...@@ -54,7 +54,7 @@ const diff = ({ content, path }, origBlob) => { ...@@ -54,7 +54,7 @@ const diff = ({ content, path }, origBlob) => {
*/ */
export const diffAll = (blobs, origBlobs) => { export const diffAll = (blobs, origBlobs) => {
const deletedEntries = Object.values(origBlobs) const deletedEntries = Object.values(origBlobs)
.filter(x => !blobs[x.id]) .filter((x) => !blobs[x.id])
.map(({ path, content }) => ({ .map(({ path, content }) => ({
action: SNIPPET_BLOB_ACTION_DELETE, action: SNIPPET_BLOB_ACTION_DELETE,
previousPath: path, previousPath: path,
...@@ -63,15 +63,15 @@ export const diffAll = (blobs, origBlobs) => { ...@@ -63,15 +63,15 @@ export const diffAll = (blobs, origBlobs) => {
})); }));
const newEntries = Object.values(blobs) const newEntries = Object.values(blobs)
.map(blob => diff(blob, origBlobs[blob.id])) .map((blob) => diff(blob, origBlobs[blob.id]))
.filter(x => x); .filter((x) => x);
return [...deletedEntries, ...newEntries]; return [...deletedEntries, ...newEntries];
}; };
export const defaultSnippetVisibilityLevels = arr => { export const defaultSnippetVisibilityLevels = (arr) => {
if (Array.isArray(arr)) { if (Array.isArray(arr)) {
return arr.map(l => { return arr.map((l) => {
const translatedLevel = SNIPPET_LEVELS_MAP[l]; const translatedLevel = SNIPPET_LEVELS_MAP[l];
return { return {
value: translatedLevel, value: translatedLevel,
......
...@@ -8,7 +8,7 @@ import hasSubmittedChangesResolver from './resolvers/has_submitted_changes'; ...@@ -8,7 +8,7 @@ import hasSubmittedChangesResolver from './resolvers/has_submitted_changes';
Vue.use(VueApollo); Vue.use(VueApollo);
const createApolloProvider = appData => { const createApolloProvider = (appData) => {
const defaultClient = createDefaultClient( const defaultClient = createDefaultClient(
{ {
Project: { Project: {
...@@ -26,7 +26,7 @@ const createApolloProvider = appData => { ...@@ -26,7 +26,7 @@ const createApolloProvider = appData => {
); );
// eslint-disable-next-line @gitlab/require-i18n-strings // 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({ defaultClient.cache.writeData({
data: { data: {
......
import loadSourceContent from '../../services/load_source_content'; import loadSourceContent from '../../services/load_source_content';
const fileResolver = ({ fullPath: projectId }, { path: sourcePath }) => { 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 // eslint-disable-next-line @gitlab/require-i18n-strings
__typename: 'File', __typename: 'File',
...sourceContent, ...sourceContent,
......
...@@ -4,7 +4,7 @@ import query from '../queries/app_data.query.graphql'; ...@@ -4,7 +4,7 @@ import query from '../queries/app_data.query.graphql';
const hasSubmittedChangesResolver = (_, { input: { hasSubmittedChanges } }, { cache }) => { const hasSubmittedChangesResolver = (_, { input: { hasSubmittedChanges } }, { cache }) => {
const oldData = cache.readQuery({ query }); 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 // punctually modifying draftState as per immer docs upsets our linters
return { return {
...draftState, ...draftState,
......
...@@ -25,8 +25,8 @@ const submitContentChangesResolver = ( ...@@ -25,8 +25,8 @@ const submitContentChangesResolver = (
images, images,
mergeRequestMeta, mergeRequestMeta,
formattedMarkdown, formattedMarkdown,
}).then(savedContentMeta => { }).then((savedContentMeta) => {
const data = produce(savedContentMeta, draftState => { const data = produce(savedContentMeta, (draftState) => {
return { return {
savedContentMeta: { savedContentMeta: {
__typename: 'SavedContentMeta', __typename: 'SavedContentMeta',
......
...@@ -4,15 +4,15 @@ import { getBinary } from './services/image_service'; ...@@ -4,15 +4,15 @@ import { getBinary } from './services/image_service';
const imageRepository = () => { const imageRepository = () => {
const images = new Map(); const images = new Map();
const flash = message => new Flash(message); const flash = (message) => new Flash(message);
const add = (file, url) => { const add = (file, url) => {
getBinary(file) 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.'))); .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; const getAll = () => images;
......
...@@ -4,7 +4,7 @@ import App from './components/app.vue'; ...@@ -4,7 +4,7 @@ import App from './components/app.vue';
import createRouter from './router'; import createRouter from './router';
import createApolloProvider from './graphql'; import createApolloProvider from './graphql';
const initStaticSiteEditor = el => { const initStaticSiteEditor = (el) => {
const { const {
isSupportedContent, isSupportedContent,
path: sourcePath, path: sourcePath,
......
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
}, },
}, },
}) })
.catch(e => { .catch((e) => {
this.submitChangesError = e.message; this.submitChangesError = e.message;
}) })
.finally(() => { .finally(() => {
......
...@@ -24,7 +24,7 @@ const nestedLineRegexp = /^\s+/; ...@@ -24,7 +24,7 @@ const nestedLineRegexp = /^\s+/;
* This function attempts to correct this problem before the content is loaded * This function attempts to correct this problem before the content is loaded
* by Toast UI. * by Toast UI.
*/ */
const correctNestedContentIndenation = source => { const correctNestedContentIndenation = (source) => {
const lines = source.split('\n'); const lines = source.split('\n');
let topLevelOrderedListDetected = false; let topLevelOrderedListDetected = false;
...@@ -40,7 +40,7 @@ const correctNestedContentIndenation = source => { ...@@ -40,7 +40,7 @@ const correctNestedContentIndenation = source => {
.join('\n'); .join('\n');
}; };
const removeOrphanedBrTags = source => { const removeOrphanedBrTags = (source) => {
/* Until the underlying Squire editor of Toast UI Editor resolves duplicate `<br>` tags, this /* 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, `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. it cleans up orphaned `<br>` tags in the source markdown document that should be new lines.
...@@ -49,7 +49,7 @@ const removeOrphanedBrTags = source => { ...@@ -49,7 +49,7 @@ const removeOrphanedBrTags = source => {
return source.replace(/\n^<br>$/gm, ''); return source.replace(/\n^<br>$/gm, '');
}; };
const format = source => { const format = (source) => {
return correctNestedContentIndenation(removeOrphanedBrTags(source)); return correctNestedContentIndenation(removeOrphanedBrTags(source));
}; };
......
...@@ -8,7 +8,7 @@ const hasMatter = (firstThreeChars, fourthChar) => { ...@@ -8,7 +8,7 @@ const hasMatter = (firstThreeChars, fourthChar) => {
return isYamlDelimiter && isFourthCharNewline; return isYamlDelimiter && isFourthCharNewline;
}; };
export const frontMatterify = source => { export const frontMatterify = (source) => {
let index = 3; let index = 3;
let offset; let offset;
const delimiter = source.slice(0, index); const delimiter = source.slice(0, index);
......
export const getBinary = file => { export const getBinary = (file) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result.split(',')[1]); reader.onload = () => resolve(reader.result.split(',')[1]);
reader.onerror = error => reject(error); reader.onerror = (error) => reject(error);
}); });
}; };
import Api from '~/api'; import Api from '~/api';
const extractTitle = content => { const extractTitle = (content) => {
const matches = content.match(/title: (.+)\n/i); const matches = content.match(/title: (.+)\n/i);
return matches ? Array.from(matches)[1] : ''; return matches ? Array.from(matches)[1] : '';
......
import { frontMatterify, stringify } from './front_matterify'; import { frontMatterify, stringify } from './front_matterify';
const parseSourceFile = raw => { const parseSourceFile = (raw) => {
let editable; let editable;
const syncContent = (newVal, isBody) => { const syncContent = (newVal, isBody) => {
...@@ -20,7 +20,7 @@ const parseSourceFile = raw => { ...@@ -20,7 +20,7 @@ const parseSourceFile = raw => {
const matter = () => editable.matter; const matter = () => editable.matter;
const syncMatter = settings => { const syncMatter = (settings) => {
editable.matter = settings; editable.matter = settings;
}; };
......
...@@ -4,16 +4,16 @@ const canRender = ({ type }) => type === 'image'; ...@@ -4,16 +4,16 @@ const canRender = ({ type }) => type === 'image';
let metadata; 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 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') 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 baseUrl = decodeURIComponent(metadata.baseUrl);
const sourceDirectory = extractSourceDirectory(baseUrl)[1]; const sourceDirectory = extractSourceDirectory(baseUrl)[1];
const currentDirectory = sourceDirectory.split(`/-/sse/${metadata.branch}`)[1]; const currentDirectory = sourceDirectory.split(`/-/sse/${metadata.branch}`)[1];
...@@ -23,7 +23,7 @@ const parseCurrentDirectory = basePath => { ...@@ -23,7 +23,7 @@ const parseCurrentDirectory = basePath => {
// For more context around this logic, please see the following comment: // For more context around this logic, please see the following comment:
// https://gitlab.com/gitlab-org/gitlab/-/issues/241166#note_409413500 // https://gitlab.com/gitlab-org/gitlab/-/issues/241166#note_409413500
const generateSourceDirectory = basePath => { const generateSourceDirectory = (basePath) => {
let sourceDir = ''; let sourceDir = '';
let defaultSourceDir = ''; let defaultSourceDir = '';
......
...@@ -32,7 +32,7 @@ const createImageActions = (images, markdown) => { ...@@ -32,7 +32,7 @@ const createImageActions = (images, markdown) => {
} }
images.forEach((imageContent, filePath) => { 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)) { if (imageExistsInMarkdown(filePath).test(markdown)) {
actions.push( actions.push(
......
...@@ -40,10 +40,10 @@ const mark = (source, groups) => { ...@@ -40,10 +40,10 @@ const mark = (source, groups) => {
const hash = {}; const hash = {};
Object.entries(groups).forEach(([groupKey, group]) => { Object.entries(groups).forEach(([groupKey, group]) => {
group.forEach(pattern => { group.forEach((pattern) => {
const matches = text.match(pattern); const matches = text.match(pattern);
if (matches) { if (matches) {
matches.forEach(match => { matches.forEach((match) => {
const key = `${markPrefix}-${groupKey}-${id}`; const key = `${markPrefix}-${groupKey}-${id}`;
text = text.replace(match, key); text = text.replace(match, key);
hash[key] = match; hash[key] = match;
...@@ -67,12 +67,12 @@ const unmark = (text, hash) => { ...@@ -67,12 +67,12 @@ const unmark = (text, hash) => {
return source; return source;
}; };
const unwrap = source => { const unwrap = (source) => {
let text = source; let text = source;
const matches = text.match(reTemplated); const matches = text.match(reTemplated);
if (matches) { if (matches) {
matches.forEach(match => { matches.forEach((match) => {
const initial = match.replace(`${wrapPrefix}`, '').replace(`${wrapPostfix}`, ''); const initial = match.replace(`${wrapPrefix}`, '').replace(`${wrapPostfix}`, '');
text = text.replace(match, initial); text = text.replace(match, initial);
}); });
...@@ -81,7 +81,7 @@ const unwrap = source => { ...@@ -81,7 +81,7 @@ const unwrap = source => {
return text; return text;
}; };
const wrap = source => { const wrap = (source) => {
const { text, hash } = mark(unwrap(source), patternGroups); const { text, hash } = mark(unwrap(source), patternGroups);
return unmark(text, hash); return unmark(text, hash);
}; };
......
...@@ -35,7 +35,7 @@ export default class TaskList { ...@@ -35,7 +35,7 @@ export default class TaskList {
`${this.taskListContainerSelector} .js-task-list-field[data-value]`, `${this.taskListContainerSelector} .js-task-list-field[data-value]`,
); );
taskListFields.forEach(taskListField => { taskListFields.forEach((taskListField) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
taskListField.value = taskListField.dataset.value; taskListField.value = taskListField.dataset.value;
}); });
......
...@@ -64,11 +64,11 @@ export default class GLTerminal { ...@@ -64,11 +64,11 @@ export default class GLTerminal {
const decoder = new TextDecoder('utf-8'); const decoder = new TextDecoder('utf-8');
const encoder = new TextEncoder('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.send(encoder.encode(data));
}); });
this.socket.addEventListener('message', ev => { this.socket.addEventListener('message', (ev) => {
this.terminal.write(decoder.decode(ev.data)); this.terminal.write(decoder.decode(ev.data));
}); });
...@@ -110,7 +110,7 @@ export default class GLTerminal { ...@@ -110,7 +110,7 @@ export default class GLTerminal {
this.terminal.dispose(); this.terminal.dispose();
this.socket.close(); this.socket.close();
this.onDispose.forEach(fn => fn()); this.onDispose.forEach((fn) => fn());
this.onDispose.length = 0; this.onDispose.length = 0;
} }
......
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
...this.cursor, ...this.cursor,
}; };
}, },
update: data => data, update: (data) => data,
error() { error() {
this.states = null; this.states = null;
}, },
......
...@@ -12,7 +12,7 @@ export default function simulateInput(target, text) { ...@@ -12,7 +12,7 @@ export default function simulateInput(target, text) {
} }
if (text.length > 0) { if (text.length > 0) {
Array.prototype.forEach.call(text, char => { Array.prototype.forEach.call(text, (char) => {
input.value += char; input.value += char;
triggerEvents(input); triggerEvents(input);
}); });
......
...@@ -49,7 +49,7 @@ function onToggleClicked(toggle, input, clickCallback) { ...@@ -49,7 +49,7 @@ function onToggleClicked(toggle, input, clickCallback) {
export default function setupToggleButtons(container, clickCallback = () => {}) { export default function setupToggleButtons(container, clickCallback = () => {}) {
const toggles = container.querySelectorAll('.js-project-feature-toggle'); const toggles = container.querySelectorAll('.js-project-feature-toggle');
toggles.forEach(toggle => { toggles.forEach((toggle) => {
const input = toggle.querySelector('.js-project-feature-toggle-input'); const input = toggle.querySelector('.js-project-feature-toggle-input');
const isOn = parseBoolean(input.value); const isOn = parseBoolean(input.value);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlTooltip, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import { GlTooltip, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { uniqueId } from 'lodash'; import { uniqueId } from 'lodash';
const getTooltipTitle = element => { const getTooltipTitle = (element) => {
return element.getAttribute('title') || element.dataset.title; return element.getAttribute('title') || element.dataset.title;
}; };
...@@ -37,8 +37,8 @@ export default { ...@@ -37,8 +37,8 @@ export default {
}; };
}, },
created() { created() {
this.observer = new MutationObserver(mutations => { this.observer = new MutationObserver((mutations) => {
mutations.forEach(mutation => { mutations.forEach((mutation) => {
mutation.removedNodes.forEach(this.dispose); mutation.removedNodes.forEach(this.dispose);
}); });
}); });
...@@ -49,11 +49,11 @@ export default { ...@@ -49,11 +49,11 @@ export default {
methods: { methods: {
addTooltips(elements, config) { addTooltips(elements, config) {
const newTooltips = elements const newTooltips = elements
.filter(element => !this.tooltipExists(element)) .filter((element) => !this.tooltipExists(element))
.map(element => newTooltip(element, config)) .map((element) => newTooltip(element, config))
.filter(tooltip => tooltip.title); .filter((tooltip) => tooltip.title);
newTooltips.forEach(tooltip => this.observe(tooltip)); newTooltips.forEach((tooltip) => this.observe(tooltip));
this.tooltips.push(...newTooltips); this.tooltips.push(...newTooltips);
}, },
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
return Boolean(this.findTooltipByTarget(element)); return Boolean(this.findTooltipByTarget(element));
}, },
findTooltipByTarget(element) { findTooltipByTarget(element) {
return this.tooltips.find(tooltip => tooltip.target === element); return this.tooltips.find((tooltip) => tooltip.target === element);
}, },
}, },
safeHtmlConfig: { safeHtmlConfig: {
......
...@@ -81,12 +81,12 @@ const tooltipApiInvoker = ({ glHandler, bsHandler }) => (elements, ...params) => ...@@ -81,12 +81,12 @@ const tooltipApiInvoker = ({ glHandler, bsHandler }) => (elements, ...params) =>
export const initTooltips = (config = {}) => { export const initTooltips = (config = {}) => {
if (isGlTooltipsEnabled()) { if (isGlTooltipsEnabled()) {
const triggers = config?.triggers || DEFAULT_TRIGGER; 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( document.addEventListener(
event, event,
e => handleTooltipEvent(document, e, config.selector, config), (e) => handleTooltipEvent(document, e, config.selector, config),
true, true,
); );
}); });
...@@ -103,28 +103,28 @@ export const add = (elements, config = {}) => { ...@@ -103,28 +103,28 @@ export const add = (elements, config = {}) => {
return invokeBootstrapApi(elements, config); return invokeBootstrapApi(elements, config);
}; };
export const dispose = tooltipApiInvoker({ export const dispose = tooltipApiInvoker({
glHandler: element => tooltipsApp().dispose(element), glHandler: (element) => tooltipsApp().dispose(element),
bsHandler: elements => invokeBootstrapApi(elements, 'dispose'), bsHandler: (elements) => invokeBootstrapApi(elements, 'dispose'),
}); });
export const fixTitle = tooltipApiInvoker({ export const fixTitle = tooltipApiInvoker({
glHandler: element => tooltipsApp().fixTitle(element), glHandler: (element) => tooltipsApp().fixTitle(element),
bsHandler: elements => invokeBootstrapApi(elements, '_fixTitle'), bsHandler: (elements) => invokeBootstrapApi(elements, '_fixTitle'),
}); });
export const enable = tooltipApiInvoker({ export const enable = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'enable'), glHandler: (element) => tooltipsApp().triggerEvent(element, 'enable'),
bsHandler: elements => invokeBootstrapApi(elements, 'enable'), bsHandler: (elements) => invokeBootstrapApi(elements, 'enable'),
}); });
export const disable = tooltipApiInvoker({ export const disable = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'disable'), glHandler: (element) => tooltipsApp().triggerEvent(element, 'disable'),
bsHandler: elements => invokeBootstrapApi(elements, 'disable'), bsHandler: (elements) => invokeBootstrapApi(elements, 'disable'),
}); });
export const hide = tooltipApiInvoker({ export const hide = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'close'), glHandler: (element) => tooltipsApp().triggerEvent(element, 'close'),
bsHandler: elements => invokeBootstrapApi(elements, 'hide'), bsHandler: (elements) => invokeBootstrapApi(elements, 'hide'),
}); });
export const show = tooltipApiInvoker({ export const show = tooltipApiInvoker({
glHandler: element => tooltipsApp().triggerEvent(element, 'open'), glHandler: (element) => tooltipsApp().triggerEvent(element, 'open'),
bsHandler: elements => invokeBootstrapApi(elements, 'show'), bsHandler: (elements) => invokeBootstrapApi(elements, 'show'),
}); });
export const destroy = () => { export const destroy = () => {
tooltipsApp().$destroy(); tooltipsApp().$destroy();
......
...@@ -43,7 +43,7 @@ const eventHandler = (e, func, opts = {}) => { ...@@ -43,7 +43,7 @@ const eventHandler = (e, func, opts = {}) => {
}; };
const eventHandlers = (category, func) => { const eventHandlers = (category, func) => {
const handler = opts => e => eventHandler(e, func, { ...{ category }, ...opts }); const handler = (opts) => (e) => eventHandler(e, func, { ...{ category }, ...opts });
const handlers = []; const handlers = [];
handlers.push({ name: 'click', func: handler() }); handlers.push({ name: 'click', func: handler() });
handlers.push({ name: 'show.bs.dropdown', func: handler({ suffix: '_show' }) }); handlers.push({ name: 'show.bs.dropdown', func: handler({ suffix: '_show' }) });
...@@ -79,7 +79,7 @@ export default class Tracking { ...@@ -79,7 +79,7 @@ export default class Tracking {
parent.trackingBound = true; parent.trackingBound = true;
const handlers = eventHandlers(category, (...args) => this.event(...args)); 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; return handlers;
} }
...@@ -88,7 +88,7 @@ export default class Tracking { ...@@ -88,7 +88,7 @@ export default class Tracking {
const loadEvents = parent.querySelectorAll('[data-track-event="render"]'); const loadEvents = parent.querySelectorAll('[data-track-event="render"]');
loadEvents.forEach(element => { loadEvents.forEach((element) => {
const { action, data } = createEventPayload(element); const { action, data } = createEventPayload(element);
this.event(category, action, data); this.event(category, action, data);
}); });
......
...@@ -26,7 +26,7 @@ export default class TreeView { ...@@ -26,7 +26,7 @@ export default class TreeView {
initKeyNav() { initKeyNav() {
const li = $('tr.tree-item'); const li = $('tr.tree-item');
let liSelected = null; let liSelected = null;
return $('body').keydown(e => { return $('body').keydown((e) => {
let next, path; let next, path;
if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) { if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) {
return false; return false;
......
...@@ -10,19 +10,19 @@ export default () => { ...@@ -10,19 +10,19 @@ export default () => {
{ {
order_by: 'last_activity_at', order_by: 'last_activity_at',
}, },
data => { (data) => {
callback(data); callback(data);
}, },
); );
}, },
text: project => project.name_with_namespace || project.name, text: (project) => project.name_with_namespace || project.name,
selectable: true, selectable: true,
fieldName: 'author_id', fieldName: 'author_id',
filterable: true, filterable: true,
search: { search: {
fields: ['name_with_namespace'], fields: ['name_with_namespace'],
}, },
id: data => data.id, id: (data) => data.id,
isSelected: data => data.id === 2, isSelected: (data) => data.id === 2,
}); });
}; };
...@@ -5,7 +5,7 @@ import { parseBoolean } from './lib/utils/common_utils'; ...@@ -5,7 +5,7 @@ import { parseBoolean } from './lib/utils/common_utils';
import { __ } from './locale'; import { __ } from './locale';
export default () => { export default () => {
$('body').on('click', '.js-usage-consent-action', e => { $('body').on('click', '.js-usage-consent-action', (e) => {
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation(); // overwrite rails listener e.stopImmediatePropagation(); // overwrite rails listener
......
...@@ -15,7 +15,7 @@ export default class UserCallout { ...@@ -15,7 +15,7 @@ export default class UserCallout {
init() { init() {
if (!this.isCalloutDismissed || this.isCalloutDismissed === 'false') { 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 }) => { ...@@ -7,7 +7,7 @@ export const fetchUserList = ({ commit, state }) => {
commit(types.REQUEST_USER_LIST); commit(types.REQUEST_USER_LIST);
return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid) return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid)
.then(({ data }) => commit(types.RECEIVE_USER_LIST_SUCCESS, data)) .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); export const dismissErrorAlert = ({ commit }) => commit(types.DISMISS_ERROR_ALERT);
...@@ -18,5 +18,5 @@ export const updateUserList = ({ commit, state }, userList) => { ...@@ -18,5 +18,5 @@ export const updateUserList = ({ commit, state }, userList) => {
name: userList.name, name: userList.name,
}) })
.then(({ data }) => redirectTo(data.path)) .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'; ...@@ -3,7 +3,7 @@ import createState from './state';
import * as actions from './actions'; import * as actions from './actions';
import mutations from './mutations'; import mutations from './mutations';
export default initialState => export default (initialState) =>
new Vuex.Store({ new Vuex.Store({
actions, actions,
mutations, mutations,
......
...@@ -11,5 +11,5 @@ export const createUserList = ({ commit, state }, userList) => { ...@@ -11,5 +11,5 @@ export const createUserList = ({ commit, state }, userList) => {
...userList, ...userList,
}) })
.then(({ data }) => redirectTo(data.path)) .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'; ...@@ -3,7 +3,7 @@ import createState from './state';
import * as actions from './actions'; import * as actions from './actions';
import mutations from './mutations'; import mutations from './mutations';
export default initialState => export default (initialState) =>
new Vuex.Store({ new Vuex.Store({
actions, actions,
mutations, mutations,
......
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