frontend-ai-review
AI-powered code review tool for frontend developers
2,319
| Install | |
|---|---|
npm install frontend-ai-review |
|
| Latest Version: | 2.3.1 |
| License: | MIT |
| Last Updated: | Mar 19, 2026 |
| Links: | GitHub · npm |
Maintainer: yulingsong
Frontend AI Review ๐ค
AI-powered code review tool for frontend developers
โจ Features
| Feature | Description |
|---|---|
| ๐ Multi-Framework | React, Vue, Next.js, Nuxt.js, Svelte |
| โก High Performance | Parallel analysis, incremental caching |
| ๐ 47+ Rules | React, Vue, TypeScript, Security, Performance, Best Practices |
| ๐ค Multi AI Support | OpenAI, Anthropic, Google Gemini, Azure, Cohere, Mistral, Qwen |
| ๐ง Auto-Fix | Automatically fix fixable issues |
| โ๏ธ CLI Options | Flexible configuration |
| ๐ Config File | Supports .fairrc.json |
| ๐ Multiple Outputs | Text/JSON/GitHub/SARIF format |
| ๐ CI/CD Integration | GitHub Actions, GitLab CI, Jenkins |
| ๐งช Test Support | Built-in unit tests |
| ๐ i18n | English, Chinese, Japanese, Spanish, French, German |
๐ Quick Start
Installation
# Install globally with npm
npm install -g frontend-ai-review
# Or use npx
npx frontend-ai-review /path/to/project
Local Usage
# Clone the project
git clone https://github.com/Yulingsong/frontend-ai-review.git
cd frontend-ai-review
# Install dependencies
npm install
# Build
npm run build
# Run
node dist/index.js /path/to/project
๐ CLI Options
| Option | Description | Default | Example |
|---|---|---|---|
-o, --output |
Output format | text | -o json |
-s, --severity |
Minimum severity | suggestion | -s warning |
-c, --category |
Categories | all | -c react,vue |
-e, --exclude |
Exclude files | - | -e "node_modules/**" |
-r, --rules |
Specific rules | all | -r react/exhaustive-deps |
--ai |
Enable AI analysis | false | --ai |
--ai-model |
AI model | gpt-4o-mini | --ai-model gpt-4 |
--ai-provider |
AI provider | openai | --ai-provider anthropic |
--fix |
Auto-fix issues | false | --fix |
--parallel |
Parallel analysis | false | --parallel |
--cache |
Enable caching | false | --cache |
--git |
Git incremental | false | --git --staged |
-i, --interactive |
Interactive mode | false | -i |
--init |
Create config | - | --init |
-h |
Show help | - | -h |
๐ Configuration File
Create .fairrc.json in your project root:
{
"severity": "warning",
"output": "text",
"exclude": [
"node_modules/**",
"dist/**",
"build/**",
".next/**"
],
"category": [
"react",
"vue",
"typescript",
"security"
],
"ai": false,
"aiModel": "gpt-4o-mini",
"aiProvider": "openai"
}
๐ค AI Analysis
Supports multiple AI providers:
# OpenAI (default)
export OPENAI_API_KEY=sk-your-key
fair /path/to/project --ai
# Anthropic Claude
export ANTHROPIC_API_KEY=sk-ant-your-key
fair /path/to/project --ai --ai-provider anthropic
# Google Gemini
export GEMINI_API_KEY=your-gemini-key
fair /path/to/project --ai --ai-provider gemini
# Azure OpenAI
export AZURE_OPENAI_API_KEY=your-key
fair /path/to/project --ai --ai-provider azure --azure-endpoint https://your-resource.openai.azure.com
# Cohere
export COHERE_API_KEY=your-key
fair /path/to/project --ai --ai-provider cohere
# Mistral
export MISTRAL_API_KEY=your-key
fair /path/to/project --ai --ai-provider mistral
# Alibaba Qwen
export QWEN_API_KEY=your-key
fair /path/to/project --ai --ai-provider qwen
๐ง Auto-Fix
Automatically fix fixable issues:
fair /path/to/project --fix
Supported Rules
| Rule | Fix |
|---|---|
perf/console-log |
Delete console.log line |
best-practice/no-var |
Replace var with let |
best-practice/prefer-const |
Replace let with const |
โก Performance
# Parallel analysis - recommended for large projects
fair /path/to/project --parallel
# Incremental caching - skip unchanged files
fair /path/to/project --cache
# Git-based incremental analysis
fair /path/to/project --git --staged
fair /path/to/project --git --branch main
fair /path/to/project --git --since HEAD~3
๐ CI/CD Integration
GitHub Actions
name: Frontend AI Code Review
on: [push, pull_request]
jobs:
code-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Code Review
run: npx fair . -s warning -o github
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GitLab CI
Jenkins
๐ Output Example
๐ค Frontend AI Review v2.2.0
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Framework: react
Severity: suggestion
Rules: 47 enabled
Found 25 files to analyze
๐ src/App.tsx
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก react/exhaustive-deps line 23
useEffect dependency array may be incomplete
๐ด security/hardcoded-credentials line 5
Hardcoded credentials detected
๐ต perf/console-log line 10 ๐ก Fixable: Delete this line
๐ Summary
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Files: 25 | Analyzed: 25 | Issues: 8
Errors: 2
Warnings: 8
Suggestions: 5
๐ By Category
security: 2
react: 3
best-practice: 3
๐ฆ Built-in Rules (47+)
๐ด React (10)
| Rule ID | Description | Severity |
|---|---|---|
react/exhaustive-deps |
useEffect dependency incomplete | warning |
react/no-array-index-key |
No array index as key | warning |
react/hooks-rule-of-hooks |
Hooks must be at top level | error |
react/no-direct-mutation-state |
No direct state mutation | error |
react/button-has-type |
Button type required | suggestion |
react/prop-types |
Prop types required | warning |
๐ Vue (6)
| Rule ID | Description | Severity |
|---|---|---|
vue/v-for-key |
v-for needs key | warning |
vue/v-if-with-v-for |
v-if with v-for | error |
๐ TypeScript (6)
| Rule ID | Description | Severity |
|---|---|---|
typescript/no-any |
No any type | warning |
typescript/no-unused-vars |
No unused vars | warning |
๐ Security (8)
| Rule ID | Description | Severity |
|---|---|---|
security/eval |
No eval | error |
security/hardcoded-credentials |
No credentials | error |
security/sql-injection |
SQL injection | error |
security/command-injection |
Command injection | error |
โก Performance (7)
| Rule ID | Description | Severity |
|---|---|---|
perf/console-log |
Remove console.log | suggestion |
perf/anonymous-function |
No anonymous functions | suggestion |
๐ Best Practice (10)
| Rule ID | Description | Severity |
|---|---|---|
best-practice/no-magic-numbers |
No magic numbers | suggestion |
best-practice/import-order |
Import order | suggestion |
๐ ๏ธ Development
# Clone
git clone https://github.com/Yulingsong/frontend-ai-review.git
cd frontend-ai-review
# Install
npm install
# Dev mode
npm run dev
# Build
npm run build
# Test
npm run test
๐ค Contributing
Issues and Pull Requests are welcome!
๐ License
MIT License
๐ Credits
- Babel - JavaScript compiler
- Picocolors - Terminal colors
- Glob - File matching
Related Packages
design-warden
CI check for design-system drift in frontend pull requests, built for UI written...
556
@langgraph-js/sdk
The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend int...
333,667
6
@ashwindojo/codeatlas-vite-plugin
Vite plugin for CodeAtlas โ real-time annotation parsing and live MCP HTTP serve...
1,356
Version History
| Version | Released | License |
|---|---|---|
| 2.3.1 | MIT | |
| 2.3.0 | MIT | |
| 2.2.0 | MIT | |
| 2.0.6 | MIT | |
| 2.0.5 | MIT | |
| 2.0.4 | MIT | |
| 2.0.3 | MIT | |
| 2.0.2 | MIT | |
| 2.0.1 | MIT | |
| 2.0.0 | MIT | |
| 1.5.0 | MIT | |
| 1.4.0 | MIT | |
| 1.3.0 | MIT | |
| 1.0.2 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT |