js-libraries

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Use secure and up-to-date JS libraries

使用安全且版本最新的JS库

Outdated or vulnerable libraries pose security risks and often include unnecessary bloat that degrades performance.
过时或存在漏洞的库会带来安全风险,且通常包含不必要的冗余代码,会降低性能。

Quick Reference

快速参考

  • Regularly audit dependencies for known security vulnerabilities
  • Replace heavy libraries with lightweight alternatives (e.g., date-fns vs moment)
  • Ensure libraries are properly versioned and served via reliable CDNs or self-hosted
  • 定期审计依赖项,排查已知安全漏洞
  • 用轻量级替代方案替换重型库(例如:date-fns 与 moment)
  • 确保库的版本规范,并通过可靠的CDN或自托管方式提供服务

Check

检查

Check the project's JavaScript dependencies for known vulnerabilities and outdated versions.
检查项目的JavaScript依赖项是否存在已知漏洞和版本过时问题。

Fix

修复

Update vulnerable libraries to secure versions and replace bloated dependencies with modern, lightweight alternatives.
将存在漏洞的库更新至安全版本,并用现代轻量级替代方案替换臃肿的依赖项。

Explain

说明

Explain the risks of using outdated JavaScript libraries and the benefits of using lightweight alternatives.
说明使用过时JavaScript库的风险,以及使用轻量级替代方案的优势。

Code Review

代码审查

Review the routes, assets, and loading behavior that affect Use secure and up-to-date JS libraries. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.

For full implementation details, code examples, and framework-specific guidance, see
references/rule.md
.
审查与「使用安全且最新的JS库」规则相关的路由、资源及加载行为。标记出会产生不必要的网络、CPU或布局开销的具体文件、请求或渲染步骤,并说明用于确认该问题的测量方法。

如需完整的实现细节、代码示例以及特定框架的指导,请参阅
references/rule.md