fix: order imports and remove circular dependencies (#41824)

* fix: remove circular dependency

redux depended on templates/Challenges/redux and vice versa.  This
meant that import order mattered and confusing bugs could arise.

(cherry picked from commit 7d67a4e70922bbb3051f2f9982dcc69e240d43dc)

* feat: require imports to be in alphabetical order

Import order generally does not matter, but there are edge cases
(circular  imports and css imports, for example) where changing order
changes behaviour

(cherry picked from commit b8d1393a91ec6e068caf8e8498a5c95df68c2b2c)

* chore: order imports

* fix: lift up challenge description + title comps

This brings the classic Show closer to the others as they
now all create the description and title components

* fix: remove donation-saga/index circular import

(cherry picked from commit 51a44ca668a700786d2744feffeae4fdba5fd207)

* refactor: extract action-types from settings

(cherry picked from commit 25e26124d691c84a0d0827d41dafb761c686fadd)

* fix: lint errors

* feat: prevent useless renames
This commit is contained in:
Oliver Eyton-Williams
2021-08-02 15:39:40 +02:00
committed by GitHub
parent c7b27a53e7
commit e118dda13a
259 changed files with 1269 additions and 1303 deletions

View File

@@ -1,14 +1,6 @@
/* eslint-disable camelcase */
import axios from 'axios';
import keys from '../../../../config/secrets';
import {
getAsyncPaypalToken,
verifyWebHook,
updateUser,
capitalizeKeys,
createDonationObj
} from './donation';
import { mockActivationHook, mockCancellationHook } from './__mocks__/donation';
import {
mockApp,
createDonationMockFn,
@@ -16,6 +8,14 @@ import {
updateDonationAttr,
updateUserAttr
} from '../boot_tests/fixtures';
import { mockActivationHook, mockCancellationHook } from './__mocks__/donation';
import {
getAsyncPaypalToken,
verifyWebHook,
updateUser,
capitalizeKeys,
createDonationObj
} from './donation';
jest.mock('axios');

View File

@@ -1,5 +1,5 @@
import jwt from 'jsonwebtoken';
import { isBefore } from 'date-fns';
import jwt from 'jsonwebtoken';
import { jwtSecret as _jwtSecret } from '../../../../config/secrets';

View File

@@ -1,11 +1,11 @@
import jwt from 'jsonwebtoken';
import { mockReq, mockRes } from '../boot_tests/challenge.test';
import {
getAccessTokenFromRequest,
errorTypes,
setAccessTokenToResponse,
removeCookies
} from './getSetAccessToken';
import { mockReq, mockRes } from '../boot_tests/challenge.test';
import jwt from 'jsonwebtoken';
describe('getSetAccessToken', () => {
const validJWTSecret = 'this is a super secret string';

View File

@@ -1,11 +1,11 @@
import { isURL } from 'validator';
import { addPlaceholderImage } from './';
import {
prepUniqueDaysByHours,
calcCurrentStreak,
calcLongestStreak
} from '../utils/user-stats';
import { addPlaceholderImage } from './';
export const publicUserProps = [
'about',

View File

@@ -1,9 +1,9 @@
const jwt = require('jsonwebtoken');
const { availableLangs } = require('../../../../config/i18n/all-langs');
const { allowedOrigins } = require('../../../../config/cors-settings');
// homeLocation is being used as a fallback here. If the one provided by the
// client is invalid we default to this.
const { homeLocation } = require('../../../../config/env.json');
const { availableLangs } = require('../../../../config/i18n/all-langs');
function getReturnTo(encryptedParams, secret, _homeLocation = homeLocation) {
let params;

View File

@@ -1,6 +1,6 @@
import Rx, { AsyncSubject, Observable } from 'rx';
import moment from 'moment';
import debugFactory from 'debug';
import moment from 'moment';
import Rx, { AsyncSubject, Observable } from 'rx';
const debug = debugFactory('fcc:rxUtils');

View File

@@ -1,11 +1,11 @@
import loopback from 'loopback';
import { isEmpty } from 'lodash';
import compose from 'lodash/fp/compose';
import forEachRight from 'lodash/fp/forEachRight';
import last from 'lodash/fp/last';
import map from 'lodash/fp/map';
import sortBy from 'lodash/fp/sortBy';
import trans from 'lodash/fp/transform';
import last from 'lodash/fp/last';
import forEachRight from 'lodash/fp/forEachRight';
import { isEmpty } from 'lodash';
import loopback from 'loopback';
import moment from 'moment-timezone';
import { dayCount } from '../utils/date-utils';

View File

@@ -1,12 +1,12 @@
import moment from 'moment-timezone';
import { mockUserID, mockApp, mockUser } from '../boot_tests/fixtures';
import {
prepUniqueDaysByHours,
calcCurrentStreak,
calcLongestStreak,
getUserById
} from './user-stats';
import { mockUserID, mockApp, mockUser } from '../boot_tests/fixtures';
jest.useFakeTimers('modern');
const PST = 'America/Los_Angeles';