Skip to content

Commit 67c9d5a

Browse files
committed
Add linting & ide helper
fix misc lint errors
1 parent 3b36b4b commit 67c9d5a

32 files changed

+6682
-229
lines changed

.github/copilot-instructions.md

Lines changed: 40 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ This application is a Laravel application and its main Laravel ecosystems packag
1313
- laravel/framework (LARAVEL) - v12
1414
- laravel/prompts (PROMPTS) - v0
1515
- livewire/livewire (LIVEWIRE) - v3
16-
- livewire/volt (VOLT) - v1
17-
- laravel/breeze (BREEZE) - v2
1816
- laravel/mcp (MCP) - v0
1917
- laravel/pint (PINT) - v1
2018
- laravel/sail (SAIL) - v1
2119
- phpunit/phpunit (PHPUNIT) - v11
22-
- tailwindcss (TAILWINDCSS) - v3
20+
- tailwindcss (TAILWINDCSS) - v4
2321

2422
## Conventions
2523
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
@@ -84,6 +82,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
8482

8583
## PHP
8684

85+
- Always use strict typing at the head of a `.php` file: `declare(strict_types=1);`.
8786
- Always use curly braces for control structures, even if it has one line.
8887

8988
### Constructors
@@ -271,139 +270,6 @@ document.addEventListener('livewire:init', function () {
271270
</code-snippet>
272271
273272
274-
=== volt/core rules ===
275-
276-
## Livewire Volt
277-
278-
- This project uses Livewire Volt for interactivity within its pages. New pages requiring interactivity must also use Livewire Volt. There is documentation available for it.
279-
- Make new Volt components using `php artisan make:volt [name] [--test] [--pest]`
280-
- Volt is a **class-based** and **functional** API for Livewire that supports single-file components, allowing a component's PHP logic and Blade templates to co-exist in the same file
281-
- Livewire Volt allows PHP logic and Blade templates in one file. Components use the `@volt` directive.
282-
- You must check existing Volt components to determine if they're functional or class based. If you can't detect that, ask the user which they prefer before writing a Volt component.
283-
284-
### Volt Functional Component Example
285-
286-
<code-snippet name="Volt Functional Component Example" lang="php">
287-
@volt
288-
<?php
289-
use function Livewire\Volt\{state, computed};
290-
291-
state(['count' => 0]);
292-
293-
$increment = fn () => $this->count++;
294-
$decrement = fn () => $this->count--;
295-
296-
$double = computed(fn () => $this->count * 2);
297-
?>
298-
299-
<div>
300-
<h1>Count: {{ $count }}</h1>
301-
<h2>Double: {{ $this->double }}</h2>
302-
<button wire:click="increment">+</button>
303-
<button wire:click="decrement">-</button>
304-
</div>
305-
@endvolt
306-
</code-snippet>
307-
308-
309-
### Volt Class Based Component Example
310-
To get started, define an anonymous class that extends Livewire\Volt\Component. Within the class, you may utilize all of the features of Livewire using traditional Livewire syntax:
311-
312-
313-
<code-snippet name="Volt Class-based Volt Component Example" lang="php">
314-
use Livewire\Volt\Component;
315-
316-
new class extends Component {
317-
public $count = 0;
318-
319-
public function increment()
320-
{
321-
$this->count++;
322-
}
323-
} ?>
324-
325-
<div>
326-
<h1>{{ $count }}</h1>
327-
<button wire:click="increment">+</button>
328-
</div>
329-
</code-snippet>
330-
331-
332-
### Testing Volt & Volt Components
333-
- Use the existing directory for tests if it already exists. Otherwise, fallback to `tests/Feature/Volt`.
334-
335-
<code-snippet name="Livewire Test Example" lang="php">
336-
use Livewire\Volt\Volt;
337-
338-
test('counter increments', function () {
339-
Volt::test('counter')
340-
->assertSee('Count: 0')
341-
->call('increment')
342-
->assertSee('Count: 1');
343-
});
344-
</code-snippet>
345-
346-
347-
<code-snippet name="Volt Component Test Using Pest" lang="php">
348-
declare(strict_types=1);
349-
350-
use App\Models\{User, Product};
351-
use Livewire\Volt\Volt;
352-
353-
test('product form creates product', function () {
354-
$user = User::factory()->create();
355-
356-
Volt::test('pages.products.create')
357-
->actingAs($user)
358-
->set('form.name', 'Test Product')
359-
->set('form.description', 'Test Description')
360-
->set('form.price', 99.99)
361-
->call('create')
362-
->assertHasNoErrors();
363-
364-
expect(Product::where('name', 'Test Product')->exists())->toBeTrue();
365-
});
366-
</code-snippet>
367-
368-
369-
### Common Patterns
370-
371-
372-
<code-snippet name="CRUD With Volt" lang="php">
373-
<?php
374-
375-
use App\Models\Product;
376-
use function Livewire\Volt\{state, computed};
377-
378-
state(['editing' => null, 'search' => '']);
379-
380-
$products = computed(fn() => Product::when($this->search,
381-
fn($q) => $q->where('name', 'like', "%{$this->search}%")
382-
)->get());
383-
384-
$edit = fn(Product $product) => $this->editing = $product->id;
385-
$delete = fn(Product $product) => $product->delete();
386-
387-
?>
388-
389-
<!-- HTML / UI Here -->
390-
</code-snippet>
391-
392-
<code-snippet name="Real-Time Search With Volt" lang="php">
393-
<flux:input
394-
wire:model.live.debounce.300ms="search"
395-
placeholder="Search..."
396-
/>
397-
</code-snippet>
398-
399-
<code-snippet name="Loading States With Volt" lang="php">
400-
<flux:button wire:click="save" wire:loading.attr="disabled">
401-
<span wire:loading.remove>Save</span>
402-
<span wire:loading>Saving...</span>
403-
</flux:button>
404-
</code-snippet>
405-
406-
407273
=== pint/core rules ===
408274
409275
## Laravel Pint Code Formatter
@@ -455,11 +321,46 @@ $delete = fn(Product $product) => $product->delete();
455321
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
456322
457323
458-
=== tailwindcss/v3 rules ===
324+
=== tailwindcss/v4 rules ===
325+
326+
## Tailwind 4
327+
328+
- Always use Tailwind CSS v4 - do not use the deprecated utilities.
329+
- `corePlugins` is not supported in Tailwind v4.
330+
- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.
331+
<code-snippet name="Extending Theme in CSS" lang="css">
332+
@theme {
333+
--color-brand: oklch(0.72 0.11 178);
334+
}
335+
</code-snippet>
336+
337+
- In Tailwind v4, you import Tailwind using a regular CSS `@import` statement, not using the `@tailwind` directives used in v3:
338+
339+
<code-snippet name="Tailwind v4 Import Tailwind Diff" lang="diff">
340+
- @tailwind base;
341+
- @tailwind components;
342+
- @tailwind utilities;
343+
+ @import "tailwindcss";
344+
</code-snippet>
459345
460-
## Tailwind 3
461346
462-
- Always use Tailwind CSS v3 - verify you're using only classes supported by this version.
347+
### Replaced Utilities
348+
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option - use the replacement.
349+
- Opacity values are still numeric.
350+
351+
| Deprecated | Replacement |
352+
|------------+--------------|
353+
| bg-opacity-* | bg-black/* |
354+
| text-opacity-* | text-black/* |
355+
| border-opacity-* | border-black/* |
356+
| divide-opacity-* | divide-black/* |
357+
| ring-opacity-* | ring-black/* |
358+
| placeholder-opacity-* | placeholder-black/* |
359+
| flex-shrink-* | shrink-* |
360+
| flex-grow-* | grow-* |
361+
| overflow-ellipsis | text-ellipsis |
362+
| decoration-slice | box-decoration-slice |
363+
| decoration-clone | box-decoration-clone |
463364
464365
465366
=== filament/filament rules ===

0 commit comments

Comments
 (0)