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) => {
commit(types.RECEIVE_STATISTICS_ERROR, error);
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 @@
* and returns an array of the following form:
* [{ key: "forks", label: "Forks", value: 50 }]
*/
// eslint-disable-next-line import/prefer-default-export
export const getStatistics = state => labels =>
Object.keys(labels).map(key => {
const result = {
......@@ -12,6 +13,3 @@ export const getStatistics = state => labels =>
};
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 }) =>
export const toggleResolveDiscussion = ({ commit }, 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 =>
state.currentlyPublishingDrafts.indexOf(draftId) !== -1;
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 }) => {
export const setPage = ({ commit }, 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';
import service from '../services/contributors_service';
import * as types from './mutation_types';
// eslint-disable-next-line import/prefer-default-export
export const fetchChartData = ({ commit }, endpoint) => {
commit(types.SET_LOADING_STATE, true);
......@@ -15,6 +16,3 @@ export const fetchChartData = ({ commit }, endpoint) => {
})
.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 => {
byAuthorEmail,
};
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -90,6 +90,3 @@ export const fetchMachineTypes = ({ commit, state }) =>
mutation: types.SET_MACHINE_TYPES,
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) => {
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) =
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 =>
state.diffFiles.find(file => file.file_hash === fileHash);
......@@ -130,6 +129,3 @@ export const fileLineCoverage = state => (file, line) => {
*/
export const currentDiffIndex = state =>
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) => {
commit(types.SET_UPDATING_IGNORE_STATUS, false);
});
};
export default () => {};
......@@ -10,6 +10,7 @@ const stopPolling = poll => {
if (poll) poll.stop();
};
// eslint-disable-next-line import/prefer-default-export
export function startPollingStacktrace({ commit }, endpoint) {
stackTracePoll = new Poll({
resource: service,
......@@ -32,5 +33,3 @@ export function startPollingStacktrace({ commit }, endpoint) {
stackTracePoll.makeRequest();
}
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const stacktrace = state =>
state.stacktraceData.stack_trace_entries
? state.stacktraceData.stack_trace_entries.reverse()
: [];
export default () => {};
......@@ -102,5 +102,3 @@ export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => {
export const removeIgnoredResolvedErrors = ({ commit }, error) => {
commit(types.REMOVE_IGNORED_RESOLVED_ERRORS, error);
};
export default () => {};
......@@ -89,6 +89,3 @@ export const updateSelectedProject = ({ commit }, selectedProject) => {
export const setInitialState = ({ commit }, 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 => {
}
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
};
export const getDisplayName = project => `${project.organizationName} | ${project.slug}`;
export default () => {};
......@@ -76,6 +76,3 @@ export const setSearchQuery = ({ commit, dispatch }, query) => {
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 !== '';
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -32,5 +32,3 @@ export const fetchBranches = ({ dispatch, rootGetters }, { search = '' }) => {
};
export const resetBranches = ({ commit }) => commit(types.RESET_BRANCHES);
export default () => {};
......@@ -23,5 +23,3 @@ export const templateTypes = () => [
export const showFileTemplatesBar = (_, getters, rootState) => name =>
getters.templateTypes.find(t => t.name === name) &&
rootState.currentActivityView === leftSidebarViews.edit.name;
export default () => {};
......@@ -41,5 +41,3 @@ export const fetchMergeRequests = (
};
export const resetMergeRequests = ({ commit }) => commit(types.RESET_MERGE_REQUESTS);
export default () => {};
......@@ -149,5 +149,3 @@ export const resetLatestPipeline = ({ commit }) => {
commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, null);
commit(types.SET_DETAIL_JOB, null);
};
export default () => {};
......@@ -20,5 +20,3 @@ export const failedJobsCount = state =>
);
export const jobsCount = state => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0);
export default () => {};
......@@ -2,4 +2,3 @@ export * from './setup';
export * from './checks';
export * from './session_controls';
export * from './session_status';
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const allCheck = state => {
const checks = Object.values(state.checks);
......@@ -15,5 +16,3 @@ export const allCheck = state => {
message,
};
};
export default () => {};
......@@ -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) => {
})
.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
export const hasRunnersForProject = state =>
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 }) => {
export const dismissInvalidTimeRangeWarning = ({ commit }) => {
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';
// eslint-disable-next-line import/prefer-default-export
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) =>
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 default () => {};
......@@ -682,6 +682,3 @@ export const receiveDeleteDescriptionVersionError = ({ commit }, error) => {
export const updateAssignees = ({ commit }, 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 =>
state.discussions.find(discussion => discussion.id === discussionId);
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) => {
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) =>
export const removeSelectedSuiteIndex = ({ commit }) =>
commit(types.SET_SELECTED_SUITE_INDEX, null);
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 => {
const { test_cases: testCases = [] } = getSelectedSuite(state);
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 { SUPPORTED_FILTER_PARAMETERS } from './constants';
// eslint-disable-next-line import/prefer-default-export
export const validateParams = params => {
return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val);
};
export default () => {};
......@@ -102,5 +102,3 @@ export const requestDeleteImage = ({ commit }, image) => {
commit(types.SET_MAIN_LOADING, false);
});
};
export default () => {};
......@@ -28,6 +28,3 @@ export const saveSettings = ({ dispatch, state }) => {
)
.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 }) => {
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 }) => {
commit(types.RECEIVE_RELEASES_ERROR);
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 }) => {
commit(types.RECEIVE_REPORT_ERROR);
dispatch('stopPolling');
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -43,6 +43,3 @@ export const shouldRenderIssuesList = state =>
export const unresolvedIssues = state => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_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) => {
};
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';
// eslint-disable-next-line import/prefer-default-export
export const summaryStatus = state => {
if (state.isLoading) {
return LOADING;
......@@ -11,6 +12,3 @@ export const summaryStatus = state => {
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 }) => {
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
// Convert the function list into a k/v grouping based on the environment scope
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 =>
}),
{},
);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -38,5 +38,3 @@ export const SnippetShowInit = () => {
export const SnippetEditInit = () => {
appFactory(document.getElementById('js-snippet-edit'), SnippetsEdit);
};
export default () => {};
......@@ -2,6 +2,7 @@ import GetSnippetQuery from '../queries/snippet.query.graphql';
const blobsDefault = [];
// eslint-disable-next-line import/prefer-default-export
export const getSnippetMixin = {
apollo: {
snippet: {
......@@ -39,5 +40,3 @@ export const getSnippetMixin = {
},
},
};
export default () => {};
......@@ -69,6 +69,3 @@ export const receiveArtifactsSuccess = ({ commit }, response) => {
};
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';
// eslint-disable-next-line import/prefer-default-export
export const title = state => {
if (state.isLoading) {
return s__('BuildArtifacts|Loading artifacts');
......@@ -11,6 +12,3 @@ export const title = state => {
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) => {
export const updateSelectedLabels = ({ commit }, 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
* @param {object} state
*/
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 @@
* @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
*/
// eslint-disable-next-line import/prefer-default-export
export const mapComputed = (list, defaultUpdateFn, root) => {
const result = {};
list.forEach(item => {
......@@ -32,5 +33,3 @@ export const mapComputed = (list, defaultUpdateFn, root) => {
});
return result;
};
export default () => {};
......@@ -15,6 +15,3 @@ export const show = ({ commit }) => {
export const hide = ({ commit }) => {
commit(types.HIDE);
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -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
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) => {
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) =>
.find(metric => metric.key === state.columnMetric).label;
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 default () => {};
......@@ -156,5 +156,3 @@ export const setTargetBranch = ({ commit }, targetBranch) =>
commit(types.SET_TARGET_BRANCH, targetBranch);
export const undoRulesChange = ({ commit }) => commit(types.UNDO_RULES);
export default () => {};
......@@ -106,5 +106,3 @@ export const requestDeleteRule = ({ dispatch }, rule) => {
export const addEmptyRule = ({ commit }) => {
commit(types.ADD_EMPTY_RULE);
};
export default () => {};
......@@ -27,6 +27,3 @@ export const receiveSubscriptionError = ({ commit }) => {
createFlash(__('An error occurred while loading the subscription details.'));
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;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -28,6 +28,3 @@ export const fetchReport = ({ state, dispatch }) => {
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 => {
};
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 }) => {
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) => {
};
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 }) => {
};
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 }) =>
export const clearAlert = ({ commit }, 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 }) =>
commit(types.RECEIVE_CREATE_FEATURE_FLAG_SUCCESS);
export const receiveCreateFeatureFlagError = ({ commit }, 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) => {
export const initChartData = ({ commit }, store) => commit(types.INIT_CHART_DATA, store);
export const setPageLoading = ({ commit }, pageLoading) =>
commit(types.SET_PAGE_LOADING, pageLoading);
export default () => {};
......@@ -21,6 +21,3 @@ export const fetchChartData = ({ commit, dispatch, getters }, endpoint) => {
.then(() => dispatch('setLoadingState', false))
.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 }) => {
dispatch('receiveDeleteLicenseError', { id });
});
};
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const hasLicenses = state => state.licenses.length > 0;
export default () => {};
......@@ -71,5 +71,3 @@ export const requestDeletePackage = ({ dispatch, state }, { _links }) => {
createFlash(DELETE_PACKAGE_ERROR_MESSAGE);
});
};
export default () => {};
......@@ -4,6 +4,7 @@ import createFlash from '~/flash';
import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import * as types from './mutation_types';
// eslint-disable-next-line import/prefer-default-export
export function fetchPage({ commit, state }, newPage) {
return Api.groupMembers(state.groupId, {
with_saml_identity: 'true',
......@@ -25,5 +26,3 @@ export function fetchPage({ commit, state }, newPage) {
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 = '') => {
})
.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) =>
getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue;
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 }) => {
};
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) => {
endDate.setDate(endDate.getDate() + DAYS_IN_WEEK);
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 }) => {
value,
});
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -18,6 +18,3 @@ export const activeFilters = state => {
};
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 }) => {
export const setMinimumQueryMessage = ({ commit }) => {
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 }) => {
export const receiveProjectsError = ({ commit }) => {
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 }) => {
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 }) =>
export const outdatedProjectsCount = (state, getters) =>
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 }) => {
export const closeDismissalCommentBox = ({ commit }) => {
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) =>
export const hasSelectedAllVulnerabilities = (state, getters) =>
getters.isSelectingVulnerabilities &&
getters.selectedVulnerabilitiesCount === state.vulnerabilities.length;
export default () => {};
......@@ -38,6 +38,3 @@ export const receiveProjectsError = ({ commit }) => {
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 { projectsForSeverityGroup, addMostSevereVulnerabilityInformation } from './utils';
// eslint-disable-next-line import/prefer-default-export
export const severityGroups = ({ projects }) => {
// add data about it's most severe vulnerability to each project
const projectsWithSeverityInformation = projects.map(
......@@ -13,6 +14,3 @@ export const severityGroups = ({ projects }) => {
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) => {
);
});
};
// 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
* @param {object} state
*/
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 }) => {
export const setProjects = ({ commit }, 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) => {
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) =>
(getters.licenseReport || []).some(
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 =
'RECEIVE_LICENSE_CHECK_APPROVAL_RULE_SUCCESS';
export const 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 }) => {
commit(types.RECEIVE_METRICS_ERROR);
dispatch('stopPolling');
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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