Skip to content
Snippets Groups Projects
Unverified Commit 600155b6 authored by markrian's avatar markrian
Browse files

Disable default export rules

This is part of the work to implement the consensus reached in the
[RFC][1] to prefer named exports over defalt exports.

Future iterations will migrate existing default exports to named
exports.

The bulk of the changes in this commit were performed with the following
script:

```bash
set -u

changed-files()
{
    local trunk="origin/master"
    local file=
    local committed_files=$(git diff "$trunk"... --numstat \
        | awk '/\.(js|vue)$/{ print $3 }')
    local changed_files=$(git diff --numstat \
        | awk '/\.(js|vue)$/{ print $3 }')
    for file in ${committed_files[@]} ${changed_files[@]}; do
        if [ -f "$file" ]; then
            echo "$file"
        fi
    done
}

git grep -lz "import/prefer-default-export" -- '**/*.js' \
    | xargs -0 perl -0pi -e \
    "s/[^\n]*eslint-disable[^\n]*"\
"import\/prefer-default-export[^\n]*\n//mgs"

git grep -lz "rfcs/-/issues/20" -- '**/*.js' \
    | xargs -0 perl -0pi -e \
    "s/[^\n]*rfcs\/-\/issues\/20[^\n]*\n//mgs"

yarn prettier --write $(changed-files)
```

The script is [idempotent][2], to help make it easier to keep
up-to-date.

[1]: https://gitlab.com/gitlab-org/frontend/rfcs/-/issues/20
[2]: https://en.wikipedia.org/wiki/Idempotence
parent 53814371
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 21 deletions
// eslint-disable-next-line import/prefer-default-export
export const isAliveView = state => view =>
state.keepAliveViews[view] || (state.isOpen && state.currentView === view);
// eslint-disable-next-line import/prefer-default-export
export const states = {
failed: 'failed',
};
// eslint-disable-next-line import/prefer-default-export
export const normalizeJob = job => ({
id: job.id,
name: job.name,
Loading
Loading
import * as types from './mutation_types';
 
// eslint-disable-next-line import/prefer-default-export
export const push = ({ commit }, fullPath) => {
commit(types.PUSH, fullPath);
};
// eslint-disable-next-line import/prefer-default-export
export const PUSH = 'PUSH';
// eslint-disable-next-line import/prefer-default-export
export const allCheck = state => {
const checks = Object.values(state.checks);
 
Loading
Loading
/* eslint-disable import/prefer-default-export */
/**
* This method adds listeners to the given router and store and syncs their state with eachother
*
Loading
Loading
import { STATUSES } from './constants';
 
// Will be expanded in future
// eslint-disable-next-line import/prefer-default-export
export function isProjectImportable(project) {
return project.importStatus === STATUSES.NONE && !project.importSource.incompatible;
}
import * as types from './mutation_types';
 
// eslint-disable-next-line import/prefer-default-export
export const setOverride = ({ commit }, override) => commit(types.SET_OVERRIDE, override);
Loading
Loading
@@ -7,7 +7,6 @@ import createState from './state';
 
Vue.use(Vuex);
 
// eslint-disable-next-line import/prefer-default-export
export const createStore = (initialState = {}) =>
new Vuex.Store({
actions,
Loading
Loading
// eslint-disable-next-line import/prefer-default-export
export const SET_OVERRIDE = 'SET_OVERRIDE';
Loading
Loading
@@ -3,7 +3,6 @@ import { __ } from '~/locale';
/**
* Returns the attributes used for gl-empty-state in the Service Desk issues list.
*/
// eslint-disable-next-line import/prefer-default-export
export function emptyStateHelper(emptyStateMeta) {
const { isServiceDeskSupported, svgPath, serviceDeskHelpPage } = emptyStateMeta;
 
Loading
Loading
/* eslint-disable import/prefer-default-export */
export function isImageLoaded(element) {
return element.complete && element.naturalHeight !== 0;
}
Loading
Loading
@@ -4,6 +4,5 @@
* @param {Set} superset The set to be considered as the superset.
* @returns {boolean}
*/
// eslint-disable-next-line import/prefer-default-export
export const isSubset = (subset, superset) =>
Array.from(subset).every(value => superset.has(value));
// eslint-disable-next-line import/prefer-default-export
export const isObject = obj => obj && obj.constructor === Object;
import { joinPaths } from '~/lib/utils/url_utility';
 
// tell webpack to load assets from origin so that web workers don't break
// eslint-disable-next-line import/prefer-default-export
export function resetServiceWorkersPublicPath() {
// __webpack_public_path__ is a global variable that can be used to adjust
// the webpack publicPath setting at runtime.
Loading
Loading
Loading
Loading
@@ -125,7 +125,6 @@ const csvData = (metricHeaders, metricValues) => {
* @param {Object} graphData - Panel contents
* @returns {String}
*/
// eslint-disable-next-line import/prefer-default-export
export const graphDataToCsv = graphData => {
const delimiter = ',';
const br = '\r\n';
Loading
Loading
import * as types from './mutation_types';
 
// eslint-disable-next-line import/prefer-default-export
export const addModule = ({ commit }, data) => commit(types.ADD_MODULE, data);
// eslint-disable-next-line import/prefer-default-export
export const metricsWithData = (state, getters, rootState, rootGetters) =>
state.modules.map(module => rootGetters[`${module}/metricsWithData`]().length);
// eslint-disable-next-line import/prefer-default-export
export const ADD_MODULE = 'ADD_MODULE';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment