hygiene
VS Code pre-commit hygiene check tool, automatically performing code quality checks before committing, blocking commits if hygiene checks fail, ensuring code repository quality standards.
npx skills add https://github.com/microsoft/vscode --skill hygieneBefore / After Comparison
1 组Manually checking code quality and formatting standards easily leads to overlooked issues. Submitting non-compliant code requires repeated modifications and pushes, affecting team collaboration efficiency.
Automatically perform pre-commit hygiene checks, intercepting non-compliant code with zero omissions, ensuring every commit meets quality standards.
hygiene
Hygiene Checks
VS Code runs a hygiene check as a git pre-commit hook. Commits will be rejected if hygiene fails.
Running the hygiene check
Always run the pre-commit hygiene check before declaring work complete. This catches issues that would block a commit.
To run the hygiene check on your staged files:
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):
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-lineor// 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 Documentto fix). -
ESLint: TypeScript files are linted with ESLint.
-
Stylelint: CSS files are linted with stylelint.
Weekly Installs437Repositorymicrosoft/vscodeGitHub Stars183.5KFirst SeenFeb 20, 2026Security AuditsGen Agent Trust HubPassSocketPassSnykPassInstalled onkimi-cli436amp436github-copilot436opencode436cursor436gemini-cli436
User Reviews (0)
Write a Review
No reviews yet
Statistics
User Rating
Rate this Skill