Frontend Standards Enforcer
Goal: turn standards from recommendations into enforceable gates.
SSOT
- •
../../frontend-code-standards.md - •Frontend development specification document (Chinese source file in repo)
- •
../contracts/quality-gates.md
Check Scope
- •Project structure
- •Directory layering, file organization, and responsibility boundaries.
- •Component standards
- •Component taxonomy, file structure, and design principles.
- •Naming conventions
- •Consistent naming for files, variables, functions, and events.
- •Code style
- •Import ordering, render logic organization, and readability.
- •TypeScript standards
- •Type definitions, props typing, and export patterns.
- •Performance standards
- •Rerender control, splitting strategy, list optimization, and caching.
- •Testing standards
- •Test file organization and critical-path coverage.
- •Security and compatibility baseline
- •Input safety, sensitive-data exposure checks, and mainstream browser compatibility.
- •Change-boundary compliance
- •For style tasks, verify whether changes cross into non-target modules or business logic.
- •Icon-system consistency (on demand)
- •If icon artifacts exist, validate naming, size tiers, and style-rule consistency.
Hard Rules
- •
anyis not allowed unless strongly justified; otherwise block. - •Business functions should be <= 50 lines; split when exceeded.
- •Render logic > 30 lines must be extracted into subcomponents.
- •Prop drilling deeper than 3 levels should migrate to Context/state management.
- •Repeated patterns >= 3 must be extracted.
- •If
style.scope.lock.jsonexists, out-of-scope edits must be blocked.
Execution Method
- •Each check item must output one of:
pass / warning / block. - •Every blocked item must include the shortest repair path.
Output Contract
- •Violation list (sorted by severity)
- •Directly executable fix suggestions
- •Estimated benefits and risks
- •Merge recommendation
Collaboration
- •Serves as the code-quality checker in
ui-codegen-master. - •Works with
ui-component-extractorfor post-refactor regression checks.