53 lines
1.7 KiB
Markdown
53 lines
1.7 KiB
Markdown
|
|
# 🔧 Lint Guide
|
||
|
|
|
||
|
|
The `lint` command is an AI-powered linter that identifies issues in your code and optionally provides AI-suggested fixes. It's designed to work with multiple languages and provide actionable suggestions.
|
||
|
|
|
||
|
|
### Key Features
|
||
|
|
|
||
|
|
- **Multi-language Support**: Automatically detects and lints Go, Python, C/C++, JS/TS, Rust, and more.
|
||
|
|
- **AI-Suggested Fixes**: Not only finds issues but can also suggest how to fix them.
|
||
|
|
- **Interactive Preview**: See the proposed fixes in a diff format before applying them.
|
||
|
|
- **Clean Code**: Grok is instructed to provide minimal, idiomatic fixes that match your project's style.
|
||
|
|
|
||
|
|
### Usage
|
||
|
|
|
||
|
|
Automatically detect language, run linter, and apply AI-suggested fixes.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Just check for issues (no fixes)
|
||
|
|
grokkit lint main.go --dry-run
|
||
|
|
|
||
|
|
# Interactive fix (preview + confirmation)
|
||
|
|
grokkit lint app.py
|
||
|
|
|
||
|
|
# Auto-fix without confirmation
|
||
|
|
grokkit lint server.js --auto-fix
|
||
|
|
|
||
|
|
# Use specific model
|
||
|
|
grokkit lint script.rb -m grok-4
|
||
|
|
```
|
||
|
|
|
||
|
|
### Supported languages
|
||
|
|
|
||
|
|
- **Go** (golangci-lint, go vet)
|
||
|
|
- **Python** (pylint, flake8, ruff)
|
||
|
|
- **JavaScript/JSX** (eslint)
|
||
|
|
- **TypeScript/TSX** (eslint, tsc)
|
||
|
|
- **Rust** (clippy)
|
||
|
|
- **Ruby** (rubocop)
|
||
|
|
- **Java** (checkstyle)
|
||
|
|
- **C/C++** (clang-tidy)
|
||
|
|
- **Shell** (shellcheck)
|
||
|
|
|
||
|
|
### Safety features
|
||
|
|
|
||
|
|
- Shows preview of fixes
|
||
|
|
- Verifies fixes by re-running linter
|
||
|
|
- Requires confirmation (unless `--auto-fix`)
|
||
|
|
|
||
|
|
### Best Practices
|
||
|
|
|
||
|
|
- **Lint early and often**: Catching issues early is much easier than fixing them later.
|
||
|
|
- **Review fixes carefully**: AI-suggested fixes are usually excellent, but always review them to ensure they align with your project's specific requirements.
|
||
|
|
- **Combine with Review**: Use `lint` for basic issues and `grokkit review` for deeper logic analysis.
|