Repository: freeCodeCamp/freeCodeCamp
File: curriculum/get-challenges.js (JavaScript)

Code before:
      throw Error(`Missing English challenge for
${filePath}
It should be in
${getFullPath('english', filePath)}
`);

    const missingAuditedChallenge =
      isAuditedCert(lang, superBlock) &&
      !fs.existsSync(getFullPath(lang, filePath));
    if (missingAuditedChallenge)
      throw Error(`Missing ${lang} audited challenge for
${filePath}

Explanation:

Challenges that have been already audited cannot fall back to their English versions. If you are seeing this, please update, and approve these Challenges on Crowdin first, followed by downloading them to the main branch using the GitHub workflows.
    `);
  }

  function addMetaToChallenge(challenge, meta) {
    const challengeOrder = findIndex(
      meta.challengeOrder,
      ([id]) => id === challenge.id
    );

    challenge.block = meta.dashedName ? meta.dashedName : null;
    challenge.hasEditableBoundaries = !!meta.hasEditableBoundaries;
    challenge.order = meta.order;
    // const superOrder = getSuperOrder(meta.superBlock);
    // NOTE: Use this version when a super block is in beta.
    const superOrder = getSuperOrder(meta.superBlock, {
      // switch this back to SHOW_NEW_CURRICULUM when we're ready to beta the JS superblock
      showNewCurriculum: process.env.SHOW_UPCOMING_CHANGES === 'true'
    });
    if (superOrder !== null) challenge.superOrder = superOrder;
    /* Since there can be more than one way to complete a certification (using the
   legacy curriculum or the new one, for instance), we need a certification
   field to track which certification this belongs to. */
    const dupeCertifications = [
      {
        certification: 'responsive-web-design',
        dupe: '2022/responsive-web-design'
      },
      {
        certification: 'javascript-algorithms-and-data-structures',
        dupe: '2022/javascript-algorithms-and-data-structures'
      }
    ];
    const hasDupe = dupeCertifications.find(
      cert => cert.dupe === meta.superBlock
    );

Review comment (suggestion):
This is what made me think we don't need both. We could do something like

```suggestion
    if (!meta.dashedName)
      throw Error(`challenge ${challenge.title}'s meta.json has no dashedName`);

    challenge.block = meta.dashedName;
```

Code after:
      throw Error(`Missing English challenge for
${filePath}
It should be in
${getFullPath('english', filePath)}
`);

    const missingAuditedChallenge =
      isAuditedCert(lang, superBlock) &&
      !fs.existsSync(getFullPath(lang, filePath));
    if (missingAuditedChallenge)
      throw Error(`Missing ${lang} audited challenge for
${filePath}

Explanation:

Challenges that have been already audited cannot fall back to their English versions. If you are seeing this, please update, and approve these Challenges on Crowdin first, followed by downloading them to the main branch using the GitHub workflows.
    `);
  }

  function addMetaToChallenge(challenge, meta) {
    const challengeOrder = findIndex(
      meta.challengeOrder,
      ([id]) => id === challenge.id
    );

    if (!meta.dashedName)
      throw Error(
        `The 'meta.json' file for the block with challenge '${challenge.title}' has no 'dashedName' property`
      );

    challenge.block = meta.dashedName;
    challenge.hasEditableBoundaries = !!meta.hasEditableBoundaries;
    challenge.order = meta.order;
    // const superOrder = getSuperOrder(meta.superBlock);
    // NOTE: Use this version when a super block is in beta.
    const superOrder = getSuperOrder(meta.superBlock, {
      // switch this back to SHOW_NEW_CURRICULUM when we're ready to beta the JS superblock
      showNewCurriculum: process.env.SHOW_UPCOMING_CHANGES === 'true'
    });
    if (superOrder !== null) challenge.superOrder = superOrder;
    /* Since there can be more than one way to complete a certification (using the
   legacy curriculum or the new one, for instance), we need a certification
   field to track which certification this belongs to. */
    const dupeCertifications = [
      {
        certification: 'responsive-web-design',
        dupe: '2022/responsive-web-design'
      },
      {
        certification: 'javascript-algorithms-and-data-structures',
        dupe: '2022/javascript-algorithms-and-data-structures'