From 21dd80c47a0a5f4d50cad18ed06d9daf540fbab5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 08:48:49 -0700 Subject: [PATCH] chore(deps): update dependency prettier to v2.3.0 (#42074) * chore(deps): update dependency prettier to v2.3.0 * chore: apply formating per prettier * fix: correctly disable import/no-unresolved Co-authored-by: Renovate Bot Co-authored-by: Mrugesh Mohapatra Co-authored-by: Oliver Eyton-Williams --- api-server/src/common/models/user.js | 14 +-- api-server/src/server/component-passport.js | 91 +++++++++---------- .../src/server/utils/__mocks__/donation.js | 27 ++---- .../src/server/utils/create-handled-error.js | 18 ++-- api-server/src/server/utils/donation.test.js | 6 +- api-server/src/server/utils/middleware.js | 22 +++-- .../ShowProfileOrFourOhFour.js | 12 ++- client/src/components/Intro/Intro.test.js | 10 +- .../components/SolutionViewer/ProjectModal.js | 9 +- client/src/components/createRedirect.js | 14 +-- .../components/formHelpers/FormValidators.js | 12 ++- .../src/components/settings/Certification.js | 17 +--- client/src/components/settings/Email.js | 14 +-- client/src/components/settings/Internet.js | 18 ++-- client/src/components/settings/Portfolio.js | 17 ++-- .../src/templates/Challenges/classic/Show.js | 9 +- .../Challenges/redux/create-question-epic.js | 5 +- .../redux/execute-challenge-saga.js | 6 +- .../src/templates/Challenges/utils/frame.js | 32 ++++--- .../components/CertificationCard.js | 8 +- .../components/SuperBlockIntro.js | 6 +- client/src/utils/curriculum-helpers.test.js | 6 +- client/utils/gatsby/challengePageCreator.js | 60 ++++++------ curriculum/getChallenges.js | 5 +- curriculum/test/test-challenges.js | 7 +- curriculum/utils.js | 5 +- cypress/integration/tags.js | 3 +- package-lock.json | 6 +- package.json | 2 +- .../hide-non-translated-strings/index.js | 5 +- 30 files changed, 212 insertions(+), 254 deletions(-) diff --git a/api-server/src/common/models/user.js b/api-server/src/common/models/user.js index b352819478..b8b4f5cf40 100644 --- a/api-server/src/common/models/user.js +++ b/api-server/src/common/models/user.js @@ -676,10 +676,8 @@ export default function initializeUser(User) { const updateData = { $set: {} }; return this.getCompletedChallenges$() .flatMap(() => { - const { - updated, - isNewCompletionCount - } = buildCompletedChallengesUpdate(this.completedChallenges, project); + const { updated, isNewCompletionCount } = + buildCompletedChallengesUpdate(this.completedChallenges, project); updateData.$set.completedChallenges = updated; if (isNewCompletionCount) { let points = []; @@ -830,12 +828,8 @@ export default function initializeUser(User) { if (!user) { return Observable.of({}); } - const { - completedChallenges, - progressTimestamps, - timezone, - profileUI - } = user; + const { completedChallenges, progressTimestamps, timezone, profileUI } = + user; const allUser = { ..._.pick(user, publicUserProps), isGithub: !!user.githubProfile, diff --git a/api-server/src/server/component-passport.js b/api-server/src/server/component-passport.js index 8fb2e2071a..a9c9e31ba1 100644 --- a/api-server/src/server/component-passport.js +++ b/api-server/src/server/component-passport.js @@ -97,57 +97,54 @@ export const devLoginRedirect = () => { }; }; -export const createPassportCallbackAuthenticator = (strategy, config) => ( - req, - res, - next -) => { - return passport.authenticate( - strategy, - { session: false }, - (err, user, userInfo) => { - if (err) { - return next(err); - } +export const createPassportCallbackAuthenticator = + (strategy, config) => (req, res, next) => { + return passport.authenticate( + strategy, + { session: false }, + (err, user, userInfo) => { + if (err) { + return next(err); + } - if (!user || !userInfo) { - return res.redirect('/signin'); - } + if (!user || !userInfo) { + return res.redirect('/signin'); + } - const { accessToken } = userInfo; - const { provider } = config; - if (accessToken && accessToken.id) { - if (provider === 'auth0') { - req.flash('success', 'flash.signin-success'); - } else if (user.email) { - req.flash( - 'info', - dedent` + const { accessToken } = userInfo; + const { provider } = config; + if (accessToken && accessToken.id) { + if (provider === 'auth0') { + req.flash('success', 'flash.signin-success'); + } else if (user.email) { + req.flash( + 'info', + dedent` We are moving away from social authentication for privacy reasons. Next time we recommend using your email address: ${user.email} to sign in instead. ` - ); + ); + } + setAccessTokenToResponse({ accessToken }, req, res); + req.login(user); + } + + const state = req && req.query && req.query.state; + // returnTo, origin and pathPrefix are audited by getReturnTo + let { returnTo, origin, pathPrefix } = getReturnTo(state, jwtSecret); + const redirectBase = getRedirectBase(origin, pathPrefix); + + // TODO: getReturnTo could return a success flag to show a flash message, + // but currently it immediately gets overwritten by a second message. We + // should either change the message if the flag is present or allow + // multiple messages to appear at once. + + if (user.acceptedPrivacyTerms) { + returnTo += isRootPath(redirectBase, returnTo) ? '/learn' : ''; + return res.redirectWithFlash(returnTo); + } else { + return res.redirectWithFlash(`${redirectBase}/email-sign-up`); } - setAccessTokenToResponse({ accessToken }, req, res); - req.login(user); } - - const state = req && req.query && req.query.state; - // returnTo, origin and pathPrefix are audited by getReturnTo - let { returnTo, origin, pathPrefix } = getReturnTo(state, jwtSecret); - const redirectBase = getRedirectBase(origin, pathPrefix); - - // TODO: getReturnTo could return a success flag to show a flash message, - // but currently it immediately gets overwritten by a second message. We - // should either change the message if the flag is present or allow - // multiple messages to appear at once. - - if (user.acceptedPrivacyTerms) { - returnTo += isRootPath(redirectBase, returnTo) ? '/learn' : ''; - return res.redirectWithFlash(returnTo); - } else { - return res.redirectWithFlash(`${redirectBase}/email-sign-up`); - } - } - )(req, res, next); -}; + )(req, res, next); + }; diff --git a/api-server/src/server/utils/__mocks__/donation.js b/api-server/src/server/utils/__mocks__/donation.js index 329bfd0c25..df1fb13339 100644 --- a/api-server/src/server/utils/__mocks__/donation.js +++ b/api-server/src/server/utils/__mocks__/donation.js @@ -53,14 +53,12 @@ export const mockCancellationHook = { }, links: [ { - href: - 'https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-1VF24938EU372274X-83540367M0110254R', + href: 'https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-1VF24938EU372274X-83540367M0110254R', rel: 'self', method: 'GET' }, { - href: - 'https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-1VF24938EU372274X-83540367M0110254R/resend', + href: 'https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-1VF24938EU372274X-83540367M0110254R/resend', rel: 'resend', method: 'POST' } @@ -156,32 +154,27 @@ export const mockActivationHook = { }, links: [ { - href: - 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G', + href: 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G', rel: 'self', method: 'GET' }, { - href: - 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G', + href: 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G', rel: 'edit', method: 'PATCH' }, { - href: - 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend', + href: 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend', rel: 'suspend', method: 'POST' }, { - href: - 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/cancel', + href: 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/cancel', rel: 'cancel', method: 'POST' }, { - href: - 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/capture', + href: 'https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/capture', rel: 'capture', method: 'POST' } @@ -194,15 +187,13 @@ export const mockActivationHook = { }, links: [ { - href: - 'https://api.paypal.com/v1/notifications/webhooks-events/WH-77687562XN25889J8-8Y6T55435R66168T6', + href: 'https://api.paypal.com/v1/notifications/webhooks-events/WH-77687562XN25889J8-8Y6T55435R66168T6', rel: 'self', method: 'GET', encType: 'application/json' }, { - href: - 'https://api.paypal.com/v1/notifications/webhooks-events/WH-77687562XN25889J8-8Y6T55435R66168T6/resend', + href: 'https://api.paypal.com/v1/notifications/webhooks-events/WH-77687562XN25889J8-8Y6T55435R66168T6/resend', rel: 'resend', method: 'POST', encType: 'application/json' diff --git a/api-server/src/server/utils/create-handled-error.js b/api-server/src/server/utils/create-handled-error.js index 2d94282961..6b10d2a0ef 100644 --- a/api-server/src/server/utils/create-handled-error.js +++ b/api-server/src/server/utils/create-handled-error.js @@ -17,11 +17,13 @@ export function wrapHandledError( } // for use with express-validator error formatter -export const createValidatorErrorFormatter = (type, redirectTo) => ({ msg }) => - wrapHandledError(new Error(msg), { - type, - message: msg, - redirectTo, - // we default to 400 as these are malformed requests - status: 400 - }); +export const createValidatorErrorFormatter = + (type, redirectTo) => + ({ msg }) => + wrapHandledError(new Error(msg), { + type, + message: msg, + redirectTo, + // we default to 400 as these are malformed requests + status: 400 + }); diff --git a/api-server/src/server/utils/donation.test.js b/api-server/src/server/utils/donation.test.js index 86b3332cfd..30538eac4c 100644 --- a/api-server/src/server/utils/donation.test.js +++ b/api-server/src/server/utils/donation.test.js @@ -24,10 +24,8 @@ jest.mock('axios'); const verificationUrl = `https://api.sandbox.paypal.com/v1/notifications/verify-webhook-signature`; const tokenUrl = `https://api.sandbox.paypal.com/v1/oauth2/token`; -const { - body: activationHookBody, - headers: activationHookHeaders -} = mockActivationHook; +const { body: activationHookBody, headers: activationHookHeaders } = + mockActivationHook; describe('donation', () => { describe('getAsyncPaypalToken', () => { diff --git a/api-server/src/server/utils/middleware.js b/api-server/src/server/utils/middleware.js index 482f079abe..52f5551fc8 100644 --- a/api-server/src/server/utils/middleware.js +++ b/api-server/src/server/utils/middleware.js @@ -78,15 +78,17 @@ export function ifUserRedirectTo(status) { } // for use with express-validator error formatter -export const createValidatorErrorHandler = (...args) => (req, res, next) => { - const validation = validationResult(req).formatWith( - createValidatorErrorFormatter(...args) - ); +export const createValidatorErrorHandler = + (...args) => + (req, res, next) => { + const validation = validationResult(req).formatWith( + createValidatorErrorFormatter(...args) + ); - if (!validation.isEmpty()) { - const errors = validation.array(); - return next(errors.pop()); - } + if (!validation.isEmpty()) { + const errors = validation.array(); + return next(errors.pop()); + } - return next(); -}; + return next(); + }; diff --git a/client/src/client-only-routes/ShowProfileOrFourOhFour.js b/client/src/client-only-routes/ShowProfileOrFourOhFour.js index f61428f56b..0b6b49cbe0 100644 --- a/client/src/client-only-routes/ShowProfileOrFourOhFour.js +++ b/client/src/client-only-routes/ShowProfileOrFourOhFour.js @@ -25,10 +25,14 @@ const propTypes = { showLoading: PropTypes.bool }; -const createRequestedUserSelector = () => (state, { maybeUser = '' }) => - userByNameSelector(maybeUser.toLowerCase())(state); -const createIsSessionUserSelector = () => (state, { maybeUser = '' }) => - maybeUser.toLowerCase() === usernameSelector(state); +const createRequestedUserSelector = + () => + (state, { maybeUser = '' }) => + userByNameSelector(maybeUser.toLowerCase())(state); +const createIsSessionUserSelector = + () => + (state, { maybeUser = '' }) => + maybeUser.toLowerCase() === usernameSelector(state); const makeMapStateToProps = () => (state, props) => { const requestedUserSelector = createRequestedUserSelector(); diff --git a/client/src/components/Intro/Intro.test.js b/client/src/components/Intro/Intro.test.js index 8ef23760f0..9886c1ad45 100644 --- a/client/src/components/Intro/Intro.test.js +++ b/client/src/components/Intro/Intro.test.js @@ -14,15 +14,17 @@ function rendererCreateWithRedux(ui) { describe('', () => { it('has no blockquotes when loggedOut', () => { - const container = rendererCreateWithRedux() - .root; + const container = rendererCreateWithRedux( + + ).root; expect(container.findAllByType('blockquote').length === 0).toBeTruthy(); expect(container.findAllByType('h1').length === 1).toBeTruthy(); }); it('has a blockquote when loggedIn', () => { - const container = rendererCreateWithRedux() - .root; + const container = rendererCreateWithRedux( + + ).root; expect(container.findAllByType('blockquote').length === 1).toBeTruthy(); expect(container.findAllByType('h1').length === 1).toBeTruthy(); }); diff --git a/client/src/components/SolutionViewer/ProjectModal.js b/client/src/components/SolutionViewer/ProjectModal.js index 1f588c1536..77836f9423 100644 --- a/client/src/components/SolutionViewer/ProjectModal.js +++ b/client/src/components/SolutionViewer/ProjectModal.js @@ -21,13 +21,8 @@ const propTypes = { }; const ProjectModal = props => { - const { - isOpen, - projectTitle, - files, - solution, - handleSolutionModalHide - } = props; + const { isOpen, projectTitle, files, solution, handleSolutionModalHide } = + props; const { t } = useTranslation(); return ( () => { - if (typeof window !== 'undefined') { - navigate(to); - } - return null; -}; +const createRedirect = + (to = '/') => + () => { + if (typeof window !== 'undefined') { + navigate(to); + } + return null; + }; export default createRedirect; diff --git a/client/src/components/formHelpers/FormValidators.js b/client/src/components/formHelpers/FormValidators.js index 95d814caf0..32a2cdcbaa 100644 --- a/client/src/components/formHelpers/FormValidators.js +++ b/client/src/components/formHelpers/FormValidators.js @@ -2,8 +2,10 @@ import React from 'react'; import { Trans } from 'react-i18next'; // Matches editor links for: Replit, Glitch, CodeSandbox, GitHub -const editorRegex = /repl\.?it(\.com)?\/(@|join\/)|glitch\.com\/edit\/#!|codesandbox\.io\/s\/|github\.com/; -const fCCRegex = /codepen\.io\/freecodecamp|freecodecamp\.rocks|github\.com\/freecodecamp/i; +const editorRegex = + /repl\.?it(\.com)?\/(@|join\/)|glitch\.com\/edit\/#!|codesandbox\.io\/s\/|github\.com/; +const fCCRegex = + /codepen\.io\/freecodecamp|freecodecamp\.rocks|github\.com\/freecodecamp/i; const localhostRegex = /localhost:/; const httpRegex = /http(?!s|([^s]+?localhost))/; @@ -21,5 +23,7 @@ export const localhostValidator = value => export const httpValidator = value => httpRegex.test(value) ? validation.http-url : null; -export const composeValidators = (...validators) => value => - validators.reduce((error, validator) => error ?? validator?.(value), null); +export const composeValidators = + (...validators) => + value => + validators.reduce((error, validator) => error ?? validator?.(value), null); diff --git a/client/src/components/settings/Certification.js b/client/src/components/settings/Certification.js index 7f8d67eb21..ddfd707d9e 100644 --- a/client/src/components/settings/Certification.js +++ b/client/src/components/settings/Certification.js @@ -285,13 +285,8 @@ export class CertificationSettings extends Component { ); }; renderProjectsFor = (certName, isCert) => { - const { - username, - isHonest, - createFlashMessage, - t, - verifyCert - } = this.props; + const { username, isHonest, createFlashMessage, t, verifyCert } = + this.props; const { certSlug } = first(projectMap[certName]); const certLocation = `/certification/${username}/${certSlug}`; const createClickHandler = certSlug => e => { @@ -332,12 +327,8 @@ export class CertificationSettings extends Component { // legacy projects rendering handleSubmitLegacy({ values: formChalObj }) { - const { - isHonest, - createFlashMessage, - verifyCert, - updateLegacyCert - } = this.props; + const { isHonest, createFlashMessage, verifyCert, updateLegacyCert } = + this.props; let legacyTitle; let certSlug; let certs = Object.keys(legacyProjectMap); diff --git a/client/src/components/settings/Email.js b/client/src/components/settings/Email.js index 88b766a091..9a26f360f2 100644 --- a/client/src/components/settings/Email.js +++ b/client/src/components/settings/Email.js @@ -141,17 +141,11 @@ class EmailSettings extends Component { emailForm: { newEmail, confirmNewEmail, currentEmail, isPristine } } = this.state; - const { - isEmailVerified, - updateQuincyEmail, - sendQuincyEmail, - t - } = this.props; + const { isEmailVerified, updateQuincyEmail, sendQuincyEmail, t } = + this.props; - const { - state: newEmailValidation, - message: newEmailValidationMessage - } = this.getValidationForNewEmail(); + const { state: newEmailValidation, message: newEmailValidationMessage } = + this.getValidationForNewEmail(); const { state: confirmEmailValidation, diff --git a/client/src/components/settings/Internet.js b/client/src/components/settings/Internet.js index ae2ee3c897..60ad599639 100644 --- a/client/src/components/settings/Internet.js +++ b/client/src/components/settings/Internet.js @@ -165,20 +165,14 @@ class InternetSettings extends Component { message: githubProfileValidationMessage } = this.getValidationStateFor(githubProfile); - const { - state: linkedinValidation, - message: linkedinValidationMessage - } = this.getValidationStateFor(linkedin); + const { state: linkedinValidation, message: linkedinValidationMessage } = + this.getValidationStateFor(linkedin); - const { - state: twitterValidation, - message: twitterValidationMessage - } = this.getValidationStateFor(twitter); + const { state: twitterValidation, message: twitterValidationMessage } = + this.getValidationStateFor(twitter); - const { - state: websiteValidation, - message: websiteValidationMessage - } = this.getValidationStateFor(website); + const { state: websiteValidation, message: websiteValidationMessage } = + this.getValidationStateFor(website); return ( diff --git a/client/src/components/settings/Portfolio.js b/client/src/components/settings/Portfolio.js index 91f15c001f..5d9f60b67f 100644 --- a/client/src/components/settings/Portfolio.js +++ b/client/src/components/settings/Portfolio.js @@ -123,9 +123,8 @@ class PortfolioSettings extends Component { const { state: titleState } = this.getTitleValidation(title); const { state: urlState } = this.getUrlValidation(url); const { state: imageState } = this.getUrlValidation(image, true); - const { state: descriptionState } = this.getDescriptionValidation( - description - ); + const { state: descriptionState } = + this.getDescriptionValidation(description); return [titleState, imageState, urlState, descriptionState] .filter(Boolean) .every(state => state === 'success'); @@ -192,19 +191,15 @@ class PortfolioSettings extends Component { const { t } = this.props; const { id, title, description, url, image } = portfolio; const pristine = this.isFormPristine(id); - const { - state: titleState, - message: titleMessage - } = this.getTitleValidation(title); + const { state: titleState, message: titleMessage } = + this.getTitleValidation(title); const { state: urlState, message: urlMessage } = this.getUrlValidation(url); const { state: imageState, message: imageMessage } = this.getUrlValidation( image, true ); - const { - state: descriptionState, - message: descriptionMessage - } = this.getDescriptionValidation(description); + const { state: descriptionState, message: descriptionMessage } = + this.getDescriptionValidation(description); return (
diff --git a/client/src/templates/Challenges/classic/Show.js b/client/src/templates/Challenges/classic/Show.js index de9a7dd066..699f57cf56 100644 --- a/client/src/templates/Challenges/classic/Show.js +++ b/client/src/templates/Challenges/classic/Show.js @@ -206,13 +206,8 @@ class ShowClassic extends Component { } renderInstructionsPanel({ showToolPanel }) { - const { - block, - description, - instructions, - superBlock, - translationPending - } = this.getChallenge(); + const { block, description, instructions, superBlock, translationPending } = + this.getChallenge(); const { forumTopicId, title } = this.getChallenge(); return ( diff --git a/client/src/templates/Challenges/redux/create-question-epic.js b/client/src/templates/Challenges/redux/create-question-epic.js index 7dba35a24a..9427ccd0f6 100644 --- a/client/src/templates/Challenges/redux/create-question-epic.js +++ b/client/src/templates/Challenges/redux/create-question-epic.js @@ -32,9 +32,8 @@ function createQuestionEpic(action$, state$, { window }) { tap(() => { const state = state$.value; const files = challengeFilesSelector(state); - const { title: challengeTitle, helpCategory } = challengeMetaSelector( - state - ); + const { title: challengeTitle, helpCategory } = + challengeMetaSelector(state); const { navigator: { userAgent }, location: { href } diff --git a/client/src/templates/Challenges/redux/execute-challenge-saga.js b/client/src/templates/Challenges/redux/execute-challenge-saga.js index 689ad270c8..0c4e643cef 100644 --- a/client/src/templates/Challenges/redux/execute-challenge-saga.js +++ b/client/src/templates/Challenges/redux/execute-challenge-saga.js @@ -74,9 +74,9 @@ export function* executeChallengeSaga({ yield put(initLogs()); yield put(initConsole(i18next.t('learn.running-tests'))); // reset tests to initial state - const tests = (yield select( - challengeTestsSelector - )).map(({ text, testString }) => ({ text, testString })); + const tests = (yield select(challengeTestsSelector)).map( + ({ text, testString }) => ({ text, testString }) + ); yield put(updateTests(tests)); yield fork(takeEveryLog, consoleProxy); diff --git a/client/src/templates/Challenges/utils/frame.js b/client/src/templates/Challenges/utils/frame.js index 47e1cfa1c3..d4d56bff22 100644 --- a/client/src/templates/Challenges/utils/frame.js +++ b/client/src/templates/Challenges/utils/frame.js @@ -67,22 +67,24 @@ const createFrame = (document, id) => ctx => { }; const hiddenFrameClassName = 'hide-test-frame'; -const mountFrame = document => ({ element, ...rest }) => { - const oldFrame = document.getElementById(element.id); - if (oldFrame) { - element.className = oldFrame.className || hiddenFrameClassName; - oldFrame.parentNode.replaceChild(element, oldFrame); - } else { - element.className = hiddenFrameClassName; - document.body.appendChild(element); - } - return { - ...rest, - element, - document: element.contentDocument, - window: element.contentWindow +const mountFrame = + document => + ({ element, ...rest }) => { + const oldFrame = document.getElementById(element.id); + if (oldFrame) { + element.className = oldFrame.className || hiddenFrameClassName; + oldFrame.parentNode.replaceChild(element, oldFrame); + } else { + element.className = hiddenFrameClassName; + document.body.appendChild(element); + } + return { + ...rest, + element, + document: element.contentDocument, + window: element.contentWindow + }; }; -}; const buildProxyConsole = proxyLogger => ctx => { const oldLog = ctx.window.console.log.bind(ctx.window.console); diff --git a/client/src/templates/Introduction/components/CertificationCard.js b/client/src/templates/Introduction/components/CertificationCard.js index 725db4a3e5..b88ffeddf6 100644 --- a/client/src/templates/Introduction/components/CertificationCard.js +++ b/client/src/templates/Introduction/components/CertificationCard.js @@ -20,9 +20,11 @@ const CertificationCard = ({ certSlug, superBlock, i18nCertText }) => { setIsExpanded(!isExpanded); }; - const { expand: expandText, collapse: collapseText, steps: stepsText } = t( - 'intro:misc-text' - ); + const { + expand: expandText, + collapse: collapseText, + steps: stepsText + } = t('intro:misc-text'); return (
diff --git a/client/src/templates/Introduction/components/SuperBlockIntro.js b/client/src/templates/Introduction/components/SuperBlockIntro.js index 26605933c5..108fb49ca0 100644 --- a/client/src/templates/Introduction/components/SuperBlockIntro.js +++ b/client/src/templates/Introduction/components/SuperBlockIntro.js @@ -14,10 +14,8 @@ function SuperBlockIntro(props) { const { superBlock } = props; const superBlockIntroObj = t(`intro:${superBlock}`); - const { - title: i18nSuperBlock, - intro: superBlockIntroText - } = superBlockIntroObj; + const { title: i18nSuperBlock, intro: superBlockIntroText } = + superBlockIntroObj; return ( <> diff --git a/client/src/utils/curriculum-helpers.test.js b/client/src/utils/curriculum-helpers.test.js index b6d3bada45..337c67cb68 100644 --- a/client/src/utils/curriculum-helpers.test.js +++ b/client/src/utils/curriculum-helpers.test.js @@ -8,10 +8,8 @@ import htmlTestValues from './__fixtures/curriculum-helpers-html'; import whiteSpaceTestValues from './__fixtures/curriculum-helpers-remove-white-space'; /* eslint-enable max-len */ -const { - stringWithWhiteSpaceChars, - stringWithWhiteSpaceCharsRemoved -} = whiteSpaceTestValues; +const { stringWithWhiteSpaceChars, stringWithWhiteSpaceCharsRemoved } = + whiteSpaceTestValues; const { cssFullExample, cssCodeWithCommentsRemoved } = cssTestValues; diff --git a/client/utils/gatsby/challengePageCreator.js b/client/utils/gatsby/challengePageCreator.js index 51628c84b0..7bc25f3d3e 100644 --- a/client/utils/gatsby/challengePageCreator.js +++ b/client/utils/gatsby/challengePageCreator.js @@ -49,36 +49,38 @@ const getPrevChallengePath = (node, index, nodeArray) => { const getTemplateComponent = challengeType => views[viewTypes[challengeType]]; -exports.createChallengePages = createPage => ({ node }, index, thisArray) => { - const { - superBlock, - block, - fields: { slug }, - required = [], - template, - challengeType, - id - } = node; - // TODO: challengeType === 7 and isPrivate are the same, right? If so, we - // should remove one of them. +exports.createChallengePages = + createPage => + ({ node }, index, thisArray) => { + const { + superBlock, + block, + fields: { slug }, + required = [], + template, + challengeType, + id + } = node; + // TODO: challengeType === 7 and isPrivate are the same, right? If so, we + // should remove one of them. - return createPage({ - path: slug, - component: getTemplateComponent(challengeType), - context: { - challengeMeta: { - superBlock, - block, - template, - required, - nextChallengePath: getNextChallengePath(node, index, thisArray), - prevChallengePath: getPrevChallengePath(node, index, thisArray), - id - }, - slug - } - }); -}; + return createPage({ + path: slug, + component: getTemplateComponent(challengeType), + context: { + challengeMeta: { + superBlock, + block, + template, + required, + nextChallengePath: getNextChallengePath(node, index, thisArray), + prevChallengePath: getPrevChallengePath(node, index, thisArray), + id + }, + slug + } + }); + }; exports.createBlockIntroPages = createPage => edge => { const { diff --git a/curriculum/getChallenges.js b/curriculum/getChallenges.js index 542ba527ec..c00154e011 100644 --- a/curriculum/getChallenges.js +++ b/curriculum/getChallenges.js @@ -15,9 +15,8 @@ const { isAuditedCert } = require('../utils/is-audited'); const { dasherize } = require('../utils/slugs'); const { createPoly } = require('../utils/polyvinyl'); const { helpCategoryMap } = require('../client/utils/challengeTypes'); -const { - curriculum: curriculumLangs -} = require('../config/i18n/all-langs').availableLangs; +const { curriculum: curriculumLangs } = + require('../config/i18n/all-langs').availableLangs; const access = util.promisify(fs.access); diff --git a/curriculum/test/test-challenges.js b/curriculum/test/test-challenges.js index 570ac07c9d..1ce850fc98 100644 --- a/curriculum/test/test-challenges.js +++ b/curriculum/test/test-challenges.js @@ -68,9 +68,10 @@ const TRANSLATABLE_COMMENTS = getTranslatableComments( ); // the config files are created during the build, but not before linting -// eslint-disable-next-line import/no-unresolved -const testEvaluator = require('../../config/client/test-evaluator.json') - .filename; +/* eslint-disable import/no-unresolved */ +const testEvaluator = + require('../../config/client/test-evaluator.json').filename; +/* eslint-enable import/no-unresolved */ const { inspect } = require('util'); const commentExtractors = { diff --git a/curriculum/utils.js b/curriculum/utils.js index 65d338b3fd..481117478c 100644 --- a/curriculum/utils.js +++ b/curriculum/utils.js @@ -1,9 +1,8 @@ const path = require('path'); require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); -const { - curriculum: curriculumLangs -} = require('../config/i18n/all-langs').availableLangs; +const { curriculum: curriculumLangs } = + require('../config/i18n/all-langs').availableLangs; exports.testedLang = function testedLang() { if (process.env.CURRICULUM_LOCALE) { diff --git a/cypress/integration/tags.js b/cypress/integration/tags.js index 783629112b..d98cd49810 100644 --- a/cypress/integration/tags.js +++ b/cypress/integration/tags.js @@ -20,8 +20,7 @@ describe('The Document Metadata', () => { const scripts = { mathjax: { selector: 'body script[id="mathjax"]', - src: - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML' + src: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML' } }; it('landing page has correct for description', () => { diff --git a/package-lock.json b/package-lock.json index d508bdf24e..ab661f5e97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16457,9 +16457,9 @@ "dev": true }, "prettier": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", - "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.0.tgz", + "integrity": "sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==", "dev": true }, "prettier-linter-helpers": { diff --git a/package.json b/package.json index 055eab1a9c..fb4964f026 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "markdownlint": "0.21.0", "npm-run-all": "4.1.5", "ora": "5.4.0", - "prettier": "2.2.1", + "prettier": "2.3.0", "prismjs": "1.23.0", "shx": "0.3.3", "sinon": "10.0.0", diff --git a/tools/crowdin/actions/hide-non-translated-strings/index.js b/tools/crowdin/actions/hide-non-translated-strings/index.js index 11a32d889e..9f41e3d068 100644 --- a/tools/crowdin/actions/hide-non-translated-strings/index.js +++ b/tools/crowdin/actions/hide-non-translated-strings/index.js @@ -44,9 +44,8 @@ const hideNonTranslatedStrings = async projectId => { const crowdinStrings = await getStrings({ projectId }); if (crowdinStrings && crowdinStrings.length) { for (let string of crowdinStrings) { - const { crowdinFilePath, challengeTitle } = challengeTitleLookup[ - string.data.fileId - ]; + const { crowdinFilePath, challengeTitle } = + challengeTitleLookup[string.data.fileId]; await updateFileString({ projectId, string,