Static analysis extension for detecting React performance issues and antipatterns.
This extension requires the React Analyzer CLI to be installed separately.
The VS Code extension is a UI wrapper around the CLI tool. You must install the CLI first before using the extension.
The extension cannot function without the CLI installed on your system.
macOS/Linux:
curl -fsSL https://raw.githubusercontent.com/rautio/react-analyzer/main/install.sh | shWindows:
Download the CLI .zip from Releases, extract it, and add react-analyzer.exe to your PATH.
Verify Installation:
react-analyzer --versionOnce the CLI is installed, install the VS Code extension:
- Download the latest
react-analyzer-*.vsixfrom Releases - Install via command line:
code --install-extension react-analyzer-<version>.vsix
Or via VS Code UI:
- Open Extensions view (Ctrl/Cmd+Shift+X)
- Click "..." → "Install from VSIX..."
- Select the downloaded file
The extension will automatically detect the CLI if it's installed in your PATH. If you installed the CLI to a custom location, you can configure the path in VS Code settings: reactAnalyzer.cliPath
- Real-time diagnostics: See performance issues directly in your editor with squiggly underlines
- Component Tree View: Visual sidebar showing component hierarchy and state flow
- Hierarchical component tree with parent-child relationships
- State nodes showing where state is defined and consumed
- Click any item to navigate to its definition
- Refresh button to re-analyze the project
- Enhanced diagnostics with Related Information: Click through the full chain of related code locations
- Analyze on save: Automatically analyze files when you save them
- Workspace analysis: Analyze your entire project with a single command
- 6 production-ready rules:
no-object-deps: Detect inline objects/arrays in hook dependenciesunstable-props-to-memo: Detect unstable props passed to memoized componentsno-derived-state: Detect useState mirroring props (anti-pattern)no-stale-state: Detect state updates without functional formno-inline-props: Detect inline objects/arrays/functions in JSX propsdeep-prop-drilling: Detect props drilled through 3+ component levels (configurable)
React Analyzer: Analyze Current File- Analyze the currently open fileReact Analyzer: Analyze Workspace- Analyze all React files in the workspaceReact Analyzer: Clear All Diagnostics- Clear all diagnostic markersRefresh Component Tree- Re-analyze and update the component tree view
reactAnalyzer.enabled- Enable/disable the extension (default:true)reactAnalyzer.analyzeOnSave- Run analysis when files are saved (default:true)reactAnalyzer.cliPath- Path to react-analyzer CLI binary (leave empty to use bundled binary)
Create a .rarc (or .reactanalyzerrc.json) file in your project root to customize rules and path aliases:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@components/*": ["src/components/*"]
}
},
"rules": {
"deep-prop-drilling": {
"enabled": true,
"options": {
"maxDepth": 3
}
}
}
}See the Configuration Guide for more details.
- Open a React file (
.tsx,.jsx,.ts,.js) - Run command:
React Analyzer: Analyze Current File - Issues will appear as squiggly underlines in the editor
By default, files are automatically analyzed when saved. You can disable this in settings:
{
"reactAnalyzer.analyzeOnSave": false
}Issues appear in:
- Editor: Squiggly underlines with hover messages
- Problems panel: All issues across your workspace with clickable Related Information
The Component Tree View appears in the Explorer sidebar:
- View the tree: Open the Explorer sidebar and find the "React Components" section
- Navigate:
- Expand "Components" to see your component hierarchy
- Expand "State" to see all state nodes in your project
- Click any item to jump to its definition in code
- Refresh: Click the refresh icon in the tree view toolbar to re-analyze
The tree shows:
- Parent-child component relationships
- Which components are memoized
[memo] - State nodes defined in each component
(2 state) - State type indicators
[useState],[context], etc.
-
Error (red): Bugs that can cause runtime issues
no-stale-state: Can cause race conditionsno-derived-state: Can cause sync issues
-
Warning (yellow): Performance issues
no-object-deps: Causes infinite re-rendersunstable-props-to-memo: Breaks memoizationno-inline-props: Creates unnecessary re-renders
-
Information (blue): Code quality suggestions
deep-prop-drilling: Consider using Context API
- Go 1.20+ (for building the CLI)
- Node.js 16+ (for the extension)
# Build the CLI
cd ..
go build -o react-analyzer cmd/react-analyzer/main.go
# Build the extension
cd vscode-extension
npm install
npm run compilePress F5 in VS Code to launch the Extension Development Host and test the extension.
MIT