From ddc18bbe4c2c1b8e90465b4e9daf14828ab61d12 Mon Sep 17 00:00:00 2001 From: Josh Spicer <23246594+joshspicer@users.noreply.github.com> Date: Thu, 19 Feb 2026 12:55:03 -0800 Subject: [PATCH] hygiene skill updates (#296347) --- .github/skills/hygiene/SKILL.md | 43 +++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/skills/hygiene/SKILL.md b/.github/skills/hygiene/SKILL.md index 084b76c719c..bcf882fc5c0 100644 --- a/.github/skills/hygiene/SKILL.md +++ b/.github/skills/hygiene/SKILL.md @@ -1,25 +1,38 @@ +--- +name: hygiene +description: Use when making code changes to ensure they pass VS Code's hygiene checks. Covers the pre-commit hook, unicode restrictions, string quoting rules, copyright headers, indentation, formatting, ESLint, and stylelint. Run the hygiene check before declaring work complete. +--- + # Hygiene Checks VS Code runs a hygiene check as a git pre-commit hook. Commits will be rejected if hygiene fails. -## What it checks +## Running the hygiene check -The hygiene linter scans all staged `.ts` files for issues including (but not limited to): +**Always run the pre-commit hygiene check before declaring work complete.** This catches issues that would block a commit. -- **Unicode characters**: Non-ASCII characters (em-dashes, curly quotes, emoji, etc.) are rejected. Use ASCII equivalents in comments and code. -- **Double-quoted strings**: Only use `"double quotes"` for externalized (localized) strings. Use `'single quotes'` everywhere else. -- **Copyright headers**: All files must include the Microsoft copyright header. - -## How it runs - -The git pre-commit hook (via husky) runs `npm run precommit`, which executes: - -```bash -node --experimental-strip-types build/hygiene.ts -``` - -This scans only **staged files** (from `git diff --cached`). To run it manually: +To run the hygiene check on your staged files: ```bash npm run precommit ``` + +This executes `node --experimental-strip-types build/hygiene.ts`, which scans only **staged files** (from `git diff --cached`). + +To check specific files directly (without staging them first): + +```bash +node --experimental-strip-types build/hygiene.ts path/to/file.ts +``` + +## What it checks + +The hygiene linter scans staged files for issues including (but not limited to): + +- **Unicode characters**: Non-ASCII characters (em-dashes, curly quotes, emoji, etc.) are rejected. Use ASCII equivalents in comments and code. Suppress with `// allow-any-unicode-next-line` or `// allow-any-unicode-comment-file`. +- **Double-quoted strings**: Only use `"double quotes"` for externalized (localized) strings. Use `'single quotes'` everywhere else. +- **Copyright headers**: All files must include the Microsoft copyright header. +- **Indentation**: Tabs only, no spaces for indentation. +- **Formatting**: TypeScript files must match the formatter output (run `Format Document` to fix). +- **ESLint**: TypeScript files are linted with ESLint. +- **Stylelint**: CSS files are linted with stylelint.