Commit 78947ddd authored by Mark Florian's avatar Mark Florian

Remove no-op default exports

These no-op default exports have served one or both of these purposes:

1. Preventing `babel-plugin-rewire` from generating an invalid default
   during karma tests;
1. Working around the `import/prefer-default-export` ESLint rule for
   files which only have one named export.

As we recently finished migrating all relevant specs from Karma to Jest,
the first purpose is no longer necessary (with two exceptions, see
below).

The second purpose will become unnecessary once the [RFC][1] to prefer
named exports to default exports is implemented.

As such, this commit removes almost all no-op default exports, and adds
explicit `eslint-disable-next-line` directives (which can be removed
once the RFC is implemented).

---

This work was achieved in a few steps. First, the default exports
explicitly marked as `babel-plugin-rewire` workarounds were removed.

This was achieved via this command:

    rg --color=never -l0 "// prevent babel-plugin-rewire" \
        | xargs -0 \
        perl -0pi -e \
        's/\n+\/\/ prevent babel-plugin-rewire[^\n]*tests'\
    '(?:\nexport default \(\) => {};)?//mgs'

The documentation describing this workaround was then removed by hand.

Unfortunately, two files still participate in Karma tests, and still
need this workaround, so these were reverted manually. Those files (at
the time of writing) are:

    app/assets/javascripts/monitoring/stores/actions.js
    app/assets/javascripts/monitoring/stores/getters.js

Then, all additional no-op default exports were removed with this
command:

    rg --color=never -l0 -F "export default () => {};" \
        | xargs -0 perl -0pi -e 's/\n+export default \(\) => {};//mgs'

Since the `import/prefer-default-export` ESLint rule is still in place,
the files violating it have to disable it explicitly.

With the [RFC][1] to prefer named exports to default exports receiving
wide approval, it makes sense to mark these current violations
_explicitly_ with `eslint-disable-next-line` directives, rather than
_implicitly_ via the no-op default export hack.

The benefit of this approach is that when we disable the
`import/prefer-default-export` rule globally for the RFC, ESLint will
warn about all of these now-unnecessary directives. This will make it
much easier to address all of them (perhaps even automatically, via
`--fix`!).

