mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-30 03:03:06 -05:00
fix: remove comments again (#50718)
Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6ff167fe74
commit
918cabed2d
@@ -69,14 +69,13 @@ assert(
|
||||
Template strings and expression interpolation should be used.
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(getUserInput('index').match(/(`.*\${.*}.*`)/));
|
||||
assert.match(code, /(`.*\${.*}.*`)/);
|
||||
```
|
||||
|
||||
An iterator should be used.
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
assert(getUserInput('index').match(/for|map|reduce|forEach|while/));
|
||||
assert(code.match(/for|map|reduce|forEach|while/));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -36,24 +36,21 @@ An array is declared as `const s = [5, 7, 2]`. Change the array to `[2, 5, 7]` u
|
||||
You should not replace `const` keyword.
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(getUserInput('index').match(/const/g));
|
||||
assert(code.match(/const/g));
|
||||
```
|
||||
|
||||
`s` should be a constant variable (by using `const`).
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(getUserInput('index').match(/const\s+s/g));
|
||||
assert(code.match(/const\s+s/g));
|
||||
```
|
||||
|
||||
You should not change the original array declaration.
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
assert(
|
||||
getUserInput('index').match(
|
||||
/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g
|
||||
)
|
||||
);
|
||||
assert(code.match(
|
||||
/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g
|
||||
));
|
||||
```
|
||||
|
||||
`s` should be equal to `[2, 5, 7]`.
|
||||
|
||||
@@ -34,25 +34,21 @@ In this challenge you are going to use `Object.freeze` to prevent mathematical c
|
||||
You should not replace the `const` keyword.
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(getUserInput('index').match(/const/g));
|
||||
assert(code.match(/const/g));
|
||||
```
|
||||
|
||||
`MATH_CONSTANTS` should be a constant variable (by using `const`).
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g));
|
||||
assert(code.match(/const\s+MATH_CONSTANTS/g));
|
||||
```
|
||||
|
||||
You should not change the original declaration of `MATH_CONSTANTS`.
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
assert(
|
||||
getUserInput('index').match(
|
||||
/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g
|
||||
)
|
||||
);
|
||||
assert(code.match(
|
||||
/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g
|
||||
));
|
||||
```
|
||||
|
||||
`PI` should equal `3.14`.
|
||||
|
||||
@@ -49,7 +49,7 @@ assert(testArr_.every((e, i) => e === i + 1) && testArr_.length === 5);
|
||||
`Array.slice()` should not be used.
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(!getUserInput('index').match(/slice/g));
|
||||
assert(!code.match(/slice/g));
|
||||
```
|
||||
|
||||
Destructuring on `list` should be used.
|
||||
@@ -82,6 +82,7 @@ const sourceWithoutFirstTwo = removeFirstTwo(source);
|
||||
|
||||
```js
|
||||
function removeFirstTwo(list) {
|
||||
// comment with 'slice' to check comments are removed in tests
|
||||
const [, , ...shorterList] = list;
|
||||
return shorterList;
|
||||
}
|
||||
|
||||
@@ -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(!code.match(/function/));
|
||||
assert(!code.match(/function/));
|
||||
```
|
||||
|
||||
`setGear` should be a declarative function.
|
||||
@@ -79,6 +79,7 @@ console.log(bicycle.gear);
|
||||
```js
|
||||
const bicycle = {
|
||||
gear: 2,
|
||||
// setGear: function(newGear) {
|
||||
setGear(newGear) {
|
||||
this.gear = newGear;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ assert.deepEqual(
|
||||
Your code should not use `key:value`.
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(!getUserInput('index').match(/:/g));
|
||||
assert(!code.match(/:/g))
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -66,10 +66,17 @@ const createPerson = (name, age, gender) => {
|
||||
|
||||
```js
|
||||
const createPerson = (name, age, gender) => {
|
||||
// Only change code below this line
|
||||
/*return {
|
||||
name: name,
|
||||
age: age,
|
||||
gender: gender
|
||||
};*/
|
||||
return {
|
||||
name,
|
||||
age,
|
||||
gender
|
||||
};
|
||||
// Only change code above this line
|
||||
};
|
||||
```
|
||||
|
||||
@@ -334,6 +334,9 @@ Challenges that have been already audited cannot fall back to their English vers
|
||||
challenge.translationPending =
|
||||
lang !== 'english' && !isAuditedCert(lang, meta.superBlock);
|
||||
challenge.usesMultifileEditor = !!meta.usesMultifileEditor;
|
||||
}
|
||||
|
||||
function fixChallengeProperties(challenge) {
|
||||
if (challenge.challengeFiles) {
|
||||
// The client expects the challengeFiles to be an array of polyvinyls
|
||||
challenge.challengeFiles = challengeFilesToPolys(
|
||||
@@ -345,6 +348,10 @@ Challenges that have been already audited cannot fall back to their English vers
|
||||
// can sort them correctly.
|
||||
challenge.solutions = challenge.solutions.map(challengeFilesToPolys);
|
||||
}
|
||||
// if removeComments is not explicitly set, default to true
|
||||
if (typeof challenge.removeComments === 'undefined') {
|
||||
challenge.removeComments = true;
|
||||
}
|
||||
}
|
||||
|
||||
async function createChallenge(filePath, maybeMeta) {
|
||||
@@ -371,6 +378,7 @@ Challenges that have been already audited cannot fall back to their English vers
|
||||
: parseMD(getFullPath('english', filePath)));
|
||||
|
||||
addMetaToChallenge(challenge, meta);
|
||||
fixChallengeProperties(challenge);
|
||||
|
||||
return challenge;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const schema = Joi.object()
|
||||
block: Joi.string().regex(slugRE).required(),
|
||||
blockId: Joi.objectId(),
|
||||
challengeOrder: Joi.number(),
|
||||
removeComments: Joi.bool(),
|
||||
removeComments: Joi.bool().required(),
|
||||
certification: Joi.string().regex(slugRE),
|
||||
challengeType: Joi.number().min(0).max(19).required(),
|
||||
checksum: Joi.number(),
|
||||
|
||||
Reference in New Issue
Block a user