Commit ef02363c authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 32 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 075a78b3
...@@ -848,39 +848,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue ...@@ -848,39 +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
## 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 ## frosty-kare
config/plugins/monaco_webpack.js config/plugins/monaco_webpack.js
config/webpack.config.js config/webpack.config.js
......
...@@ -5,7 +5,7 @@ import { getURLOrigin } from '~/lib/utils/url_utility'; ...@@ -5,7 +5,7 @@ import { getURLOrigin } from '~/lib/utils/url_utility';
const sanitizer = createSanitizer(window); const sanitizer = createSanitizer(window);
const ADD_TAGS = ['iframe']; const ADD_TAGS = ['iframe'];
sanitizer.addHook('uponSanitizeElement', node => { sanitizer.addHook('uponSanitizeElement', (node) => {
if (node.tagName !== 'IFRAME') { if (node.tagName !== 'IFRAME') {
return; return;
} }
...@@ -17,6 +17,6 @@ sanitizer.addHook('uponSanitizeElement', node => { ...@@ -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; export default sanitize;
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
$(this.$refs.dropdownInput) $(this.$refs.dropdownInput)
.val(this.value) .val(this.value)
.select2(this.options) .select2(this.options)
.on('change', event => this.$emit('input', event.target.value)); .on('change', (event) => this.$emit('input', event.target.value));
}) })
.catch(() => {}); .catch(() => {});
}, },
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
}, },
created() { created() {
const rawLabelsColors = gon.suggested_label_colors; const rawLabelsColors = gon.suggested_label_colors;
this.suggestedColors = Object.keys(rawLabelsColors).map(colorCode => ({ this.suggestedColors = Object.keys(rawLabelsColors).map((colorCode) => ({
colorCode, colorCode,
title: rawLabelsColors[colorCode], title: rawLabelsColors[colorCode],
})); }));
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
const labelsString = this.labels.length const labelsString = this.labels.length
? this.labels ? this.labels
.slice(0, 5) .slice(0, 5)
.map(label => label.title) .map((label) => label.title)
.join(', ') .join(', ')
: s__('LabelSelect|Labels'); : s__('LabelSelect|Labels');
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
}, },
suggestedColors() { suggestedColors() {
const colorsMap = gon.suggested_label_colors; 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: { methods: {
......
...@@ -182,9 +182,9 @@ export default { ...@@ -182,9 +182,9 @@ export default {
!state.showDropdownButton && !state.showDropdownButton &&
!state.showDropdownContents !state.showDropdownContents
) { ) {
let filterFn = label => label.touched; let filterFn = (label) => label.touched;
if (this.isDropdownVariantEmbedded) { if (this.isDropdownVariantEmbedded) {
filterFn = label => label.set; filterFn = (label) => label.set;
} }
this.handleDropdownClose(state.labels.filter(filterFn)); this.handleDropdownClose(state.labels.filter(filterFn));
} }
...@@ -204,13 +204,13 @@ export default { ...@@ -204,13 +204,13 @@ export default {
'js-btn-cancel-create', 'js-btn-cancel-create',
'js-sidebar-dropdown-toggle', 'js-sidebar-dropdown-toggle',
].some( ].some(
className => (className) =>
target?.classList.contains(className) || target?.classList.contains(className) ||
target?.parentElement?.classList.contains(className), target?.parentElement?.classList.contains(className),
); );
const hadExceptionParent = ['.js-btn-back', '.js-labels-list'].some( const hadExceptionParent = ['.js-btn-back', '.js-labels-list'].some(
className => $(target).parents(className).length, (className) => $(target).parents(className).length,
); );
if ( if (
......
...@@ -9,7 +9,7 @@ import { DropdownVariant } from '../constants'; ...@@ -9,7 +9,7 @@ import { DropdownVariant } from '../constants';
*/ */
export const dropdownButtonText = (state, getters) => { export const dropdownButtonText = (state, getters) => {
const selectedLabels = getters.isDropdownVariantSidebar const selectedLabels = getters.isDropdownVariantSidebar
? state.labels.filter(label => label.set) ? state.labels.filter((label) => label.set)
: state.selectedLabels; : state.selectedLabels;
if (!selectedLabels.length) { if (!selectedLabels.length) {
...@@ -28,25 +28,25 @@ export const dropdownButtonText = (state, getters) => { ...@@ -28,25 +28,25 @@ export const dropdownButtonText = (state, getters) => {
* selectedLabels array. * selectedLabels array.
* @param {object} state * @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 * Returns boolean representing whether dropdown variant
* is `sidebar` * is `sidebar`
* @param {object} state * @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 * Returns boolean representing whether dropdown variant
* is `standalone` * is `standalone`
* @param {object} state * @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 * Returns boolean representing whether dropdown variant
* is `embedded` * is `embedded`
* @param {object} state * @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 { ...@@ -33,7 +33,7 @@ export default {
// Iterate over every label and add a `set` prop // Iterate over every label and add a `set` prop
// to determine whether it is already a part of // to determine whether it is already a part of
// selectedLabels array. // selectedLabels array.
const selectedLabelIds = state.selectedLabels.map(label => label.id); const selectedLabelIds = state.selectedLabels.map((label) => label.id);
state.labelsFetchInProgress = false; state.labelsFetchInProgress = false;
state.labels = labels.reduce((allLabels, label) => { state.labels = labels.reduce((allLabels, label) => {
allLabels.push({ allLabels.push({
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
// Find the label to update from all the labels // Find the label to update from all the labels
// and change `set` prop value to represent their current state. // and change `set` prop value to represent their current state.
const labelId = labels.pop()?.id; 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) { if (candidateLabel) {
candidateLabel.touched = true; candidateLabel.touched = true;
candidateLabel.set = !candidateLabel.set; candidateLabel.set = !candidateLabel.set;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { isString } from 'lodash'; import { isString } from 'lodash';
import { GlDropdown, GlDropdownDivider, GlDropdownItem } from '@gitlab/ui'; import { GlDropdown, GlDropdownDivider, GlDropdownItem } from '@gitlab/ui';
const isValidItem = item => const isValidItem = (item) =>
isString(item.eventName) && isString(item.title) && isString(item.description); isString(item.eventName) && isString(item.title) && isString(item.description);
export default { export default {
......
...@@ -17,8 +17,8 @@ export default { ...@@ -17,8 +17,8 @@ export default {
}, },
methods: { methods: {
updateTabs() { updateTabs() {
this.tabs = this.$children.filter(child => child.isTab); this.tabs = this.$children.filter((child) => child.isTab);
this.currentIndex = this.tabs.findIndex(tab => tab.localActive); this.currentIndex = this.tabs.findIndex((tab) => tab.localActive);
}, },
setTab(e, index) { setTab(e, index) {
if (this.stopPropagation) { if (this.stopPropagation) {
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
href: '#', href: '#',
}, },
on: { on: {
click: e => this.setTab(e, i), click: (e) => this.setTab(e, i),
}, },
}, },
tab.$slots.title || tab.title, tab.$slots.title || tab.title,
......
...@@ -36,14 +36,14 @@ export default { ...@@ -36,14 +36,14 @@ export default {
}, },
computed: { computed: {
timezones() { timezones() {
return this.timezoneData.map(timezone => ({ return this.timezoneData.map((timezone) => ({
formattedTimezone: this.formatTimezone(timezone), formattedTimezone: this.formatTimezone(timezone),
identifier: timezone.identifier, identifier: timezone.identifier,
})); }));
}, },
filteredResults() { filteredResults() {
const lowerCasedSearchTerm = this.searchTerm.toLowerCase(); const lowerCasedSearchTerm = this.searchTerm.toLowerCase();
return this.timezones.filter(timezone => return this.timezones.filter((timezone) =>
timezone.formattedTimezone.toLowerCase().includes(lowerCasedSearchTerm), timezone.formattedTimezone.toLowerCase().includes(lowerCasedSearchTerm),
); );
}, },
......
...@@ -72,7 +72,7 @@ export default { ...@@ -72,7 +72,7 @@ export default {
}, },
computed: { computed: {
actions() { actions() {
return [this.webIdeAction, this.editAction, this.gitpodAction].filter(action => action); return [this.webIdeAction, this.editAction, this.gitpodAction].filter((action) => action);
}, },
editAction() { editAction() {
if (!this.showEditButton) { if (!this.showEditButton) {
......
...@@ -11,8 +11,8 @@ export default { ...@@ -11,8 +11,8 @@ export default {
inserted(el) { inserted(el) {
if ('IntersectionObserver' in window) { if ('IntersectionObserver' in window) {
// Element visibility is dynamic, so we attach observer // Element visibility is dynamic, so we attach observer
el.visibilityObserver = new IntersectionObserver(entries => { el.visibilityObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => { entries.forEach((entry) => {
// Combining `intersectionRatio > 0` and // Combining `intersectionRatio > 0` and
// element's `offsetParent` presence will // element's `offsetParent` presence will
// deteremine if element is truely visible // deteremine if element is truely visible
......
...@@ -12,19 +12,19 @@ import { s__ } from '~/locale'; ...@@ -12,19 +12,19 @@ import { s__ } from '~/locale';
*/ */
const defaultFeedbackMap = { const defaultFeedbackMap = {
valueMissing: { valueMissing: {
isInvalid: el => el.validity?.valueMissing, isInvalid: (el) => el.validity?.valueMissing,
message: s__('Please fill out this field.'), message: s__('Please fill out this field.'),
}, },
urlTypeMismatch: { 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'), message: s__('Please enter a valid URL format, ex: http://www.example.com/home'),
}, },
}; };
const getFeedbackForElement = (feedbackMap, el) => 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 { target: formEl } = e;
const invalidInput = formEl.querySelector('input:invalid'); const invalidInput = formEl.querySelector('input:invalid');
...@@ -33,7 +33,7 @@ const focusFirstInvalidInput = e => { ...@@ -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 createValidator = (context, feedbackMap) => ({ el, reportInvalidInput = false }) => {
const { form } = context; const { form } = context;
......
export default Vue => { export default (Vue) => {
Vue.mixin({ Vue.mixin({
provide: { provide: {
glFeatures: { ...((window.gon && window.gon.features) || {}) }, glFeatures: { ...((window.gon && window.gon.features) || {}) },
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
this.poll.stop(); this.poll.stop();
const queryString = Object.keys(parameters) const queryString = Object.keys(parameters)
.map(parameter => { .map((parameter) => {
const value = parameters[parameter]; const value = parameters[parameter];
// update internal state for UI // update internal state for UI
this[parameter] = value; this[parameter] = value;
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
projectPath: this.targetProjectFullPath, projectPath: this.targetProjectFullPath,
iid: String(this.mrIid), iid: String(this.mrIid),
reportTypes: this.$options.reportTypes.map( reportTypes: this.$options.reportTypes.map(
reportType => reportTypeToSecurityReportTypeEnum[reportType], (reportType) => reportTypeToSecurityReportTypeEnum[reportType],
), ),
}; };
}, },
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
created() { created() {
if (!this.canShowDownloads) { if (!this.canShowDownloads) {
this.checkAvailableSecurityReports(this.$options.reportTypes) this.checkAvailableSecurityReports(this.$options.reportTypes)
.then(availableSecurityReports => { .then((availableSecurityReports) => {
this.onCheckingAvailableSecurityReports(Array.from(availableSecurityReports)); this.onCheckingAvailableSecurityReports(Array.from(availableSecurityReports));
}) })
.catch(this.showError); .catch(this.showError);
......
...@@ -3,7 +3,7 @@ import { countVulnerabilities, groupedTextBuilder } from './utils'; ...@@ -3,7 +3,7 @@ import { countVulnerabilities, groupedTextBuilder } from './utils';
import { LOADING, ERROR, SUCCESS } from '~/reports/constants'; import { LOADING, ERROR, SUCCESS } from '~/reports/constants';
import { TRANSLATION_IS_LOADING } from './messages'; import { TRANSLATION_IS_LOADING } from './messages';
export const summaryCounts = state => export const summaryCounts = (state) =>
countVulnerabilities( countVulnerabilities(
state.reportTypes.reduce((acc, reportType) => { state.reportTypes.reduce((acc, reportType) => {
acc.push(...state[reportType].newIssues); acc.push(...state[reportType].newIssues);
...@@ -50,17 +50,17 @@ export const summaryStatus = (state, getters) => { ...@@ -50,17 +50,17 @@ export const summaryStatus = (state, getters) => {
return SUCCESS; return SUCCESS;
}; };
export const areReportsLoading = state => export const areReportsLoading = (state) =>
state.reportTypes.some(reportType => state[reportType].isLoading); state.reportTypes.some((reportType) => state[reportType].isLoading);
export const areAllReportsLoading = state => export const areAllReportsLoading = (state) =>
state.reportTypes.every(reportType => state[reportType].isLoading); state.reportTypes.every((reportType) => state[reportType].isLoading);
export const allReportsHaveError = state => export const allReportsHaveError = (state) =>
state.reportTypes.every(reportType => state[reportType].hasError); state.reportTypes.every((reportType) => state[reportType].hasError);
export const anyReportHasError = state => export const anyReportHasError = (state) =>
state.reportTypes.some(reportType => state[reportType].hasError); state.reportTypes.some((reportType) => state[reportType].hasError);
export const anyReportHasIssues = state => export const anyReportHasIssues = (state) =>
state.reportTypes.some(reportType => state[reportType].newIssues.length > 0); state.reportTypes.some((reportType) => state[reportType].newIssues.length > 0);
...@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => { ...@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestDiff'); dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'sast') return fetchDiffData(rootState, state.paths.diffEndpoint, 'sast')
.then(data => { .then((data) => {
dispatch('receiveDiffSuccess', data); dispatch('receiveDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
......
...@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => { ...@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestDiff'); dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection') return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection')
.then(data => { .then((data) => {
dispatch('receiveDiffSuccess', data); dispatch('receiveDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
......
...@@ -29,7 +29,7 @@ export const fetchDiffData = (state, endpoint, category) => { ...@@ -29,7 +29,7 @@ export const fetchDiffData = (state, endpoint, category) => {
*/ */
export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) => export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) =>
feedback feedback
.filter(fb => fb.project_fingerprint === vulnerability.project_fingerprint) .filter((fb) => fb.project_fingerprint === vulnerability.project_fingerprint)
.reduce((vuln, fb) => { .reduce((vuln, fb) => {
if (fb.feedback_type === FEEDBACK_TYPE_DISMISSAL) { if (fb.feedback_type === FEEDBACK_TYPE_DISMISSAL) {
return { return {
...@@ -63,7 +63,7 @@ export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) => ...@@ -63,7 +63,7 @@ export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) =>
* @returns {Object} * @returns {Object}
*/ */
export const parseDiff = (diff, enrichData) => { export const parseDiff = (diff, enrichData) => {
const enrichVulnerability = vulnerability => ({ const enrichVulnerability = (vulnerability) => ({
...enrichVulnerabilityWithFeedback(vulnerability, enrichData), ...enrichVulnerabilityWithFeedback(vulnerability, enrichData),
category: vulnerability.report_type, category: vulnerability.report_type,
title: vulnerability.message || vulnerability.name, title: vulnerability.message || vulnerability.name,
......
import { __, n__, s__, sprintf } from '../locale'; import { __, n__, s__, sprintf } from '../locale';
export default Vue => { export default (Vue) => {
Vue.mixin({ Vue.mixin({
methods: { methods: {
/** /**
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
export const mapComputed = (list, defaultUpdateFn, root) => { export const mapComputed = (list, defaultUpdateFn, root) => {
const result = {}; const result = {};
list.forEach(item => { list.forEach((item) => {
const [getter, key, updateFn] = const [getter, key, updateFn] =
typeof item === 'string' typeof item === 'string'
? [false, item, defaultUpdateFn] ? [false, item, defaultUpdateFn]
......
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
this.setDrawerBodyHeight(height); this.setDrawerBodyHeight(height);
}, },
featuresForVersion(version) { featuresForVersion(version) {
return this.features.filter(feature => { return this.features.filter((feature) => {
return feature.release === parseFloat(version); return feature.release === parseFloat(version);
}); });
}, },
......
...@@ -6,7 +6,7 @@ import { getStorageKey, setNotification } from './utils/notification'; ...@@ -6,7 +6,7 @@ import { getStorageKey, setNotification } from './utils/notification';
let whatsNewApp; let whatsNewApp;
export default el => { export default (el) => {
if (whatsNewApp) { if (whatsNewApp) {
store.dispatch('openDrawer'); store.dispatch('openDrawer');
} else { } else {
......
export const getDrawerBodyHeight = drawer => { export const getDrawerBodyHeight = (drawer) => {
const drawerViewableHeight = drawer.clientHeight - drawer.getBoundingClientRect().top; const drawerViewableHeight = drawer.clientHeight - drawer.getBoundingClientRect().top;
const drawerHeaderHeight = drawer.querySelector('.gl-drawer-header').clientHeight; 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 storageKey = getStorageKey(appEl);
const notificationEl = document.querySelector('.header-help'); const notificationEl = document.querySelector('.header-help');
let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count'); let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count');
......
...@@ -39,21 +39,21 @@ export default class ZenMode { ...@@ -39,21 +39,21 @@ export default class ZenMode {
constructor() { constructor() {
this.active_backdrop = null; this.active_backdrop = null;
this.active_textarea = null; this.active_textarea = null;
$(document).on('click', '.js-zen-enter', e => { $(document).on('click', '.js-zen-enter', (e) => {
e.preventDefault(); e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:enter'); return $(e.currentTarget).trigger('zen_mode:enter');
}); });
$(document).on('click', '.js-zen-leave', e => { $(document).on('click', '.js-zen-leave', (e) => {
e.preventDefault(); e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:leave'); 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')); this.enter($(e.target).closest('.md-area').find('.zen-backdrop'));
}); });
$(document).on('zen_mode:leave', () => { $(document).on('zen_mode:leave', () => {
this.exit(); this.exit();
}); });
$(document).on('keydown', e => { $(document).on('keydown', (e) => {
// Esc // Esc
if (e.keyCode === 27) { if (e.keyCode === 27) {
e.preventDefault(); e.preventDefault();
......
/** /**
* Returns true if the given module is required from eslint * Returns true if the given module is required from eslint
*/ */
const isESLint = mod => { const isESLint = (mod) => {
let parent = mod.parent; let parent = mod.parent;
while (parent) { while (parent) {
......
...@@ -9,9 +9,9 @@ const CACHE_PATHS = [ ...@@ -9,9 +9,9 @@ const CACHE_PATHS = [
'./yarn.lock', './yarn.lock',
]; ];
const resolvePath = file => path.resolve(__dirname, '../..', file); const resolvePath = (file) => path.resolve(__dirname, '../..', file);
const readFile = file => fs.readFileSync(file); const readFile = (file) => fs.readFileSync(file);
const fileHash = buffer => crypto.createHash('md5').update(buffer).digest('hex'); const fileHash = (buffer) => crypto.createHash('md5').update(buffer).digest('hex');
module.exports = () => { module.exports = () => {
const fileBuffers = CACHE_PATHS.map(resolvePath).map(readFile); const fileBuffers = CACHE_PATHS.map(resolvePath).map(readFile);
......
...@@ -71,13 +71,13 @@ const createContext = (specFiles, regex, suffix) => { ...@@ -71,13 +71,13 @@ const createContext = (specFiles, regex, suffix) => {
if (specFilters.length) { if (specFilters.length) {
// resolve filters // resolve filters
let filteredSpecFiles = specFilters.map(filter => let filteredSpecFiles = specFilters.map((filter) =>
glob glob
.sync(filter, { .sync(filter, {
root: ROOT_PATH, root: ROOT_PATH,
matchBase: true, matchBase: true,
}) })
.filter(path => path.endsWith('spec.js')), .filter((path) => path.endsWith('spec.js')),
); );
// flatten // flatten
...@@ -92,14 +92,14 @@ if (specFilters.length) { ...@@ -92,14 +92,14 @@ if (specFilters.length) {
exit('Your filter did not match any test files.', isError); 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.'); 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'); 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'); createContext(EE_FILES, /ee[\\\/]spec[\\\/]javascripts$/, 'ee/spec/javascripts');
} }
......
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