Repository navigation
Conversation
|
Hi there, Thanks for opening this pull request. The automated checks found some issues: Checklist: The PR description is missing the required checklist or some of its items are not completed:
Please edit your PR description to include the following template with the checklist items completed. Checklist:
<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->
- [ ] I have read and followed the [contribution guidelines](https://contribute.freecodecamp.org).
- [ ] I have read and followed the [how to open a pull request guide](https://contribute.freecodecamp.org/how-to-open-a-pull-request/).
- [ ] My pull request targets the `main` branch of freeCodeCamp.
- [ ] I have tested these changes either locally on my machine, or GitHub Codespaces.
<!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.-->
Closes #XXXXX
<!-- Feel free to add any additional description of changes below this line -->Join us in our chat room or our forum if you have any questions or need help with contributing. |
imsomilg
left a comment
There was a problem hiding this comment.
Always try to maintain good code readability; in this case, you can achieve it by destructuring. Additionally, please use an optional chaining check on factorialCalculator, as parameters will throw a TypeError if the camper never defines factorialCalculator.
Also, could you please update your PR title? It's currently a bit vague. It's best to briefly describe the exact issue you are resolving, especially since the title will become the commit message once the PR is merged.
|
Updated the test to destructure factorialCalculator and use optional chaining before reading parameters, so an undefined function produces an assertion failure instead of a TypeError. I also updated the title to describe the arrow-function issue directly. The targeted curriculum tests (6/6), challenge lint, and Prettier check all pass. |
majestic-owl448
left a comment
There was a problem hiding this comment.
Hi @wunianze666-netizen. Congrats on your first pull request (PR)! 🎉
Thank you for your contribution to the page! 👍
We are happy to accept these changes and look forward to future contributions. 📝
Checklist:
mainbranch of freeCodeCamp.Closes #69484
Summary
Function.prototype.toString()regex with the curriculumExplorerAST helperfactorialCalculatorparameter count independently of function syntaxWhy
The previous regex only matched a named function declaration, so valid function expressions and arrow functions failed the parameter hint. Inspecting the parsed function node makes the test accept all three forms while still requiring exactly one parameter.
Validation
pnpm exec vitest run --project testwithFCC_CHALLENGE_ID=66c07238b01053abaf812065(6 passed)pnpm -F @freecodecamp/curriculum lint-challengespnpm exec prettier --check curriculum/challenges/english/blocks/lab-factorial-calculator/66c07238b01053abaf812065.md