Skip to content

Commit b769103

Browse files
committed
switch to biome for Astro formatting
1 parent b3f7bca commit b769103

File tree

41 files changed

+241
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+241
-209
lines changed

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode", "biomejs.biome"]
3+
}

.vscode/settings.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"[astro]": {
4+
"editor.defaultFormatter": "biomejs.biome"
5+
},
6+
"editor.formatOnSave": true,
7+
"editor.formatOnPaste": true,
8+
"editor.codeActionsOnSave": {
9+
"source.action.useSortedAttributes.biome": "explicit",
10+
"source.action.useSortedProperties.biome": "explicit",
11+
"source.fixAll.biome": "explicit",
12+
"source.organizeImports.biome": "explicit"
13+
},
14+
15+
"prettier.enable": false,
16+
"eslint.enable": false
17+
}

biome.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"next": "none"
66
}
77
},
8+
"html": {
9+
"experimentalFullSupportEnabled": true,
10+
"formatter": {
11+
"indentScriptAndStyle": true
12+
}
13+
},
814
"overrides": [
915
{
1016
"includes": ["**/*.test.ts", "**/*.test.tsx"],

src/components/footer/Footer.astro

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,46 @@ const { name, github } = metadata.author
1010
---
1111

1212
<footer role="contentinfo" class={styles.footer} id="footer">
13-
<Vcard />
13+
<Vcard/>
1414
<section class={styles.copyright}>
1515
<p>
1616
&copy; 2005&ndash;<span id="currentYear">{year}</span>
1717
{name}
1818
<a href={`${github}/blog`}>
19-
<GithubIcon />View source
19+
<GithubIcon/>
20+
View source
2021
</a>
2122
<a href="/tipjar/">
22-
<TipJarIcon />Tip Jar
23+
<TipJarIcon/>
24+
Tip Jar
2325
</a>
2426
</p>
2527
</section>
2628
</footer>
2729

2830
<script is:inline>
29-
(function () {
30-
const el = document.getElementById("currentYear");
31-
if (!el) return;
31+
;(() => {
32+
const el = document.getElementById('currentYear')
33+
if (!el) return
3234

33-
const actualYear = new Date().getFullYear();
34-
if (Number(el.textContent) === actualYear) return;
35+
const actualYear = new Date().getFullYear()
36+
if (Number(el.textContent) === actualYear) return
3537

3638
const update = () => {
37-
el.textContent = String(actualYear);
38-
};
39+
el.textContent = String(actualYear)
40+
}
3941

40-
if (!("IntersectionObserver" in window)) {
41-
setTimeout(update, 0);
42-
return;
42+
if (!('IntersectionObserver' in window)) {
43+
setTimeout(update, 0)
44+
return
4345
}
4446

4547
const observer = new IntersectionObserver(([entry], obs) => {
46-
if (!entry || !entry.isIntersecting) return;
47-
update();
48-
obs.disconnect();
49-
});
48+
if (!entry || !entry.isIntersecting) return
49+
update()
50+
obs.disconnect()
51+
})
5052

51-
observer.observe(el);
52-
})();
53+
observer.observe(el)
54+
})()
5355
</script>

src/components/footer/Vcard.astro

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ const links = [mastodon, github, rss, jsonfeed]
2121
/>
2222

2323
<p class={styles.description}>
24-
{metadata.siteDescription.replace(name, "")}<br />
25-
<a class="fn" rel="author me" href={url}>
26-
{name}
27-
</a>
24+
{metadata.siteDescription.replace(name, "")}
25+
<br>
26+
<a class="fn" rel="author me" href={url}> {name}</a>
2827
</p>
2928
</div>
3029

31-
<Location client:visible />
30+
<Location client:visible/>
3231

33-
<Networks links={links} />
32+
<Networks links={links}/>

src/components/header/Header.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import ThemeSwitch from './ThemeSwitch/index.astro'
99
<header class={styles.header} aria-label="Header" id="header">
1010
<div class={styles.headerContent}>
1111
<a href="/" class={styles.title}>
12-
<Logo class={styles.logo} /> kremalicious
12+
<Logo class={styles.logo}/>
13+
kremalicious
1314
</a>
1415

1516
<nav aria-label="Menu" class={styles.nav}>
16-
<ThemeSwitch />
17-
<SearchTrigger />
18-
<Menu />
17+
<ThemeSwitch/>
18+
<SearchTrigger/>
19+
<Menu/>
1920
</nav>
2021
</div>
2122
</header>

