Skip to content

New action-in-bulk-action-group Rule#12

Merged
PovilasKorop merged 1 commit into
mainfrom
issue/11
Feb 17, 2026
Merged

New action-in-bulk-action-group Rule#12
PovilasKorop merged 1 commit into
mainfrom
issue/11

Conversation

@krekas
Copy link
Copy Markdown
Collaborator

@krekas krekas commented Feb 17, 2026

Adds a new best-practices rule that detects Action::make() used inside toolbarActions() / BulkActionGroup::make() and suggests replacing it with BulkAction::make(). The rule is auto-fixable and also adds the missing use Filament\Actions\BulkAction; import.

This is a common mistake in AI-generated Filament code — the code compiles and looks correct at first glance, but bulk actions require BulkAction::make() to receive the selected $records collection at runtime.

What it detects

  • Action::make() inside BulkActionGroup::make()
  • Action::make() directly inside toolbarActions()
  • Works with any method that accepts a Table type-hinted parameter (not just table() — e.g. configure(Table $table))

Before

use Filament\Tables\Actions\Action;
use Filament\Tables\Actions\BulkActionGroup;
use Filament\Tables\Table;

class PostResource extends Resource
{
    public function table(Table $table): Table
    {
        return $table
            ->toolbarActions([
                BulkActionGroup::make([
                    // Wrong:
                    Action::make('approve')
                        ->label('Approve Selected')
                        ->action(function (Collection $records) {
                            // ...
                        }),
                ]),
            ]);
    }
}

After

use Filament\Actions\BulkAction;
use Filament\Tables\Actions\BulkActionGroup;
use Filament\Tables\Table;

class PostResource extends Resource
{
    public function table(Table $table): Table
    {
        return $table
            ->toolbarActions([
                BulkActionGroup::make([
                    // Correct:
                    BulkAction::make('approve')
                        ->label('Approve Selected')
                        ->action(function (Collection $records) {
                            // ...
                        }),
                ]),
            ]);
    }
}

Resolves #11

@PovilasKorop PovilasKorop merged commit 652d743 into main Feb 17, 2026
@PovilasKorop PovilasKorop deleted the issue/11 branch February 17, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Rule: Detect Action::make() inside Bulk Actions

2 participants