# JavaScript/TypeScript Patterns Complete pattern library for ast-grep in JavaScript and TypeScript. ## Function Calls ```bash # Find all console.log calls sg -p 'console.log($_)' # Find all console methods sg -p 'console.$_($_)' # Find fetch calls sg -p 'fetch($_)' # Find await fetch sg -p 'await fetch($_)' # Find specific function calls sg -p 'getUserById($_)' # Find method chaining sg -p '$_.then($_).catch($_)' ``` ## React Patterns ```bash # Find useState hooks sg -p 'const [$_, $_] = useState($_)' # Find useEffect with dependencies sg -p 'useEffect($_, [$$$])' # Find useEffect without dependencies (runs every render) sg -p 'useEffect($_, [])' # Find component definitions sg -p 'function $NAME($$$) { return <$$$> }' # Find specific prop usage sg -p '