src/components/header/Menu.astro

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Hamburger from './Hamburger.astro'
44
import styles from './Menu.module.css'
55
---
66

7-
<Hamburger id="menu-button" />
7+
<Hamburger id="menu-button"/>
88

99
<nav aria-label="Pages" class={styles.menu} aria-hidden>
1010
<ul>
@@ -22,19 +22,19 @@ import styles from './Menu.module.css'
2222
</nav>
2323

2424
<script>
25-
let menuOpen = false;
26-
const hamburger = document.querySelector("#menu-button");
27-
const menu = document.querySelector('[aria-label="Pages"]');
25+
let menuOpen = false
26+
const hamburger = document.querySelector('#menu-button')
27+
const menu = document.querySelector('[aria-label="Pages"]')
2828

29-
hamburger?.addEventListener("click", () => {
30-
menuOpen = !menuOpen;
29+
hamburger?.addEventListener('click', () => {
30+
menuOpen = !menuOpen
3131

3232
if (menuOpen) {
33-
document.body.classList.add("has-menu-open");
34-
menu?.removeAttribute("aria-hidden");
33+
document.body.classList.add('has-menu-open')
34+
menu?.removeAttribute('aria-hidden')
3535
} else {
36-
document.body.classList.remove("has-menu-open");
37-
menu?.setAttribute("aria-hidden", "true");
36+
document.body.classList.remove('has-menu-open')
37+
menu?.setAttribute('aria-hidden', 'true')
3838
}
39-
});
39+
})
4040
</script>

src/components/header/ThemeSwitch/index.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import styles from './index.module.css'
1111
name="toggle"
1212
id="toggle"
1313
aria-describedby="theme-toggle"
14-
/>
14+
>
1515
<div aria-live="assertive">
16-
<SunIcon id="sun" />
17-
<MoonIcon id="moon" style="display: none;" />
16+
<SunIcon id="sun"/>
17+
<MoonIcon id="moon" style="display: none;"/>
1818
</div>
1919
</label>
2020
</div>

src/components/infinite-scroll/InfiniteScroll.astro

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ const showInfiniteScroll = lastPage > 1
3838
}
3939

4040
<script>
41-
import { loadNextPage, handleIntersection } from "./script";
41+
import { handleIntersection, loadNextPage } from './script'
4242

43-
const sentinel = document.getElementById("infinite-scroll-sentinel");
43+
const sentinel = document.getElementById('infinite-scroll-sentinel')
4444
const button = document.getElementById(
45-
"load-more-button",
46-
) as HTMLButtonElement;
45+
'load-more-button'
46+
) as HTMLButtonElement
4747

4848
if (sentinel && button) {
4949
const observer = new IntersectionObserver(
5050
(entries) => handleIntersection(entries, sentinel, button, observer),
51-
{ rootMargin: "200px" },
52-
);
51+
{ rootMargin: '200px' }
52+
)
5353

54-
observer.observe(sentinel);
54+
observer.observe(sentinel)
5555

56-
button.addEventListener("click", () => {
57-
loadNextPage(sentinel, button, observer);
58-
});
56+
button.addEventListener('click', () => {
57+
loadNextPage(sentinel, button, observer)
58+
})
5959
}
6060
</script>

src/components/layouts/Archive.astro

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import {
66
PhotoTeaser,
77
PostTeaser
88
} from '@/features/posts/components'
9-
import type { BlogPost } from '@/features/posts/types'
9+
import type {
10+
ArticlePost,
11+
BlogPost,
12+
LinkPost,
13+
PhotoPost
14+
} from '@/features/posts/types'
1015
import LayoutBase from './Base/index.astro'
1116
1217
type Props = {
@@ -26,11 +31,11 @@ const isPhotos = title && title !== '' && title.toLowerCase().includes('photos')
2631
{
2732
page?.data?.map((post) =>
2833
post.collection === "photos" ? (
29-
<PhotoTeaser post={post} />
34+
<PhotoTeaser post={post as PhotoPost} />
3035
) : post.collection === "links" ? (
31-
<LinkTeaser post={post} />
36+
<LinkTeaser post={post as LinkPost} />
3237
) : (
33-
<PostTeaser post={post} />
38+
<PostTeaser post={post as ArticlePost} />
3439
)
3540
)
3641
}
@@ -46,7 +51,7 @@ const isPhotos = title && title !== '' && title.toLowerCase().includes('photos')
4651
)
4752
}
4853

49-
<slot />
54+
<slot/>
5055
</LayoutBase>
5156

5257
<style>

0 commit comments

Comments
 (0)