Updated preference files
This commit is contained in:
@@ -104,6 +104,12 @@ Import-Module "$script:AppRoot\Modules\ProjectName.psm1" -Force
|
||||
- Do **not** create test files — I'll run the code directly to verify it works
|
||||
- If asked to write tests, use **Pester** with `Invoke-Pester -Path .\Tests\ -Output Detailed`
|
||||
|
||||
## Common Gotchas
|
||||
|
||||
- **Variable followed by colon:** `"$var: text"` fails — PowerShell treats `: text` as part of the variable name. Use `"${var}: text"` instead.
|
||||
- **Returning arrays from functions:** A single-item array gets unrolled on return. Use `return ,$array` (comma prefix) to force PowerShell to return the array as-is.
|
||||
- **UTF-8 file writes:** Use `[System.IO.File]::WriteAllText($path, $content, [System.Text.Encoding]::UTF8)` instead of `Out-File` — avoids BOM and encoding issues with special characters.
|
||||
|
||||
## Comments
|
||||
|
||||
- Comment the **why**, not the **what** — code should be readable on its own
|
||||
|
||||
Reference in New Issue
Block a user