diff --git a/client/src/redux/propTypes.js b/client/src/redux/propTypes.js index 79797deb34..1b092fdf7e 100644 --- a/client/src/redux/propTypes.js +++ b/client/src/redux/propTypes.js @@ -38,6 +38,7 @@ export const ChallengeNode = PropTypes.shape({ helpCategory: PropTypes.string, instructions: PropTypes.string, isComingSoon: PropTypes.bool, + removeComments: PropTypes.bool, isLocked: PropTypes.bool, isPrivate: PropTypes.bool, order: PropTypes.number, diff --git a/client/src/templates/Challenges/classic/Show.js b/client/src/templates/Challenges/classic/Show.js index 501d94dbc0..45315eeee4 100644 --- a/client/src/templates/Challenges/classic/Show.js +++ b/client/src/templates/Challenges/classic/Show.js @@ -160,6 +160,7 @@ class ShowClassic extends Component { files, fields: { tests }, challengeType, + removeComments, helpCategory } }, @@ -171,6 +172,7 @@ class ShowClassic extends Component { updateChallengeMeta({ ...challengeMeta, title, + removeComments, challengeType, helpCategory }); @@ -365,6 +367,7 @@ export const query = graphql` title description instructions + removeComments challengeType helpCategory videoUrl diff --git a/client/src/templates/Challenges/redux/execute-challenge-saga.js b/client/src/templates/Challenges/redux/execute-challenge-saga.js index 5a5ac86044..d54c17be9d 100644 --- a/client/src/templates/Challenges/redux/execute-challenge-saga.js +++ b/client/src/templates/Challenges/redux/execute-challenge-saga.js @@ -87,6 +87,7 @@ export function* executeChallengeSaga({ const protect = isLoopProtected(challengeMeta); const buildData = yield buildChallengeData(challengeData, { preview: false, + removeComments: challengeMeta.removeComments, protect }); const document = yield getContext('document'); @@ -201,6 +202,7 @@ function* previewChallengeSaga({ flushLogs = true } = {}) { const protect = isLoopProtected(challengeMeta); const buildData = yield buildChallengeData(challengeData, { preview: true, + removeComments: challengeMeta.removeComments, protect }); // evaluate the user code in the preview frame or in the worker diff --git a/client/src/templates/Challenges/utils/build.js b/client/src/templates/Challenges/utils/build.js index 844d442f07..399ee5c0f4 100644 --- a/client/src/templates/Challenges/utils/build.js +++ b/client/src/templates/Challenges/utils/build.js @@ -13,6 +13,7 @@ import { import frameRunnerData from '../../../../../config/client/frame-runner.json'; // eslint-disable-next-line import/no-unresolved import testEvaluatorData from '../../../../../config/client/test-evaluator.json'; +import { removeJSComments } from '../../../utils/curriculum-helpers'; const { filename: runner } = frameRunnerData; const { filename: testEvaluator } = testEvaluatorData; @@ -164,16 +165,27 @@ export function buildJSChallenge({ files }, options) { .map(pipeLine); return Promise.all(finalFiles) .then(checkFilesErrors) - .then(files => ({ - challengeType: challengeTypes.js, - build: files + .then(files => { + let build = files .reduce( (body, file) => [...body, file.head, file.contents, file.tail], [] ) - .join('\n'), - sources: buildSourceMap(files) - })); + .join('\n'); + let sources = buildSourceMap(files); + if (options?.removeComments !== false) { + build = removeJSComments(build); + sources = { + ...sources, + index: removeJSComments(sources.index) + }; + } + return { + challengeType: challengeTypes.js, + build, + sources + }; + }); } export function buildBackendChallenge({ url }) { diff --git a/client/src/utils/curriculum-helpers.js b/client/src/utils/curriculum-helpers.js index 73faf75488..18d7015291 100644 --- a/client/src/utils/curriculum-helpers.js +++ b/client/src/utils/curriculum-helpers.js @@ -5,7 +5,7 @@ const removeHtmlComments = str => str.replace(/|$)/g, ''); const removeCssComments = str => str.replace(/\/\*[\s\S]+?\*\//g, ''); -const removeJSComments = codeStr => { +export const removeJSComments = codeStr => { // Note: removes trailing new lines and tailing spaces at end of lines const options = { comments: false, @@ -30,7 +30,6 @@ const removeWhiteSpace = (str = '') => { const curriculumHelpers = { removeHtmlComments, removeCssComments, - removeJSComments, removeWhiteSpace }; diff --git a/client/src/utils/curriculum-helpers.test.js b/client/src/utils/curriculum-helpers.test.js index b8c5388f2c..7861742758 100644 --- a/client/src/utils/curriculum-helpers.test.js +++ b/client/src/utils/curriculum-helpers.test.js @@ -1,6 +1,6 @@ /* global describe it expect */ -import __testHelpers from './curriculum-helpers'; +import __testHelpers, { removeJSComments } from './curriculum-helpers'; import jsTestValues from './__fixtures/curriculum-helpers-javascript'; import cssTestValues from './__fixtures/curriculum-helpers-css'; import htmlTestValues from './__fixtures/curriculum-helpers-html'; @@ -40,7 +40,6 @@ describe('removeWhiteSpace', () => { }); describe('removeJSComments', () => { - const { removeJSComments } = __testHelpers; it('returns a string', () => { expect(typeof removeJSComments('const should = "return a string"')).toBe( 'string' diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index e8f601ffc3..6b54fa3307 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ `copyMachine` 函数中应对 `arr` 使用展开运算符(`spread operator`)。 ```js -assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); +assert(code.match(/\.\.\.arr/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 50271224d6..9f9795a3fa 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -3,6 +3,7 @@ id: bd7123c9c441eddfaeb4bdef title: 给代码添加注释 challengeType: 1 videoUrl: 'https://scrimba.com/c/c7ynnTp' +removeComments: false forumTopicId: 16783 dashedName: comment-your-javascript-code --- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 174d5521b4..60caa1a3e7 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -45,7 +45,7 @@ assert.throws(declared, ReferenceError); ```js assert( - /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test( + /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( __helpers.removeWhiteSpace(code) ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index faf39d1271..c390f0231c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,9 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -76,7 +74,7 @@ assert( ```js assert( - __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1 + sum.toString().match(/sum\(.*\)/g).length > 1 ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index bcd774cd2d..9c78bdb999 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,9 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -69,7 +67,7 @@ assert( ```js assert( - __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/) + countdown.toString().match(/countdown\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 438d745a96..0afaced617 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,9 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -36,9 +34,7 @@ assert( ```js assert( - __helpers - .removeJSComments(rangeOfNumbers.toString()) - .match(/rangeOfNumbers\s*\(.+\)/) + rangeOfNumbers.toString().match(/rangeOfNumbers\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index fb98d4921b..d4979f0bb7 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -32,9 +32,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c ```js assert( - __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) - .match(/console.clear\(\)/) + __helpers.removeWhiteSpace(code).match(/console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index e69a8e8618..12e2c13314 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,9 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g ) ); @@ -44,9 +42,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 5b8ac905e5..61c73ed854 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,9 +43,7 @@ const { name, age } = user; ```js assert( - !__helpers - .removeJSComments(code) - .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -53,9 +51,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -65,9 +61,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 384c805217..066695ef96 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,7 +39,7 @@ const person = { 不应使用传统的函数定义方法。 ```js -(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/)); +(getUserInput) => assert(!code.match(/function/)); ``` `setGear` 应是一个声明函数。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 6779b2adfc..abeda98803 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), 不应该使用 `for`、`while` 或者 `forEach`。 ```js -assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); +assert(!code.match(/for|while|forEach/g)); ``` 应该使用 `map`、`filter` 或者 `reduce`。 @@ -36,7 +36,7 @@ assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index bd83907ddf..2e512ac302 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,7 +52,7 @@ assert( 不能使用 `for` 循环。 ```js -assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); +assert(!code.match(/for\s*?\([\s\S]*?\)/)); ``` 你的代码应使用 `map` 方法。 diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md b/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md index 6a0ed4ec73..df442b6fc4 100644 --- a/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md +++ b/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md @@ -49,9 +49,7 @@ You should not copy and return the array. ```js assert( - !__helpers - .removeJSComments(code) - .match( + !code.match( /(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/ ) ); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 912149a303..9029b1b14b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ The `copyMachine` function should utilize the `spread operator` with array `arr` ```js -assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); +assert(code.match(/\.\.\.arr/)); ``` # --seed-- diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 5b6a9e09cc..a5f59ff63f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,6 +2,7 @@ id: bd7123c9c441eddfaeb4bdef title: Comment Your JavaScript Code challengeType: 1 +removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index ac3ac95d15..21f992cdf6 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -45,7 +45,7 @@ You should add a local `myVar` variable. ```js assert( - /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test( + /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( __helpers.removeWhiteSpace(code) ) ); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 0c060c2bca..b7b76c9e4f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,9 +66,7 @@ Your code should not rely on any kind of loops (`for` or `while` or higher order ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -76,7 +74,7 @@ You should use recursion to solve this problem. ```js assert( - __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1 + sum.toString().match(/sum\(.*\)/g).length > 1 ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 6ccaa69254..c5e30c4680 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,9 +59,7 @@ Your code should not rely on any kind of loops (`for`, `while` or higher order f ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -69,7 +67,7 @@ You should use recursion to solve this problem. ```js assert( - __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/) + countdown.toString().match(/countdown\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 2e10a18bfb..3859da1fba 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,9 +26,7 @@ Your code should not use any loop syntax (`for` or `while` or higher order funct ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -36,9 +34,7 @@ assert( ```js assert( - __helpers - .removeJSComments(rangeOfNumbers.toString()) - .match(/rangeOfNumbers\s*\(.+\)/) + rangeOfNumbers.toString().match(/rangeOfNumbers\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index d1ebf6fe82..b3ec6b24bc 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -33,7 +33,7 @@ You should use `console.clear()` to clear the browser console. ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index f8a9667963..83fb671b57 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,11 +32,7 @@ Make the promise handle success and failure. If `responseFromServer` is `true`, ```js assert( - __helpers - .removeJSComments(code) - .match( - /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g - ) + code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -44,11 +40,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( - /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g - ) + code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 64232d9a25..5d71f58348 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,9 +43,7 @@ You should remove the ES5 assignment syntax. ```js assert( - !__helpers - .removeJSComments(code) - .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -53,11 +51,7 @@ You should use destructuring to create the `today` variable. ```js assert( - __helpers - .removeJSComments(code) - .match( - /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -65,11 +59,7 @@ You should use destructuring to create the `tomorrow` variable. ```js assert( - __helpers - .removeJSComments(code) - .match( - /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 4a0beacfc1..4c319f7bf1 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,7 +39,7 @@ Refactor the function `setGear` inside the object `bicycle` to use the shorthand Traditional function expression should not be used. ```js -(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/)); +(getUserInput) => assert(!code.match(/function/)); ``` `setGear` should be a declarative function. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index bc3fb9f25e..45242aadc4 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, and `forEach` should not be used. ```js -assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); +assert(!code.match(/for|while|forEach/g)); ``` `map`, `filter`, or `reduce` should be used. @@ -36,7 +36,7 @@ assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 698e2aaef9..253dfefbd6 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,7 +52,7 @@ assert( Your code should not use a `for` loop. ```js -assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); +assert(!code.match(/for\s*?\([\s\S]*?\)/)); ``` Your code should use the `map` method. diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md index 6a0ed4ec73..b505cac155 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md @@ -49,11 +49,7 @@ You should not copy and return the array. ```js assert( - !__helpers - .removeJSComments(code) - .match( - /(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/ - ) + !code.match(/(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 7d1659f07d..70c37d9ece 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ La función `copyMachine` debe utilizar el `spread operator` (operador de propagación) con el arreglo `arr` ```js -assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); +assert(code.match(/\.\.\.arr/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index f9a854d947..6a1eaf5d4b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -3,6 +3,7 @@ id: bd7123c9c441eddfaeb4bdef title: Comenta tu código de JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/c7ynnTp' +removeComments: false forumTopicId: 16783 dashedName: comment-your-javascript-code --- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index d476b946a1..1fef0ad88c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -45,7 +45,7 @@ Debes agregar una variable local `myVar`. ```js assert( - /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test( + /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( __helpers.removeWhiteSpace(code) ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 5a25dc7c32..8974b3fd8b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,9 +66,7 @@ Tu código no debe depender de ningún tipo de bluces (`for` o `while`) o funcio ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -76,7 +74,7 @@ Debes usar recursión para resolver este problema. ```js assert( - __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1 + sum.toString().match(/sum\(.*\)/g).length > 1 ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 1db82c20b4..5f6c13ec6d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,9 +59,7 @@ Tu código no debe depender de ningún tipo de bucles (`for`, `while` o funcione ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -69,7 +67,7 @@ Debes usar recursión para resolver este problema. ```js assert( - __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/) + countdown.toString().match(/countdown\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 26b0e42fb8..40a5b6290a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,9 +26,7 @@ Tu código no debe utilizar bucles (`for`, `while` o funciones de orden superior ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -36,9 +34,7 @@ assert( ```js assert( - __helpers - .removeJSComments(rangeOfNumbers.toString()) - .match(/rangeOfNumbers\s*\(.+\)/) + rangeOfNumbers.toString().match(/rangeOfNumbers\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 784a4ace20..50a79aba17 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -33,7 +33,7 @@ Debes utilizar `console.clear()` para limpiar la consola del navegador. ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 7a8fcad374..13a471d703 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,11 +32,9 @@ Haz una función promesa que maneje el éxito y el fallo. Si `responseFromServer ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g - ) + ) ); ``` @@ -44,11 +42,9 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g - ) + ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index f44d4395cb..65161f25c4 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,9 +43,7 @@ Debes eliminar la sintaxis de asignación ES5. ```js assert( - !__helpers - .removeJSComments(code) - .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -53,11 +51,9 @@ Debes usar desestructuración para crear la variable `today`. ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + ) ); ``` @@ -65,11 +61,9 @@ Debes usar desestructuración para crear la variable `tomorrow`. ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index f582298031..b95869da43 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,7 +39,7 @@ Refactoriza la función `setGear` dentro del objeto `bicycle` para que utilice l La expresión tradicional "function" no debe ser utilizada. ```js -(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/)); +(getUserInput) => assert(!code.match(/function/)); ``` `setGear` debe ser una función declarativa. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index f69462da13..c9e73850e7 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, y `forEach` no deben ser usados. ```js -assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); +assert(!code.match(/for|while|forEach/g)); ``` `map`, `filter`, o `reduce` deben ser usados. @@ -36,7 +36,7 @@ assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 0d37aef03b..1b0c9a5508 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,7 +52,7 @@ assert( Tu código no debe usar un bucle `for`. ```js -assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); +assert(!code.match(/for\s*?\([\s\S]*?\)/)); ``` Tu código debe usar el método `map`. diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md b/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md index 6a0ed4ec73..4eb842f9af 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md @@ -49,11 +49,9 @@ You should not copy and return the array. ```js assert( - !__helpers - .removeJSComments(code) - .match( + !code.match( /(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/ - ) + ) ); ``` diff --git a/curriculum/schema/challengeSchema.js b/curriculum/schema/challengeSchema.js index 6c468d1caa..86fe38b517 100644 --- a/curriculum/schema/challengeSchema.js +++ b/curriculum/schema/challengeSchema.js @@ -25,6 +25,7 @@ const schema = Joi.object() block: Joi.string().regex(slugRE), blockId: Joi.objectId(), challengeOrder: Joi.number(), + removeComments: Joi.bool(), challengeType: Joi.number().min(0).max(11).required(), checksum: Joi.number(), // __commentCounts is only used to test the comment replacement diff --git a/curriculum/test/test-challenges.js b/curriculum/test/test-challenges.js index e2d5efba30..572443c95c 100644 --- a/curriculum/test/test-challenges.js +++ b/curriculum/test/test-challenges.js @@ -520,11 +520,17 @@ async function createTestRunner( files[key].editableContents = solution[key].editableContents; }); - const { build, sources, loadEnzyme } = await buildChallenge({ - files, - required, - template - }); + const { build, sources, loadEnzyme } = await buildChallenge( + { + files, + required, + template + }, + { + removeComments: challenge.removeComments + } + ); + const code = { contents: sources.index, editableContents: sources.editableContents