AgentSkillsCN

react-audit-grep-patterns

提供完整且经过验证的 grep 扫描命令库,用于在 React 18.3.1 或 React 19 升级前审计 React 代码库。无论运行的是 react18-auditor 还是 react19-auditor 代理,只要进行迁移审计就使用这项技能。包含所有 grep 模式,可用于查找已弃用的 API、被移除的 API、不安全的生命周期方法、批处理漏洞、测试文件问题、依赖冲突,以及 React 19 特定的移除内容。编写审计扫描命令时务必使用这项技能——切勿依赖记忆中的 grep 语法,尤其是对于需要上下文标志的多行 async setState 模式。

SKILL.md
--- frontmatter
name: react-audit-grep-patterns
description: 'Provides the complete, verified grep scan command library for auditing React codebases before a React 18.3.1 or React 19 upgrade. Use this skill whenever running a migration audit - for both the react18-auditor and react19-auditor agents. Contains every grep pattern needed to find deprecated APIs, removed APIs, unsafe lifecycle methods, batching vulnerabilities, test file issues, dependency conflicts, and React 19 specific removals. Always use this skill when writing audit scan commands - do not rely on memory for grep syntax, especially for the multi-line async setState patterns which require context flags.'

React Audit Grep Patterns

Complete scan command library for React 18.3.1 and React 19 migration audits.

Usage

Read the relevant section for your target:

  • references/react18-scans.md - all scans for React 16/17 → 18.3.1 audit
  • references/react19-scans.md - all scans for React 18 → 19 audit
  • references/test-scans.md - test file specific scans (used by both auditors)
  • references/dep-scans.md - dependency and peer conflict scans

Base Patterns Used Across All Scans

bash
# Standard flags used throughout:
# -r = recursive
# -n = show line numbers
# -l = show filenames only (for counting affected files)
# --include="*.js" --include="*.jsx" = JS/JSX files only
# | grep -v "\.test\.\|\.spec\.\|__tests__" = exclude test files
# | grep -v "node_modules" = safety (usually handled by not scanning node_modules)
# 2>/dev/null = suppress "no files found" errors

# Source files only (exclude tests):
SRC_FLAGS='--include="*.js" --include="*.jsx"'
EXCLUDE_TESTS='grep -v "\.test\.\|\.spec\.\|__tests__"'

# Test files only:
TEST_FLAGS='--include="*.test.js" --include="*.test.jsx" --include="*.spec.js" --include="*.spec.jsx"'