Skip to content

Commit c1c20e9

Browse files
chore: Setup prettier php in workflow (#840)
* chore: Setup node in prettier workflow * Update prettier.yml * Include php plugin * style: Formatted code with Prettier --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 47769fa commit c1c20e9

File tree

14 files changed

+63
-37
lines changed

14 files changed

+63
-37
lines changed

.github/workflows/prettier.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ jobs:
2727
if: ${{ github.event_name != 'pull_request' }}
2828
uses: actions/checkout@v3
2929

30+
- name: Setup Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: '22'
34+
3035
- name: Install prettier and plugin-php
3136
run: npm i
3237

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor
2-
**/*.min.js
2+
**/*.min.js
3+
.prettierrc

.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierrc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
printWidth: 120,
3+
endOfLine: "auto",
4+
plugins: ["@prettier/plugin-php"],
5+
overrides: [
6+
{
7+
files: "*.php",
8+
options: {
9+
parser: "php",
10+
},
11+
},
12+
],
13+
};

scripts/translation-progress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@ function updateReadme(string $path, string $start, string $end, string $content)
123123
__DIR__ . "/../README.md",
124124
"<!-- TRANSLATION_PROGRESS_START -->",
125125
"<!-- TRANSLATION_PROGRESS_END -->",
126-
$badges
126+
$badges,
127127
);
128128
exit($update === false ? 1 : 0);

src/card.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function formatDate(string $dateString, string|null $format, string $locale): st
2727
$locale,
2828
IntlDateFormatter::MEDIUM,
2929
IntlDateFormatter::NONE,
30-
pattern: $pattern
30+
pattern: $pattern,
3131
);
3232
$formatted = $dateFormatter->format($date);
3333
}
@@ -44,7 +44,7 @@ function formatDate(string $dateString, string|null $format, string $locale): st
4444
$locale,
4545
IntlDateFormatter::MEDIUM,
4646
IntlDateFormatter::NONE,
47-
pattern: $pattern
47+
pattern: $pattern,
4848
);
4949
$formatted = $dateFormatter->format($date);
5050
}
@@ -75,7 +75,7 @@ function translateDays(array $days, string $locale): array
7575
$locale,
7676
IntlDateFormatter::NONE,
7777
IntlDateFormatter::NONE,
78-
pattern: $pattern
78+
pattern: $pattern,
7979
);
8080
$translatedDays = [];
8181
foreach ($days as $day) {
@@ -250,7 +250,7 @@ function splitLines(string $text, int $maxChars, int $line1Offset): string
250250
return preg_replace(
251251
"/^(.*)\n(.*)/",
252252
"<tspan x='0' dy='{$line1Offset}'>$1</tspan><tspan x='0' dy='16'>$2</tspan>",
253-
$text
253+
$text,
254254
);
255255
}
256256

@@ -752,7 +752,7 @@ function ($matches) {
752752
$opacity = $result["opacity"];
753753
return "{$attribute}='{$color}' {$opacityAttribute}='{$opacity}'";
754754
},
755-
$svg
755+
$svg,
756756
);
757757

758758
return $svg;

src/demo/css/style.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ html {
4444

4545
body {
4646
background: var(--background);
47-
font-family: Segoe UI, Ubuntu, sans-serif;
47+
font-family:
48+
Segoe UI,
49+
Ubuntu,
50+
sans-serif;
4851
padding-top: 10px;
4952
color: var(--text);
5053
}
@@ -105,7 +108,9 @@ h2 {
105108
border-radius: 6px;
106109
cursor: pointer;
107110
font-family: inherit;
108-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
111+
box-shadow:
112+
0 1px 3px rgba(0, 0, 0, 0.12),
113+
0 1px 2px rgba(0, 0, 0, 0.24);
109114
transition: 0.2s ease-in-out;
110115
}
111116

@@ -115,7 +120,9 @@ h2 {
115120

116121
.btn:hover {
117122
background-color: var(--blue-dark);
118-
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
123+
box-shadow:
124+
0 3px 6px rgba(0, 0, 0, 0.16),
125+
0 3px 6px rgba(0, 0, 0, 0.23);
119126
}
120127

121128
.btn:disabled {

src/demo/css/toggle-dark.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ a.darkmode {
1111
justify-content: center;
1212
border-radius: 50%;
1313
border: 2px solid var(--border);
14-
box-shadow: 0 0 3px rgb(0 0 0 / 12%), 0 1px 2px rgb(0 0 0 / 24%);
14+
box-shadow:
15+
0 0 3px rgb(0 0 0 / 12%),
16+
0 1px 2px rgb(0 0 0 / 24%);
1517
transition: 0.2s ease-in box-shadow;
1618
}
1719

1820
a.darkmode:hover {
19-
box-shadow: 0 0 6px rgb(0 0 0 / 16%), 0 3px 6px rgb(0 0 0 / 23%);
21+
box-shadow:
22+
0 0 6px rgb(0 0 0 / 16%),
23+
0 3px 6px rgb(0 0 0 / 23%);
2024
}
2125

2226
@media only screen and (max-width: 600px) {

src/demo/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function camelToSkewer(string $str): string
2222
function ($matches) {
2323
return "-" . strtolower($matches[0]);
2424
},
25-
$str
25+
$str,
2626
);
2727
}
2828
?>

src/demo/js/accordion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Accordion {
5555
{
5656
duration: 400,
5757
easing: "ease-out",
58-
}
58+
},
5959
);
6060
// When the animation is complete, call onAnimationFinish()
6161
this.animation.onfinish = () => this.onAnimationFinish(false);
@@ -93,7 +93,7 @@ class Accordion {
9393
{
9494
duration: 400,
9595
easing: "ease-out",
96-
}
96+
},
9797
);
9898
// When the animation is complete, call onAnimationFinish()
9999
this.animation.onfinish = () => this.onAnimationFinish(true);

0 commit comments

Comments
 (0)