laraveldaily/filacheck
FilaCheck brings static analysis to Filament v4/v5 projects. Scan your Filament code to detect deprecated patterns and common issues, with optional auto-fix (beta), dirty-file scanning, detailed output, and configurable rules—ideal for CI or after AI-generated code.
Installation:
composer require laraveldaily/filacheck --dev
Add to composer.json under "require-dev" if not using global install.
First Run:
vendor/bin/filacheck
Scans app/Filament by default. Exit code 1 indicates issues found.
Quick CI Check:
Add to package.json scripts:
"scripts": {
"filacheck": "vendor/bin/filacheck"
}
Run with:
npm run filacheck
After generating Filament resources with an AI tool (e.g., GitHub Copilot), run:
vendor/bin/filacheck --dirty
This catches AI-generated deprecated patterns (e.g., reactive() → live()) before manual review.
Pre-Commit Hook:
Add to .git/hooks/pre-commit:
#!/bin/sh
vendor/bin/filacheck --dirty || exit 1
Ensures only clean Filament code is committed.
CI Pipeline: Use in GitHub Actions (as shown in README) or Laravel Forge deploy hooks:
- name: Run FilaCheck
run: vendor/bin/filacheck --detailed
if: github.event_name == 'pull_request'
Team Onboarding:
vendor/bin/filacheck --dry-run during code reviews to highlight common pitfalls.--detailed output to explain Filament best practices to junior devs.| Scenario | Command | Purpose |
|---|---|---|
| Scan entire Filament app | vendor/bin/filacheck |
Catch all deprecated patterns. |
| Focus on recent changes | vendor/bin/filacheck --dirty |
Avoid noise in large codebases. |
| Auto-fix safe issues | vendor/bin/filacheck --fix |
Apply fixes for reactive() → live(), form() → schema(), etc. |
| Preview fixes | vendor/bin/filacheck --dry-run |
Review changes before applying. |
| Custom directory scan | vendor/bin/filacheck Resources |
Target specific Filament modules (e.g., Resources, Pages). |
vendor/bin/filacheck as a "Before Commit" inspection tool.--dirty to scan only containerized file changes:
sail filacheck --dirty
config/filacheck.php to disable rules like:
'deprecated-reactive' => ['enabled' => false],
False Positives in Tests:
deprecated-test-methods rule may flag legacy test assertions. Exclude test directories:
vendor/bin/filacheck --exclude=tests/
config/filacheck.php:
'deprecated-test-methods' => ['enabled' => false],
Auto-Fix Limitations:
--backup with --fix to create .bak files:
vendor/bin/filacheck --fix --backup
deprecated-placeholder require manual refactoring.Path Resolution:
vendor/bin/filacheck app\\Filament\\Resources
Config Overrides:
config/filacheck.php) must be merged with defaults. Use:
php artisan vendor:publish --tag=filacheck-config --force
'deprecated-url-parameters' => ['enabled' => false],
--verbose to see scanned files:
vendor/bin/filacheck --verbose
vendor/bin/filacheck --rule=deprecated-reactive
vendor/bin/filacheck --dry-run --fix
Custom Rules: Extend the rule set by creating a service provider:
// app/Providers/FilaCheckServiceProvider.php
namespace App\Providers;
use Filacheck\Rules\Rule;
use Illuminate\Support\ServiceProvider;
class FilaCheckServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->extend('filacheck.rules', function ($rules) {
$rules[] = new class extends Rule {
public function getName(): string { return 'custom-rule'; }
public function analyze(string $file): array { /* ... */ }
});
return $rules;
});
}
}
Rule Configuration: Dynamically enable/disable rules based on Filament version:
// config/filacheck.php
'rules' => [
'deprecated-reactive' => [
'enabled' => version_compare(app()->version(), '5.0.0') === -1,
],
],
CI-Specific Behavior: Fail builds only on specific rules in CI:
- name: Run FilaCheck (fail on deprecations only)
run: |
vendor/bin/filacheck --rule=deprecated-* || true
vendor/bin/filacheck --rule=best-practice-* || exit 1
- run: vendor/bin/pint && vendor/bin/filacheck
vendor/ and node_modules/ by default in .gitignore-like behavior:
vendor/bin/filacheck --exclude=vendor/ --exclude=node_modules/
- name: Slack Notification
if: failure()
run: |
ISSUES=$(vendor/bin/filacheck --format=json)
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"FilaCheck found issues: $ISSUES\"}" $SLACK_WEBHOOK
How can I help you explore Laravel packages today?