[1]: https://gitlab.com/gitlab-org/frontend/rfcs/-/issues/20
parent 149d907c
...@@ -23,6 +23,3 @@ export const receiveStatisticsError = ({ commit }, error) => { ...@@ -23,6 +23,3 @@ export const receiveStatisticsError = ({ commit }, error) => {
commit(types.RECEIVE_STATISTICS_ERROR, error); commit(types.RECEIVE_STATISTICS_ERROR, error);
createFlash(s__('AdminDashboard|Error loading the statistics. Please try again')); createFlash(s__('AdminDashboard|Error loading the statistics. Please try again'));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* and returns an array of the following form: * and returns an array of the following form:
* [{ key: "forks", label: "Forks", value: 50 }] * [{ key: "forks", label: "Forks", value: 50 }]
*/ */
// eslint-disable-next-line import/prefer-default-export
export const getStatistics = state => labels => export const getStatistics = state => labels =>
Object.keys(labels).map(key => { Object.keys(labels).map(key => {
const result = { const result = {
...@@ -12,6 +13,3 @@ export const getStatistics = state => labels => ...@@ -12,6 +13,3 @@ export const getStatistics = state => labels =>
}; };
return result; return result;
}); });
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -146,6 +146,3 @@ export const expandAllDiscussions = ({ dispatch, state }) => ...@@ -146,6 +146,3 @@ export const expandAllDiscussions = ({ dispatch, state }) =>
export const toggleResolveDiscussion = ({ commit }, draftId) => { export const toggleResolveDiscussion = ({ commit }, draftId) => {
commit(types.TOGGLE_RESOLVE_DISCUSSION, draftId); commit(types.TOGGLE_RESOLVE_DISCUSSION, draftId);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -82,6 +82,3 @@ export const isPublishingDraft = state => draftId => ...@@ -82,6 +82,3 @@ export const isPublishingDraft = state => draftId =>
state.currentlyPublishingDrafts.indexOf(draftId) !== -1; state.currentlyPublishingDrafts.indexOf(draftId) !== -1;
export const sortedDrafts = state => [...state.drafts].sort((a, b) => a.id > b.id); export const sortedDrafts = state => [...state.drafts].sort((a, b) => a.id > b.id);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -76,6 +76,3 @@ export const fetchClusters = ({ state, commit, dispatch }) => { ...@@ -76,6 +76,3 @@ export const fetchClusters = ({ state, commit, dispatch }) => {
export const setPage = ({ commit }, page) => { export const setPage = ({ commit }, page) => {
commit(types.SET_PAGE, page); commit(types.SET_PAGE, page);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -3,6 +3,7 @@ import { __ } from '~/locale'; ...@@ -3,6 +3,7 @@ import { __ } from '~/locale';
import service from '../services/contributors_service'; import service from '../services/contributors_service';
import * as types from './mutation_types'; import * as types from './mutation_types';
// eslint-disable-next-line import/prefer-default-export
export const fetchChartData = ({ commit }, endpoint) => { export const fetchChartData = ({ commit }, endpoint) => {
commit(types.SET_LOADING_STATE, true); commit(types.SET_LOADING_STATE, true);
...@@ -15,6 +16,3 @@ export const fetchChartData = ({ commit }, endpoint) => { ...@@ -15,6 +16,3 @@ export const fetchChartData = ({ commit }, endpoint) => {
}) })
.catch(() => flash(__('An error occurred while loading chart data'))); .catch(() => flash(__('An error occurred while loading chart data')));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -28,6 +28,3 @@ export const parsedData = state => { ...@@ -28,6 +28,3 @@ export const parsedData = state => {
byAuthorEmail, byAuthorEmail,
}; };
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -90,6 +90,3 @@ export const fetchMachineTypes = ({ commit, state }) => ...@@ -90,6 +90,3 @@ export const fetchMachineTypes = ({ commit, state }) =>
mutation: types.SET_MACHINE_TYPES, mutation: types.SET_MACHINE_TYPES,
payloadKey: 'items', payloadKey: 'items',
}); });
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -759,6 +759,3 @@ export const navigateToDiffFileIndex = ({ commit, state }, index) => { ...@@ -759,6 +759,3 @@ export const navigateToDiffFileIndex = ({ commit, state }, index) => {
commit(types.UPDATE_CURRENT_DIFF_FILE_ID, fileHash); commit(types.UPDATE_CURRENT_DIFF_FILE_ID, fileHash);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -74,7 +74,6 @@ export const getDiffFileDiscussions = (state, getters, rootState, rootGetters) = ...@@ -74,7 +74,6 @@ export const getDiffFileDiscussions = (state, getters, rootState, rootGetters) =
discussion => discussion.diff_discussion && discussion.diff_file.file_hash === diff.file_hash, discussion => discussion.diff_discussion && discussion.diff_file.file_hash === diff.file_hash,
) || []; ) || [];
// prevent babel-plugin-rewire from generating an invalid default during karma∂ tests
export const getDiffFileByHash = state => fileHash => export const getDiffFileByHash = state => fileHash =>
state.diffFiles.find(file => file.file_hash === fileHash); state.diffFiles.find(file => file.file_hash === fileHash);
...@@ -130,6 +129,3 @@ export const fileLineCoverage = state => (file, line) => { ...@@ -130,6 +129,3 @@ export const fileLineCoverage = state => (file, line) => {
*/ */
export const currentDiffIndex = state => export const currentDiffIndex = state =>
Math.max(0, state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId)); Math.max(0, state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId));
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -34,5 +34,3 @@ export const updateIgnoreStatus = ({ commit, dispatch }, params) => { ...@@ -34,5 +34,3 @@ export const updateIgnoreStatus = ({ commit, dispatch }, params) => {
commit(types.SET_UPDATING_IGNORE_STATUS, false); commit(types.SET_UPDATING_IGNORE_STATUS, false);
}); });
}; };
export default () => {};
...@@ -10,6 +10,7 @@ const stopPolling = poll => { ...@@ -10,6 +10,7 @@ const stopPolling = poll => {
if (poll) poll.stop(); if (poll) poll.stop();
}; };
// eslint-disable-next-line import/prefer-default-export
export function startPollingStacktrace({ commit }, endpoint) { export function startPollingStacktrace({ commit }, endpoint) {
stackTracePoll = new Poll({ stackTracePoll = new Poll({
resource: service, resource: service,
...@@ -32,5 +33,3 @@ export function startPollingStacktrace({ commit }, endpoint) { ...@@ -32,5 +33,3 @@ export function startPollingStacktrace({ commit }, endpoint) {
stackTracePoll.makeRequest(); stackTracePoll.makeRequest();
} }
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const stacktrace = state => export const stacktrace = state =>
state.stacktraceData.stack_trace_entries state.stacktraceData.stack_trace_entries
? state.stacktraceData.stack_trace_entries.reverse() ? state.stacktraceData.stack_trace_entries.reverse()
: []; : [];
export default () => {};
...@@ -102,5 +102,3 @@ export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => { ...@@ -102,5 +102,3 @@ export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => {
export const removeIgnoredResolvedErrors = ({ commit }, error) => { export const removeIgnoredResolvedErrors = ({ commit }, error) => {
commit(types.REMOVE_IGNORED_RESOLVED_ERRORS, error); commit(types.REMOVE_IGNORED_RESOLVED_ERRORS, error);
}; };
export default () => {};
...@@ -89,6 +89,3 @@ export const updateSelectedProject = ({ commit }, selectedProject) => { ...@@ -89,6 +89,3 @@ export const updateSelectedProject = ({ commit }, selectedProject) => {
export const setInitialState = ({ commit }, data) => { export const setInitialState = ({ commit }, data) => {
commit(types.SET_INITIAL_STATE, data); commit(types.SET_INITIAL_STATE, data);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -39,6 +39,3 @@ export const projectSelectionLabel = state => { ...@@ -39,6 +39,3 @@ export const projectSelectionLabel = state => {
} }
return s__('ErrorTracking|To enable project selection, enter a valid Auth Token'); return s__('ErrorTracking|To enable project selection, enter a valid Auth Token');
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -14,5 +14,3 @@ export const transformFrontendSettings = ({ apiHost, enabled, token, selectedPro ...@@ -14,5 +14,3 @@ export const transformFrontendSettings = ({ apiHost, enabled, token, selectedPro
}; };
export const getDisplayName = project => `${project.organizationName} | ${project.slug}`; export const getDisplayName = project => `${project.organizationName} | ${project.slug}`;
export default () => {};
...@@ -76,6 +76,3 @@ export const setSearchQuery = ({ commit, dispatch }, query) => { ...@@ -76,6 +76,3 @@ export const setSearchQuery = ({ commit, dispatch }, query) => {
dispatch('fetchFrequentItems'); dispatch('fetchFrequentItems');
} }
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const hasSearchQuery = state => state.searchQuery !== ''; export const hasSearchQuery = state => state.searchQuery !== '';
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -32,5 +32,3 @@ export const fetchBranches = ({ dispatch, rootGetters }, { search = '' }) => { ...@@ -32,5 +32,3 @@ export const fetchBranches = ({ dispatch, rootGetters }, { search = '' }) => {
}; };
export const resetBranches = ({ commit }) => commit(types.RESET_BRANCHES); export const resetBranches = ({ commit }) => commit(types.RESET_BRANCHES);
export default () => {};
...@@ -23,5 +23,3 @@ export const templateTypes = () => [ ...@@ -23,5 +23,3 @@ export const templateTypes = () => [
export const showFileTemplatesBar = (_, getters, rootState) => name => export const showFileTemplatesBar = (_, getters, rootState) => name =>
getters.templateTypes.find(t => t.name === name) && getters.templateTypes.find(t => t.name === name) &&
rootState.currentActivityView === leftSidebarViews.edit.name; rootState.currentActivityView === leftSidebarViews.edit.name;
export default () => {};
...@@ -41,5 +41,3 @@ export const fetchMergeRequests = ( ...@@ -41,5 +41,3 @@ export const fetchMergeRequests = (
}; };
export const resetMergeRequests = ({ commit }) => commit(types.RESET_MERGE_REQUESTS); export const resetMergeRequests = ({ commit }) => commit(types.RESET_MERGE_REQUESTS);
export default () => {};
...@@ -149,5 +149,3 @@ export const resetLatestPipeline = ({ commit }) => { ...@@ -149,5 +149,3 @@ export const resetLatestPipeline = ({ commit }) => {
commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, null); commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, null);
commit(types.SET_DETAIL_JOB, null); commit(types.SET_DETAIL_JOB, null);
}; };
export default () => {};
...@@ -20,5 +20,3 @@ export const failedJobsCount = state => ...@@ -20,5 +20,3 @@ export const failedJobsCount = state =>
); );
export const jobsCount = state => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0); export const jobsCount = state => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0);
export default () => {};
...@@ -2,4 +2,3 @@ export * from './setup'; ...@@ -2,4 +2,3 @@ export * from './setup';
export * from './checks'; export * from './checks';
export * from './session_controls'; export * from './session_controls';
export * from './session_status'; export * from './session_status';
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const allCheck = state => { export const allCheck = state => {
const checks = Object.values(state.checks); const checks = Object.values(state.checks);
...@@ -15,5 +16,3 @@ export const allCheck = state => { ...@@ -15,5 +16,3 @@ export const allCheck = state => {
message, message,
}; };
}; };
export default () => {};
...@@ -128,6 +128,3 @@ export const fetchJobs = ({ state, commit, dispatch }) => { ...@@ -128,6 +128,3 @@ export const fetchJobs = ({ state, commit, dispatch }) => {
} }
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -247,6 +247,3 @@ export const triggerManualJob = ({ state }, variables) => { ...@@ -247,6 +247,3 @@ export const triggerManualJob = ({ state }, variables) => {
}) })
.catch(() => flash(__('An error occurred while triggering the job.'))); .catch(() => flash(__('An error occurred while triggering the job.')));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -46,6 +46,3 @@ export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceCo ...@@ -46,6 +46,3 @@ export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceCo
export const hasRunnersForProject = state => export const hasRunnersForProject = state =>
state.job.runners.available && !state.job.runners.online; state.job.runners.available && !state.job.runners.online;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -200,6 +200,3 @@ export const dismissRequestLogsError = ({ commit }) => { ...@@ -200,6 +200,3 @@ export const dismissRequestLogsError = ({ commit }) => {
export const dismissInvalidTimeRangeWarning = ({ commit }) => { export const dismissInvalidTimeRangeWarning = ({ commit }) => {
commit(types.HIDE_TIME_RANGE_INVALID_WARNING); commit(types.HIDE_TIME_RANGE_INVALID_WARNING);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
import * as types from './mutation_types'; import * as types from './mutation_types';
// eslint-disable-next-line import/prefer-default-export
export const addModule = ({ commit }, data) => commit(types.ADD_MODULE, data); export const addModule = ({ commit }, data) => commit(types.ADD_MODULE, data);
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const metricsWithData = (state, getters, rootState, rootGetters) => export const metricsWithData = (state, getters, rootState, rootGetters) =>
state.modules.map(module => rootGetters[`${module}/metricsWithData`]().length); state.modules.map(module => rootGetters[`${module}/metricsWithData`]().length);
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const ADD_MODULE = 'ADD_MODULE'; export const ADD_MODULE = 'ADD_MODULE';
export default () => {};
...@@ -682,6 +682,3 @@ export const receiveDeleteDescriptionVersionError = ({ commit }, error) => { ...@@ -682,6 +682,3 @@ export const receiveDeleteDescriptionVersionError = ({ commit }, error) => {
export const updateAssignees = ({ commit }, assignees) => { export const updateAssignees = ({ commit }, assignees) => {
commit(types.UPDATE_ASSIGNEES, assignees); commit(types.UPDATE_ASSIGNEES, assignees);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -229,6 +229,3 @@ export const getDiscussion = state => discussionId => ...@@ -229,6 +229,3 @@ export const getDiscussion = state => discussionId =>
state.discussions.find(discussion => discussion.id === discussionId); state.discussions.find(discussion => discussion.id === discussionId);
export const commentsDisabled = state => state.commentsDisabled; export const commentsDisabled = state => state.commentsDisabled;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -37,6 +37,3 @@ export const receiveSaveChangesError = (_, error) => { ...@@ -37,6 +37,3 @@ export const receiveSaveChangesError = (_, error) => {
createFlash(`${__('There was an error saving your changes.')} ${message}`, 'alert'); createFlash(`${__('There was an error saving your changes.')} ${message}`, 'alert');
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -52,6 +52,3 @@ export const setSelectedSuiteIndex = ({ commit }, data) => ...@@ -52,6 +52,3 @@ export const setSelectedSuiteIndex = ({ commit }, data) =>
export const removeSelectedSuiteIndex = ({ commit }) => export const removeSelectedSuiteIndex = ({ commit }) =>
commit(types.SET_SELECTED_SUITE_INDEX, null); commit(types.SET_SELECTED_SUITE_INDEX, null);
export const toggleLoading = ({ commit }) => commit(types.TOGGLE_LOADING); export const toggleLoading = ({ commit }) => commit(types.TOGGLE_LOADING);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -16,6 +16,3 @@ export const getSuiteTests = state => { ...@@ -16,6 +16,3 @@ export const getSuiteTests = state => {
const { test_cases: testCases = [] } = getSelectedSuite(state); const { test_cases: testCases = [] } = getSelectedSuite(state);
return testCases.sort(sortTestCases).map(addIconStatus); return testCases.sort(sortTestCases).map(addIconStatus);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
import { pickBy } from 'lodash'; import { pickBy } from 'lodash';
import { SUPPORTED_FILTER_PARAMETERS } from './constants'; import { SUPPORTED_FILTER_PARAMETERS } from './constants';
// eslint-disable-next-line import/prefer-default-export
export const validateParams = params => { export const validateParams = params => {
return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val); return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val);
}; };
export default () => {};
...@@ -102,5 +102,3 @@ export const requestDeleteImage = ({ commit }, image) => { ...@@ -102,5 +102,3 @@ export const requestDeleteImage = ({ commit }, image) => {
commit(types.SET_MAIN_LOADING, false); commit(types.SET_MAIN_LOADING, false);
}); });
}; };
export default () => {};
...@@ -28,6 +28,3 @@ export const saveSettings = ({ dispatch, state }) => { ...@@ -28,6 +28,3 @@ export const saveSettings = ({ dispatch, state }) => {
) )
.finally(() => dispatch('toggleLoading')); .finally(() => dispatch('toggleLoading'));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -32,6 +32,3 @@ export const fetchMergeRequests = ({ state, dispatch }) => { ...@@ -32,6 +32,3 @@ export const fetchMergeRequests = ({ state, dispatch }) => {
createFlash(s__('Something went wrong while fetching related merge requests.')); createFlash(s__('Something went wrong while fetching related merge requests.'));
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -43,6 +43,3 @@ export const receiveReleasesError = ({ commit }) => { ...@@ -43,6 +43,3 @@ export const receiveReleasesError = ({ commit }) => {
commit(types.RECEIVE_RELEASES_ERROR); commit(types.RECEIVE_RELEASES_ERROR);
createFlash(__('An error occurred while fetching the releases. Please try again.')); createFlash(__('An error occurred while fetching the releases. Please try again.'));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -74,6 +74,3 @@ export const receiveReportError = ({ commit, dispatch }) => { ...@@ -74,6 +74,3 @@ export const receiveReportError = ({ commit, dispatch }) => {
commit(types.RECEIVE_REPORT_ERROR); commit(types.RECEIVE_REPORT_ERROR);
dispatch('stopPolling'); dispatch('stopPolling');
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -43,6 +43,3 @@ export const shouldRenderIssuesList = state => ...@@ -43,6 +43,3 @@ export const shouldRenderIssuesList = state =>
export const unresolvedIssues = state => state.report.existing_errors; export const unresolvedIssues = state => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_errors; export const resolvedIssues = state => state.report.resolved_errors;
export const newIssues = state => state.report.new_errors; export const newIssues = state => state.report.new_errors;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -85,6 +85,3 @@ export const openModal = ({ dispatch }, payload) => { ...@@ -85,6 +85,3 @@ export const openModal = ({ dispatch }, payload) => {
}; };
export const setModalData = ({ commit }, payload) => commit(types.SET_ISSUE_MODAL_DATA, payload); export const setModalData = ({ commit }, payload) => commit(types.SET_ISSUE_MODAL_DATA, payload);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../constants'; import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../constants';
// eslint-disable-next-line import/prefer-default-export
export const summaryStatus = state => { export const summaryStatus = state => {
if (state.isLoading) { if (state.isLoading) {
return LOADING; return LOADING;
...@@ -11,6 +12,3 @@ export const summaryStatus = state => { ...@@ -11,6 +12,3 @@ export const summaryStatus = state => {
return SUCCESS; return SUCCESS;
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -123,6 +123,3 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => { ...@@ -123,6 +123,3 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
createFlash(error); createFlash(error);
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -5,6 +5,3 @@ export const hasPrometheusMissingData = state => state.hasPrometheus && !state.h ...@@ -5,6 +5,3 @@ export const hasPrometheusMissingData = state => state.hasPrometheus && !state.h
// Convert the function list into a k/v grouping based on the environment scope // Convert the function list into a k/v grouping based on the environment scope
export const getFunctions = state => translate(state.functions); export const getFunctions = state => translate(state.functions);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -18,6 +18,3 @@ export const translate = functions => ...@@ -18,6 +18,3 @@ export const translate = functions =>
}), }),
{}, {},
); );
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -38,5 +38,3 @@ export const SnippetShowInit = () => { ...@@ -38,5 +38,3 @@ export const SnippetShowInit = () => {
export const SnippetEditInit = () => { export const SnippetEditInit = () => {
appFactory(document.getElementById('js-snippet-edit'), SnippetsEdit); appFactory(document.getElementById('js-snippet-edit'), SnippetsEdit);
}; };
export default () => {};
...@@ -2,6 +2,7 @@ import GetSnippetQuery from '../queries/snippet.query.graphql'; ...@@ -2,6 +2,7 @@ import GetSnippetQuery from '../queries/snippet.query.graphql';
const blobsDefault = []; const blobsDefault = [];
// eslint-disable-next-line import/prefer-default-export
export const getSnippetMixin = { export const getSnippetMixin = {
apollo: { apollo: {
snippet: { snippet: {
...@@ -39,5 +40,3 @@ export const getSnippetMixin = { ...@@ -39,5 +40,3 @@ export const getSnippetMixin = {
}, },
}, },
}; };
export default () => {};
...@@ -69,6 +69,3 @@ export const receiveArtifactsSuccess = ({ commit }, response) => { ...@@ -69,6 +69,3 @@ export const receiveArtifactsSuccess = ({ commit }, response) => {
}; };
export const receiveArtifactsError = ({ commit }) => commit(types.RECEIVE_ARTIFACTS_ERROR); export const receiveArtifactsError = ({ commit }) => commit(types.RECEIVE_ARTIFACTS_ERROR);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
import { s__, n__ } from '~/locale'; import { s__, n__ } from '~/locale';
// eslint-disable-next-line import/prefer-default-export
export const title = state => { export const title = state => {
if (state.isLoading) { if (state.isLoading) {
return s__('BuildArtifacts|Loading artifacts'); return s__('BuildArtifacts|Loading artifacts');
...@@ -11,6 +12,3 @@ export const title = state => { ...@@ -11,6 +12,3 @@ export const title = state => {
return n__('View exposed artifact', 'View %d exposed artifacts', state.artifacts.length); return n__('View exposed artifact', 'View %d exposed artifacts', state.artifacts.length);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -56,6 +56,3 @@ export const createLabel = ({ state, dispatch }, label) => { ...@@ -56,6 +56,3 @@ export const createLabel = ({ state, dispatch }, label) => {
export const updateSelectedLabels = ({ commit }, labels) => export const updateSelectedLabels = ({ commit }, labels) =>
commit(types.UPDATE_SELECTED_LABELS, { labels }); commit(types.UPDATE_SELECTED_LABELS, { labels });
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -50,6 +50,3 @@ export const isDropdownVariantStandalone = state => state.variant === DropdownVa ...@@ -50,6 +50,3 @@ export const isDropdownVariantStandalone = state => state.variant === DropdownVa
* @param {object} state * @param {object} state
*/ */
export const isDropdownVariantEmbedded = state => state.variant === DropdownVariant.Embedded; export const isDropdownVariantEmbedded = state => state.variant === DropdownVariant.Embedded;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* @param {string} root - the key of the state where to search fo they keys described in list * @param {string} root - the key of the state where to search fo they keys described in list
* @returns {Object} a dictionary with all the computed properties generated * @returns {Object} a dictionary with all the computed properties generated
*/ */
// eslint-disable-next-line import/prefer-default-export
export const mapComputed = (list, defaultUpdateFn, root) => { export const mapComputed = (list, defaultUpdateFn, root) => {
const result = {}; const result = {};
list.forEach(item => { list.forEach(item => {
...@@ -32,5 +33,3 @@ export const mapComputed = (list, defaultUpdateFn, root) => { ...@@ -32,5 +33,3 @@ export const mapComputed = (list, defaultUpdateFn, root) => {
}); });
return result; return result;
}; };
export default () => {};
...@@ -15,6 +15,3 @@ export const show = ({ commit }) => { ...@@ -15,6 +15,3 @@ export const show = ({ commit }) => {
export const hide = ({ commit }) => { export const hide = ({ commit }) => {
commit(types.HIDE); commit(types.HIDE);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -520,20 +520,6 @@ describe('component', () => { ...@@ -520,20 +520,6 @@ describe('component', () => {
}); });
``` ```
#### Testing Vuex actions and getters
Because we're currently using [`babel-plugin-rewire`](https://github.com/speedskater/babel-plugin-rewire), you may encounter the following error when testing your Vuex actions and getters:
`[vuex] actions should be function or object with "handler" function`
To prevent this error from happening, you need to export an empty function as `default`:
```javascript
// getters.js or actions.js
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
```
### Two way data binding ### Two way data binding
When storing form data in Vuex, it is sometimes necessary to update the value stored. The store should never be mutated directly, and an action should be used instead. When storing form data in Vuex, it is sometimes necessary to update the value stored. The store should never be mutated directly, and an action should be used instead.
......
...@@ -62,6 +62,3 @@ export const setPage = ({ commit, dispatch }, data) => { ...@@ -62,6 +62,3 @@ export const setPage = ({ commit, dispatch }, data) => {
dispatch('fetchMergeRequests'); dispatch('fetchMergeRequests');
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -18,6 +18,3 @@ export const columnMetricLabel = (state, _getters, _rootState, rootGetters) => ...@@ -18,6 +18,3 @@ export const columnMetricLabel = (state, _getters, _rootState, rootGetters) =>
.find(metric => metric.key === state.columnMetric).label; .find(metric => metric.key === state.columnMetric).label;
export const isSelectedSortField = state => sortField => state.sortField === sortField; export const isSelectedSortField = state => sortField => state.sortField === sortField;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const isEmpty = state => !state.rules || !state.rules.length; export const isEmpty = state => !state.rules || !state.rules.length;
export default () => {};
...@@ -156,5 +156,3 @@ export const setTargetBranch = ({ commit }, targetBranch) => ...@@ -156,5 +156,3 @@ export const setTargetBranch = ({ commit }, targetBranch) =>
commit(types.SET_TARGET_BRANCH, targetBranch); commit(types.SET_TARGET_BRANCH, targetBranch);
export const undoRulesChange = ({ commit }) => commit(types.UNDO_RULES); export const undoRulesChange = ({ commit }) => commit(types.UNDO_RULES);
export default () => {};
...@@ -106,5 +106,3 @@ export const requestDeleteRule = ({ dispatch }, rule) => { ...@@ -106,5 +106,3 @@ export const requestDeleteRule = ({ dispatch }, rule) => {
export const addEmptyRule = ({ commit }) => { export const addEmptyRule = ({ commit }) => {
commit(types.ADD_EMPTY_RULE); commit(types.ADD_EMPTY_RULE);
}; };
export default () => {};
...@@ -27,6 +27,3 @@ export const receiveSubscriptionError = ({ commit }) => { ...@@ -27,6 +27,3 @@ export const receiveSubscriptionError = ({ commit }) => {
createFlash(__('An error occurred while loading the subscription details.')); createFlash(__('An error occurred while loading the subscription details.'));
commit(types.RECEIVE_SUBSCRIPTION_ERROR); commit(types.RECEIVE_SUBSCRIPTION_ERROR);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const isFreePlan = state => state.plan.code === null; export const isFreePlan = state => state.plan.code === null;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -28,6 +28,3 @@ export const fetchReport = ({ state, dispatch }) => { ...@@ -28,6 +28,3 @@ export const fetchReport = ({ state, dispatch }) => {
createFlash(s__('ciReport|There was an error fetching the codequality report.')); createFlash(s__('ciReport|There was an error fetching the codequality report.'));
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -5,6 +5,3 @@ export const codequalityIssues = state => { ...@@ -5,6 +5,3 @@ export const codequalityIssues = state => {
}; };
export const codequalityIssueTotal = state => state.allCodequalityIssues.length; export const codequalityIssueTotal = state => state.allCodequalityIssues.length;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -304,6 +304,3 @@ export const createEpic = ({ state, dispatch }) => { ...@@ -304,6 +304,3 @@ export const createEpic = ({ state, dispatch }) => {
dispatch('requestEpicCreateFailure'); dispatch('requestEpicCreateFailure');
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -56,6 +56,3 @@ export const isDateInvalid = (state, getters) => { ...@@ -56,6 +56,3 @@ export const isDateInvalid = (state, getters) => {
}; };
export const ancestors = state => (state.ancestors ? [...state.ancestors].reverse() : []); export const ancestors = state => (state.ancestors ? [...state.ancestors].reverse() : []);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -73,6 +73,3 @@ export const receiveFeatureFlagError = ({ commit }) => { ...@@ -73,6 +73,3 @@ export const receiveFeatureFlagError = ({ commit }) => {
}; };
export const toggleActive = ({ commit }, active) => commit(types.TOGGLE_ACTIVE, active); export const toggleActive = ({ commit }, active) => commit(types.TOGGLE_ACTIVE, active);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -105,6 +105,3 @@ export const receiveRotateInstanceIdError = ({ commit }) => ...@@ -105,6 +105,3 @@ export const receiveRotateInstanceIdError = ({ commit }) =>
export const clearAlert = ({ commit }, index) => { export const clearAlert = ({ commit }, index) => {
commit(types.RECEIVE_CLEAR_ALERT, index); commit(types.RECEIVE_CLEAR_ALERT, index);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -49,6 +49,3 @@ export const receiveCreateFeatureFlagSuccess = ({ commit }) => ...@@ -49,6 +49,3 @@ export const receiveCreateFeatureFlagSuccess = ({ commit }) =>
commit(types.RECEIVE_CREATE_FEATURE_FLAG_SUCCESS); commit(types.RECEIVE_CREATE_FEATURE_FLAG_SUCCESS);
export const receiveCreateFeatureFlagError = ({ commit }, error) => export const receiveCreateFeatureFlagError = ({ commit }, error) =>
commit(types.RECEIVE_CREATE_FEATURE_FLAG_ERROR, error); commit(types.RECEIVE_CREATE_FEATURE_FLAG_ERROR, error);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -73,5 +73,3 @@ export const setActiveTab = ({ commit, state }, key) => { ...@@ -73,5 +73,3 @@ export const setActiveTab = ({ commit, state }, key) => {
export const initChartData = ({ commit }, store) => commit(types.INIT_CHART_DATA, store); export const initChartData = ({ commit }, store) => commit(types.INIT_CHART_DATA, store);
export const setPageLoading = ({ commit }, pageLoading) => export const setPageLoading = ({ commit }, pageLoading) =>
commit(types.SET_PAGE_LOADING, pageLoading); commit(types.SET_PAGE_LOADING, pageLoading);
export default () => {};
...@@ -21,6 +21,3 @@ export const fetchChartData = ({ commit, dispatch, getters }, endpoint) => { ...@@ -21,6 +21,3 @@ export const fetchChartData = ({ commit, dispatch, getters }, endpoint) => {
.then(() => dispatch('setLoadingState', false)) .then(() => dispatch('setLoadingState', false))
.catch(() => flash(__('An error occurred while loading chart data'))); .catch(() => flash(__('An error occurred while loading chart data')));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -42,5 +42,3 @@ export const fetchDeleteLicense = ({ state, dispatch }, { id }) => { ...@@ -42,5 +42,3 @@ export const fetchDeleteLicense = ({ state, dispatch }, { id }) => {
dispatch('receiveDeleteLicenseError', { id }); dispatch('receiveDeleteLicenseError', { id });
}); });
}; };
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const hasLicenses = state => state.licenses.length > 0; export const hasLicenses = state => state.licenses.length > 0;
export default () => {};
...@@ -71,5 +71,3 @@ export const requestDeletePackage = ({ dispatch, state }, { _links }) => { ...@@ -71,5 +71,3 @@ export const requestDeletePackage = ({ dispatch, state }, { _links }) => {
createFlash(DELETE_PACKAGE_ERROR_MESSAGE); createFlash(DELETE_PACKAGE_ERROR_MESSAGE);
}); });
}; };
export default () => {};
...@@ -4,6 +4,7 @@ import createFlash from '~/flash'; ...@@ -4,6 +4,7 @@ import createFlash from '~/flash';
import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import * as types from './mutation_types'; import * as types from './mutation_types';
// eslint-disable-next-line import/prefer-default-export
export function fetchPage({ commit, state }, newPage) { export function fetchPage({ commit, state }, newPage) {
return Api.groupMembers(state.groupId, { return Api.groupMembers(state.groupId, {
with_saml_identity: 'true', with_saml_identity: 'true',
...@@ -25,5 +26,3 @@ export function fetchPage({ commit, state }, newPage) { ...@@ -25,5 +26,3 @@ export function fetchPage({ commit, state }, newPage) {
createFlash(__('An error occurred while loading group members.')); createFlash(__('An error occurred while loading group members.'));
}); });
} }
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -589,6 +589,3 @@ export const fetchProjects = ({ state, dispatch }, searchKey = '') => { ...@@ -589,6 +589,3 @@ export const fetchProjects = ({ state, dispatch }, searchKey = '') => {
}) })
.catch(() => dispatch('receiveProjectsFailure')); .catch(() => dispatch('receiveProjectsFailure'));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -18,6 +18,3 @@ export const itemPathIdSeparator = (state, getters) => ...@@ -18,6 +18,3 @@ export const itemPathIdSeparator = (state, getters) =>
getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue; getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue;
export const isEpic = state => state.issuableType === issuableTypesMap.EPIC; export const isEpic = state => state.issuableType === issuableTypesMap.EPIC;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -345,6 +345,3 @@ export const refreshMilestoneDates = ({ commit, state, getters }) => { ...@@ -345,6 +345,3 @@ export const refreshMilestoneDates = ({ commit, state, getters }) => {
}; };
export const setBufferSize = ({ commit }, bufferSize) => commit(types.SET_BUFFER_SIZE, bufferSize); export const setBufferSize = ({ commit }, bufferSize) => commit(types.SET_BUFFER_SIZE, bufferSize);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -38,6 +38,3 @@ export const timeframeEndDate = (state, getters) => { ...@@ -38,6 +38,3 @@ export const timeframeEndDate = (state, getters) => {
endDate.setDate(endDate.getDate() + DAYS_IN_WEEK); endDate.setDate(endDate.getDate() + DAYS_IN_WEEK);
return endDate; return endDate;
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -45,6 +45,3 @@ export const setToggleValue = ({ commit }, { key, value }) => { ...@@ -45,6 +45,3 @@ export const setToggleValue = ({ commit }, { key, value }) => {
value, value,
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -18,6 +18,3 @@ export const activeFilters = state => { ...@@ -18,6 +18,3 @@ export const activeFilters = state => {
}; };
export const visibleFilters = ({ filters }) => filters.filter(({ hidden }) => !hidden); export const visibleFilters = ({ filters }) => filters.filter(({ hidden }) => !hidden);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -188,6 +188,3 @@ export const receiveSearchResultsError = ({ commit }) => { ...@@ -188,6 +188,3 @@ export const receiveSearchResultsError = ({ commit }) => {
export const setMinimumQueryMessage = ({ commit }) => { export const setMinimumQueryMessage = ({ commit }) => {
commit(types.SET_MINIMUM_QUERY_MESSAGE); commit(types.SET_MINIMUM_QUERY_MESSAGE);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -54,6 +54,3 @@ export const receiveProjectsSuccess = ({ commit }, { projects }) => { ...@@ -54,6 +54,3 @@ export const receiveProjectsSuccess = ({ commit }, { projects }) => {
export const receiveProjectsError = ({ commit }) => { export const receiveProjectsError = ({ commit }) => {
commit(types.RECEIVE_PROJECTS_ERROR); commit(types.RECEIVE_PROJECTS_ERROR);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -35,6 +35,3 @@ export const receiveUnscannedProjectsError = ({ commit }) => { ...@@ -35,6 +35,3 @@ export const receiveUnscannedProjectsError = ({ commit }) => {
commit(RECEIVE_UNSCANNED_PROJECTS_ERROR); commit(RECEIVE_UNSCANNED_PROJECTS_ERROR);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -15,6 +15,3 @@ export const outdatedProjects = ({ projects }) => ...@@ -15,6 +15,3 @@ export const outdatedProjects = ({ projects }) =>
export const outdatedProjectsCount = (state, getters) => export const outdatedProjectsCount = (state, getters) =>
getters.outdatedProjects.reduce((count, currentGroup) => count + currentGroup.projects.length, 0); getters.outdatedProjects.reduce((count, currentGroup) => count + currentGroup.projects.length, 0);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -555,6 +555,3 @@ export const openDismissalCommentBox = ({ commit }) => { ...@@ -555,6 +555,3 @@ export const openDismissalCommentBox = ({ commit }) => {
export const closeDismissalCommentBox = ({ commit }) => { export const closeDismissalCommentBox = ({ commit }) => {
commit(types.CLOSE_DISMISSAL_COMMENT_BOX); commit(types.CLOSE_DISMISSAL_COMMENT_BOX);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -45,5 +45,3 @@ export const isSelectingVulnerabilities = (state, getters) => ...@@ -45,5 +45,3 @@ export const isSelectingVulnerabilities = (state, getters) =>
export const hasSelectedAllVulnerabilities = (state, getters) => export const hasSelectedAllVulnerabilities = (state, getters) =>
getters.isSelectingVulnerabilities && getters.isSelectingVulnerabilities &&
getters.selectedVulnerabilitiesCount === state.vulnerabilities.length; getters.selectedVulnerabilitiesCount === state.vulnerabilities.length;
export default () => {};
...@@ -38,6 +38,3 @@ export const receiveProjectsError = ({ commit }) => { ...@@ -38,6 +38,3 @@ export const receiveProjectsError = ({ commit }) => {
commit(SET_HAS_ERROR, true); commit(SET_HAS_ERROR, true);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
import { SEVERITY_GROUPS, SEVERITY_LEVELS_ORDERED_BY_SEVERITY } from './constants'; import { SEVERITY_GROUPS, SEVERITY_LEVELS_ORDERED_BY_SEVERITY } from './constants';
import { projectsForSeverityGroup, addMostSevereVulnerabilityInformation } from './utils'; import { projectsForSeverityGroup, addMostSevereVulnerabilityInformation } from './utils';
// eslint-disable-next-line import/prefer-default-export
export const severityGroups = ({ projects }) => { export const severityGroups = ({ projects }) => {
// add data about it's most severe vulnerability to each project // add data about it's most severe vulnerability to each project
const projectsWithSeverityInformation = projects.map( const projectsWithSeverityInformation = projects.map(
...@@ -13,6 +14,3 @@ export const severityGroups = ({ projects }) => { ...@@ -13,6 +14,3 @@ export const severityGroups = ({ projects }) => {
projects: projectsForSeverityGroup(projectsWithSeverityInformation, severityGroup), projects: projectsForSeverityGroup(projectsWithSeverityInformation, severityGroup),
})); }));
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -159,6 +159,3 @@ export const removeIssueFromEpic = ({ state, dispatch }, epic) => { ...@@ -159,6 +159,3 @@ export const removeIssueFromEpic = ({ state, dispatch }, epic) => {
); );
}); });
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -45,6 +45,3 @@ export const isDropdownVariantSidebar = state => state.variant === DropdownVaria ...@@ -45,6 +45,3 @@ export const isDropdownVariantSidebar = state => state.variant === DropdownVaria
* @param {object} state * @param {object} state
*/ */
export const isDropdownVariantStandalone = state => state.variant === DropdownVariant.Standalone; export const isDropdownVariantStandalone = state => state.variant === DropdownVariant.Standalone;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -198,6 +198,3 @@ export const minimumQueryMessage = ({ commit }) => { ...@@ -198,6 +198,3 @@ export const minimumQueryMessage = ({ commit }) => {
export const setProjects = ({ commit }, projects) => { export const setProjects = ({ commit }, projects) => {
commit(types.SET_PROJECTS, projects); commit(types.SET_PROJECTS, projects);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -209,6 +209,3 @@ export const denyLicense = ({ dispatch }, license) => { ...@@ -209,6 +209,3 @@ export const denyLicense = ({ dispatch }, license) => {
dispatch('setLicenseApproval', { license, newStatus: LICENSE_APPROVAL_STATUS.DENIED }); dispatch('setLicenseApproval', { license, newStatus: LICENSE_APPROVAL_STATUS.DENIED });
} }
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -120,6 +120,3 @@ export const reportContainsBlacklistedLicense = (_, getters) => ...@@ -120,6 +120,3 @@ export const reportContainsBlacklistedLicense = (_, getters) =>
(getters.licenseReport || []).some( (getters.licenseReport || []).some(
license => license.approvalStatus === LICENSE_APPROVAL_STATUS.DENIED, license => license.approvalStatus === LICENSE_APPROVAL_STATUS.DENIED,
); );
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -21,6 +21,3 @@ export const RECEIVE_LICENSE_CHECK_APPROVAL_RULE_SUCCESS = ...@@ -21,6 +21,3 @@ export const RECEIVE_LICENSE_CHECK_APPROVAL_RULE_SUCCESS =
'RECEIVE_LICENSE_CHECK_APPROVAL_RULE_SUCCESS'; 'RECEIVE_LICENSE_CHECK_APPROVAL_RULE_SUCCESS';
export const RECEIVE_LICENSE_CHECK_APPROVAL_RULE_ERROR = export const RECEIVE_LICENSE_CHECK_APPROVAL_RULE_ERROR =
'RECEIVE_LICENSE_CHECK_APPROVAL_RULE_ERROR'; 'RECEIVE_LICENSE_CHECK_APPROVAL_RULE_ERROR';
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -75,6 +75,3 @@ export const receiveMetricsError = ({ commit, dispatch }) => { ...@@ -75,6 +75,3 @@ export const receiveMetricsError = ({ commit, dispatch }) => {
commit(types.RECEIVE_METRICS_ERROR); commit(types.RECEIVE_METRICS_ERROR);
dispatch('stopPolling'); dispatch('stopPolling');
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -17,6 +17,3 @@ export const metrics = state => [ ...@@ -17,6 +17,3 @@ export const metrics = state => [
...state.existingMetrics, ...state.existingMetrics,
...state.removedMetrics.map(metric => ({ ...metric, wasRemoved: true })), ...state.removedMetrics.map(metric => ({ ...metric, wasRemoved: true })),
]; ];
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -444,6 +444,3 @@ export const openDismissalCommentBox = ({ commit }) => { ...@@ -444,6 +444,3 @@ export const openDismissalCommentBox = ({ commit }) => {
export const closeDismissalCommentBox = ({ commit }) => { export const closeDismissalCommentBox = ({ commit }) => {
commit(types.CLOSE_DISMISSAL_COMMENT_BOX); commit(types.CLOSE_DISMISSAL_COMMENT_BOX);
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -163,6 +163,3 @@ export const canCreateMergeRequest = state => ...@@ -163,6 +163,3 @@ export const canCreateMergeRequest = state =>
export const canDismissVulnerability = state => export const canDismissVulnerability = state =>
Boolean(state.createVulnerabilityFeedbackDismissalPath); Boolean(state.createVulnerabilityFeedbackDismissalPath);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
...@@ -25,5 +25,3 @@ export const fetchDiff = ({ state, rootState, dispatch }) => { ...@@ -25,5 +25,3 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('receiveDiffError'); dispatch('receiveDiffError');
}); });
}; };
export default () => {};
...@@ -6,5 +6,3 @@ export const groupedSastText = state => ...@@ -6,5 +6,3 @@ export const groupedSastText = state =>
export const sastStatusIcon = ({ isLoading, hasError, newIssues }) => export const sastStatusIcon = ({ isLoading, hasError, newIssues }) =>
statusIcon(isLoading, hasError, newIssues.length); statusIcon(isLoading, hasError, newIssues.length);
export default () => {};
...@@ -67,5 +67,3 @@ export const generateReportGroup = ({ status = 'some-status', numberOfLicenses = ...@@ -67,5 +67,3 @@ export const generateReportGroup = ({ status = 'some-status', numberOfLicenses =
status, status,
})), })),
}); });
export default () => {};
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
// eslint-disable-next-line import/prefer-default-export
export const createDraft = () => ({ export const createDraft = () => ({
author: { author: {
id: 1, id: 1,
...@@ -23,5 +24,3 @@ export const createDraft = () => ({ ...@@ -23,5 +24,3 @@ export const createDraft = () => ({
isDraft: true, isDraft: true,
position: null, position: null,
}); });
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const triggerDOMEvent = type => { export const triggerDOMEvent = type => {
window.document.dispatchEvent( window.document.dispatchEvent(
new Event(type, { new Event(type, {
...@@ -6,5 +7,3 @@ export const triggerDOMEvent = type => { ...@@ -6,5 +7,3 @@ export const triggerDOMEvent = type => {
}), }),
); );
}; };
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const mockReport = { export const mockReport = {
status: 'failed', status: 'failed',
summary: { summary: {
...@@ -51,5 +52,3 @@ export const mockReport = { ...@@ -51,5 +52,3 @@ export const mockReport = {
existing_notes: [], existing_notes: [],
existing_warnings: [], existing_warnings: [],
}; };
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const adjustMetricQuery = data => { export const adjustMetricQuery = data => {
const updatedMetric = data.metrics; const updatedMetric = data.metrics;
...@@ -15,6 +16,3 @@ export const adjustMetricQuery = data => { ...@@ -15,6 +16,3 @@ export const adjustMetricQuery = data => {
updatedMetric.queries = queries; updatedMetric.queries = queries;
return updatedMetric; return updatedMetric;
}; };
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
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