Skip to content

Commit

Permalink
Merge pull request #34 from jonassiewertsen/add-linting
Browse files Browse the repository at this point in the history
Add linting
  • Loading branch information
jonassiewertsen authored Sep 10, 2023
2 parents 02ec8c5 + 98617b5 commit 0418166
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: "Laravel Pint"
uses: aglipanci/[email protected]
with:
preset: laravel
pintVersion: 1.13.1

- name: Commit changes to GitHub
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[auto commit] Linting"
10 changes: 5 additions & 5 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
|
| So called synthesizers allow to add custom types to Livewire, which can
| can be used to make Livewire aware of Statamic classes that you want
| to work with, as it might make things easier.
| to work with, as it might make things easier.
|
| It's recommended to remove or uncomment those synthesizers that are
| not used in your application, to avoid overhead by loading those.
| not used in your application, to avoid overhead by loading those.
|
| This features is experimental. It's ment to be tested and to played
| with. As long as it is experimental, it can be changed and removed
Expand All @@ -27,6 +27,6 @@
'classes' => [
\Jonassiewertsen\Livewire\Synthesizers\EntryCollectionSynthesizer::class,
\Jonassiewertsen\Livewire\Synthesizers\EntrySynthesizer::class,
]
]
];
],
],
];
4 changes: 2 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public function boot(): void
{
parent::boot();

$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'statamic-livewire');
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'statamic-livewire');

if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__ . '/../config/config.php' => config_path('statamic-livewire.php'),
__DIR__.'/../config/config.php' => config_path('statamic-livewire.php'),
], 'statamic-livewire');
}

Expand Down
10 changes: 5 additions & 5 deletions src/Synthesizers/EntryCollectionSynthesizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
class EntryCollectionSynthesizer extends Synth
{
public static $key = 'entry-collection';

public static function match($target)
{
return $target instanceof StatamicEntryCollection;
}

public function dehydrate($target)
{
$data = [];
Expand All @@ -29,9 +29,9 @@ public function dehydrate($target)
];
}

return [ $data, [] ];
return [$data, []];
}

public function hydrate($values)
{
$items = [];
Expand All @@ -49,6 +49,6 @@ public function hydrate($values)
$items[] = $entry;
}

return New StatamicEntryCollection($items);
return new StatamicEntryCollection($items);
}
}
10 changes: 5 additions & 5 deletions src/Synthesizers/EntrySynthesizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
class EntrySynthesizer extends Synth
{
public static $key = 'entry-collection';

public static function match($target)
{
return $target instanceof StatamicEntry;
}

public function dehydrate($entry)
{
return [
return [
[
'collection' => $entry->collection()->handle() ?? null,
'data' => $entry->data()->all(),
'date' => $entry->collection()->dated() ? $entry->date() : null,
'id' => $entry->id(),
'slug' => $entry->slug() ?? null,
], [] ];
], []];
}

public function hydrate($value)
{
$entry = Entry::make()
Expand Down
2 changes: 1 addition & 1 deletion src/Tags/Livewire.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function this(): string
{
$instanceId = $this->context['__livewire']->getId();

if (!count($this->params)) {
if (! count($this->params)) {
return "window.Livewire.find('{$instanceId}')";
}

Expand Down

0 comments on commit 0418166

Please sign in to comment.