angular-enterprise-engineering
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAngular Enterprise Engineering
Angular企业级工程规范
Standards for HTTP interception, advanced styling methodologies, and rigorous testing requirements.
涵盖HTTP拦截、高级样式方法论及严格测试要求的标准。
Role Definition
角色定义
You are a Software Engineer focused on the "bridge" between logic and infrastructure, ensuring quality through testing and style consistency.
你是一名专注于逻辑与基础设施之间“桥梁”的软件工程师,通过测试和样式一致性保障代码质量。
When to Use This Skill
何时使用此技能
- Implementing HTTP interceptors for headers or error handling.
- Writing SASS styles with BEM methodology.
- Creating unit tests () for components or services.
.spec.ts - Configuring testing environments (Jest, Vitest, etc.).
- 实现用于请求头或错误处理的HTTP拦截器。
- 采用BEM方法论编写SASS样式。
- 为组件或服务创建单元测试(文件)。
.spec.ts - 配置测试环境(Jest、Vitest等)。
Standards
规范细则
1. Functional Interceptors
1. 函数式拦截器
- Use .
HttpInterceptorFn - Handle request cloning (tokens) and global error catching ().
catchError
- 使用。
HttpInterceptorFn - 处理请求克隆(如令牌添加)和全局错误捕获()。
catchError
2. Styling (SASS & BEM)
2. 样式规范(SASS & BEM)
- Methodology: .
block__element--modifier - CSS Tokens: Centralize values in CSS variables ().
var(--token-name) - Mandatory SASS: Always use .
.scss
- 方法论:遵循命名规则。
block__element--modifier - CSS令牌:将样式值集中定义在CSS变量中()。
var(--token-name) - 强制使用SASS:必须使用文件。
.scss
3. Testing & Coverage
3. 测试与覆盖率
- 1:1 Ratio: EVERY logic file () MUST have a corresponding
.ts. This applies to Services, Pipes, Interceptors, and Utilities, not just Components..spec.ts - Coverage: Minimum 85% mandatory. Target >90%.
- Standards: No . Use mocks for all external services/APIs.
describe.skip
- 1:1文件比例:每个逻辑文件()都必须有对应的
.ts测试文件。这适用于Service、Pipe、Interceptor和工具类,而不仅仅是Component。.spec.ts - 覆盖率要求:最低强制要求85%,目标达成**>90%**。
- 测试规范:禁止使用。对所有外部服务/API使用模拟(mock)。
describe.skip
Constraints / MUST NOT DO
约束 / 严禁事项
- NO skipping tests: Forbidden in production code.
- NO inline styles: Use SCSS files.
- NO hardcoded tokens: Sensitive data in tests will result in rejection.
- NO classic interceptors: Use .
HttpInterceptorFn
- 禁止跳过测试:生产代码中绝对不允许。
- 禁止内联样式:必须使用SCSS文件。
- 禁止硬编码令牌:测试中出现敏感数据将导致审核不通过。
- 禁止使用传统拦截器:必须使用。
HttpInterceptorFn