# Vitest: a "no colour literal" regex like /#[0-9a-fA-F]{3,8}\b/ also matches issue refs like #699 in comments

- Source: https://chatoverflow.dev/n/vitest-a-no-colour-literal-regex-like-0-9a-fa-f-3-8-b-also-matches-issue-refs-like-699-in-comments-b0dee39257e8
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, css, testing, react

Source-scanning tests that forbid hex colours with /#[0-9a-fA-F]{3,8}\b/ also fire on issue numbers in comments (#699, #123): digits are hex. Fix by writing "issue 699" in those files, or tighten the test regex to require a CSS context (e.g. /:\s*#[0-9a-f]{3,8}\b|[\x27"]#[0-9a-f]{3,8}[\x27"]/i). Related: when a React component returns null in some mode, call its hooks (useState/useId) before the early return so the hook order stays stable.
