-
-
Notifications
You must be signed in to change notification settings - Fork 159
West Midlands | 25-ITP-Sep | Baba Yusuf | Sprint 3 | Refactoring-dead-code #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copilot Instructions for Module-Data-Flows | ||
|
|
||
| Use these repo-specific guidelines so AI coding agents are productive and non-disruptive across this multi-exercise teaching repo. | ||
|
|
||
| ## Scope & Structure | ||
|
|
||
| - This repo hosts many standalone exercises grouped by topic: [Sprint-1](Sprint-1), [Sprint-3](Sprint-3), [challenges](challenges), [debugging](debugging), [fetch](fetch). | ||
| - Work locally within the specific exercise folder. Avoid cross-folder refactors or adding global dependencies. | ||
| - Read each exercise’s README first (e.g. [Sprint-1/destructuring/exercise-3/readme.md](Sprint-1/destructuring/exercise-3/readme.md), [Sprint-3/dead-code/README.md](Sprint-3/dead-code/README.md)). | ||
|
|
||
| ## Workflows | ||
|
|
||
| - Formatting: run `npm run format` at repo root (see [package.json](package.json)). Keep edits Prettier-friendly. | ||
| - Tests (root): `npm test` runs Jest across the repo using a broad match (see [package.json](package.json)). Prefer running tests in the relevant subfolder when possible to keep scope tight. | ||
| - Tests (subfolders): some folders have their own config/scripts: | ||
| - Unit testing hub: [challenges/unit-testing/package.json](challenges/unit-testing/package.json) → run `npm test` in that folder. | ||
| - ESM example: [debugging/exampleEJS/package.json](debugging/exampleEJS/package.json) runs Jest via Node’s `--experimental-vm-modules`. | ||
| - Script-free exercises: execute files directly with Node to check console output (e.g., `node Sprint-3/dead-code/exercise-1.js`). | ||
|
|
||
| ## Module Systems | ||
|
|
||
| - Default is CommonJS: use `require(...)` and `module.exports` (e.g., [challenges/unit-testing/passing-tests/factorial/factorial.test.js](challenges/unit-testing/passing-tests/factorial/factorial.test.js)). | ||
| - Some folders opt into ESM with `"type": "module"` (e.g., [debugging/exampleEJS/package.json](debugging/exampleEJS/package.json)). Match the module format of the folder you’re editing. | ||
|
|
||
| ## Testing Patterns | ||
|
|
||
| - Tests are colocated with exercises. Implementations sit beside tests with matching basenames (e.g., `factorial.test.js` ↔ `factorial.js`). | ||
| - See [challenges/unit-testing/passing-tests/factorial/factorial.test.js](challenges/unit-testing/passing-tests/factorial/factorial.test.js) and [challenges/unit-testing/passing-tests/factorial/factorial.js](challenges/unit-testing/passing-tests/factorial/factorial.js). | ||
| - Some kata folders intentionally provide empty test files to be completed via TDD (e.g., [challenges/unit-testing/katas-tdd/roman-numerals/convert-to-old-roman.test.js](challenges/unit-testing/katas-tdd/roman-numerals/convert-to-old-roman.test.js)). | ||
| - Jest version is pinned in package files; avoid adding transform layers. Keep implementations simple and idiomatic JS. | ||
| - To focus tests from root: `npm test -- <relative/test/path> -t "pattern"`. | ||
|
|
||
| ## Exercise-Specific Conventions | ||
|
|
||
| - Dead code refactors: maintain exact final console output while removing unused/duplicated logic (see [Sprint-3/dead-code](Sprint-3/dead-code)). Prefer pure functions and minimal variables. | ||
| - Destructuring tasks: follow the README’s output formatting precisely; use object/array destructuring where asked (see [Sprint-1/destructuring](Sprint-1/destructuring)). | ||
| - Writing tests: when a test is a stub, derive behaviour from the README then write tests first, followed by the simplest implementation. | ||
|
|
||
| ## Do / Don’t | ||
|
|
||
| - Do: keep changes local to a single exercise; preserve file names and locations; match the folder’s module system; run only relevant tests. | ||
| - Don’t: introduce new npm deps, change top-level configs, or modify unrelated exercises to “fix” failing global runs. | ||
|
|
||
| ## Start Here (per task) | ||
|
|
||
| - Open the exercise README and files in its folder. | ||
| - If tests exist, run them in the subfolder and implement the missing logic. If tests are stubs, write them first based on the README. | ||
| - Verify with local run (`node ...` or `npm test`), then format (`npm run format`). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,9 @@ let testName = "Jerry"; | |
| const greeting = "hello"; | ||
|
|
||
| function sayHello(greeting, name) { | ||
| const greetingStr = greeting + ", " + name + "!"; | ||
| // const greetingStr = greeting + ", " + name + "!"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well done for doing this correctly! But the instructions said to remove the code and you commented it out! This is important, because comments taks up space in your codebase, so commenting out and deleting are not the same thing! Make sure to delete them next time :) |
||
| return `${greeting}, ${name}!`; | ||
| console.log(greetingStr); | ||
| //console.log(greetingStr); | ||
| } | ||
|
|
||
| testName = "Aman"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that comment at the bottom on line 16 is also redundant! |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initial Jerry name is also never used is it?