Skip to content

Commit 8067252

Browse files
authored
chore: run prettier (#32)
* chore: run prettier * chore: add mdx to list of recommneded extension * chore: setup format on save and use prettier for mdx * chore: handle html whitespace properly
1 parent 6801afa commit 8067252

27 files changed

+297
-227
lines changed

.devcontainer/devcontainer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
33
{
4-
"name": "Node.js",
5-
"image": "mcr.microsoft.com/devcontainers/javascript-node:16-bullseye"
4+
"name": "Node.js",
5+
"image": "mcr.microsoft.com/devcontainers/javascript-node:16-bullseye"
66

7-
// Features to add to the dev container. More info: https://containers.dev/features.
8-
// "features": {},
7+
// Features to add to the dev container. More info: https://containers.dev/features.
8+
// "features": {},
99

10-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
11-
// "forwardPorts": [],
10+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
11+
// "forwardPorts": [],
1212

13-
// Use 'postCreateCommand' to run commands after the container is created.
14-
// "postCreateCommand": "yarn install",
13+
// Use 'postCreateCommand' to run commands after the container is created.
14+
// "postCreateCommand": "yarn install",
1515

16-
// Configure tool-specific properties.
17-
// "customizations": {},
16+
// Configure tool-specific properties.
17+
// "customizations": {},
1818

19-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
20-
// "remoteUser": "root"
19+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
20+
// "remoteUser": "root"
2121
}

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.prettierrc.cjs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
module.exports = {
2-
plugins: [require.resolve('prettier-plugin-astro')],
3-
overrides: [
4-
{
5-
files: '*.astro',
6-
options: {
7-
parser: 'astro',
8-
},
2+
plugins: [require.resolve("prettier-plugin-astro")],
3+
overrides: [
4+
{
5+
files: "*.astro",
6+
options: {
7+
parser: "astro",
8+
// ensure HTML tag breaks properly
9+
htmlWhitespaceSensitivity: "ignore",
910
},
10-
],
11-
};
11+
},
12+
],
13+
};

.vscode/extensions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2-
"recommendations": ["astro-build.astro-vscode", "esbenp.prettier-vscode"],
2+
"recommendations": [
3+
"astro-build.astro-vscode",
4+
"esbenp.prettier-vscode",
5+
"unifiedjs.vscode-mdx"
6+
],
37
"unwantedRecommendations": []
48
}

.vscode/settings.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
"deno.importMap": ".netlify/edge-functions-import-map.json",
66
"deno.path": "/home/codespace/.config/netlify/deno-cli/deno",
77
"prettier.documentSelectors": ["**/*.astro"],
8-
"[astro]": {
8+
"[astro]": {
99
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
},
11+
"[mdx]": {
12+
"editor.defaultFormatter": "esbenp.prettier-vscode"
13+
},
14+
"editor.formatOnSave": true,
15+
"editor.formatOnSaveMode": "file",
16+
"editor.codeActionsOnSave": {
17+
"source.organizeImports": true
1018
}
1119
}

CODE_OF_CONDUCT.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3535
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Angular Snippets
2+
23
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
4+
35
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
6+
47
<!-- ALL-CONTRIBUTORS-BADGE:END -->
58

69
A website to find and share code snippets for Angular.

src/components/BlogCard.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ url = url + "/";
1919
<li
2020
class="flex flex-col leading-relaxed rounded-2xl border border-zinc-900/10 dark:border-zinc-700/40 hover:dark:bg-zinc-800/20 hover:bg-zinc-200/20 dark:text-zinc-400"
2121
>
22-
<a
23-
class="flex flex-col gap-2 sm:gap-4 pt-5 px-5 pb-8"
24-
href={url}
25-
>
22+
<a class="flex flex-col gap-2 sm:gap-4 pt-5 px-5 pb-8" href={url}>
2623
<time class="shrink-0 text-base sm:hidden">{shortDate}</time>
2724
<span class="flex items-center justify-between mb-1">
2825
<h2 class="text-xl font-medium text-black dark:text-white">{title}</h2>

src/components/BlogImage.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ const { src, alt, loading = "lazy" } = Astro.props;
1515
loading={loading}
1616
alt={alt}
1717
class="rounded-xl overflow-hidden"
18-
/>
18+
/>

src/components/Footer.astro

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
<footer class="mx-auto text-sm px-8 pt-8 pb-12 text-gray-500 dark:text-gray-400 max-w-7xl text-right">
2-
An open source project created by Santhosh Yadav.
3-
</footer>
1+
<footer
2+
class="mx-auto text-sm px-8 pt-8 pb-12 text-gray-500 dark:text-gray-400 max-w-7xl text-right"
3+
>
4+
An open source project created by Santhosh Yadav.
5+
</footer>

src/components/Header.astro

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,95 @@ const navItems = [
1111
href: "/rss.xml",
1212
},
1313
];
14-
1514
---
1615

1716
<header class="dark:bg-zinc-900 bg-white max-w-7xl m-auto">
18-
<a href="/" class="text-lg sm:text-xl text-black dark:text-zinc-300 hover:dark:text-white transition-colors absolute m-8">Angular Snippets</a>
17+
<a
18+
href="/"
19+
class="text-lg sm:text-xl text-black dark:text-zinc-300 hover:dark:text-white transition-colors absolute m-8"
20+
>
21+
Angular Snippets
22+
</a>
1923
<nav class="p-8 hidden sm:flex justify-end">
2024
<ul class="flex justify-end items-center m-0 space-x-2">
2125
{
2226
navItems.map((item) => (
2327
<li>
24-
<a href ={item.href} class="hover:bg-zinc-300/60 dark:hover:bg-zinc-700/30 dark:text-zinc-300 text-black px-2 py-1 transition-colors rounded-lg">
28+
<a
29+
href={item.href}
30+
class="hover:bg-zinc-300/60 dark:hover:bg-zinc-700/30 dark:text-zinc-300 text-black px-2 py-1 transition-colors rounded-lg"
31+
>
2532
{item.name}
2633
</a>
2734
</li>
2835
))
2936
}
3037
</ul>
31-
<a aria-label="github" class="dark:opacity-80 dark:hover:opacity-100 hover:opacity-90 pointer mx-6" href="https://github.com/santoshyadavdev/angular-snipptes" target="_blank">
38+
<a
39+
aria-label="github"
40+
class="dark:opacity-80 dark:hover:opacity-100 hover:opacity-90 pointer mx-6"
41+
href="https://github.com/santoshyadavdev/angular-snipptes"
42+
target="_blank"
43+
>
3244
<Icon name="simple-icons:github" class="w-5 dark:text-white text-black" />
3345
</a>
34-
<button aria-label="theme toggle" class="dark:opacity-80 dark:hover:opacity-100 hover:opacity-90 pointer theme-toggle">
35-
<Icon name="eva:moon-outline" class="w-5 dark:text-white text-black transition-colors dark:hidden" />
36-
<Icon name="akar-icons:sun" class="w-5 dark:text-white text-black transition-colors hidden dark:block" />
46+
<button
47+
aria-label="theme toggle"
48+
class="dark:opacity-80 dark:hover:opacity-100 hover:opacity-90 pointer theme-toggle"
49+
>
50+
<Icon
51+
name="eva:moon-outline"
52+
class="w-5 dark:text-white text-black transition-colors dark:hidden"
53+
/>
54+
<Icon
55+
name="akar-icons:sun"
56+
class="w-5 dark:text-white text-black transition-colors hidden dark:block"
57+
/>
3758
</button>
3859
</nav>
3960
<nav class="p-2 flex sm:hidden justify-end">
40-
<a aria-label="github" class="pointer mx-3 py-6" href="https://github.com/santoshyadavdev/angular-snipptes" target="_blank">
61+
<a
62+
aria-label="github"
63+
class="pointer mx-3 py-6"
64+
href="https://github.com/santoshyadavdev/angular-snipptes"
65+
target="_blank"
66+
>
4167
<Icon name="simple-icons:github" class="w-6 dark:text-white text-black" />
4268
</a>
4369
<button aria-label="theme toggle" class="pointer theme-toggle">
44-
<Icon name="eva:moon-outline" class="w-6 dark:text-white text-black transition-colors dark:hidden" />
45-
<Icon name="akar-icons:sun" class="w-6 dark:text-white text-black transition-colors hidden dark:block" />
70+
<Icon
71+
name="eva:moon-outline"
72+
class="w-6 dark:text-white text-black transition-colors dark:hidden"
73+
/>
74+
<Icon
75+
name="akar-icons:sun"
76+
class="w-6 dark:text-white text-black transition-colors hidden dark:block"
77+
/>
4678
</button>
47-
<button class="flex sm:hidden justify-end nav-toggle ml-3 mr-6 py-6" aria-label="menu button">
79+
<button
80+
class="flex sm:hidden justify-end nav-toggle ml-3 mr-6 py-6"
81+
aria-label="menu button"
82+
>
4883
<Icon name="ri:menu-4-line" class="w-6 h-6" />
4984
</button>
5085
</nav>
51-
5286
</header>
5387

54-
<header class="absolute border-b border-gray-900/10 dark:border-gray-700/40 t-0 inset-x-0 nav-menu hidden bg-white dark:bg-zinc-900">
88+
<header
89+
class="absolute border-b border-gray-900/10 dark:border-gray-700/40 t-0 inset-x-0 nav-menu hidden bg-white dark:bg-zinc-900"
90+
>
5591
{
5692
(
57-
<nav class="w-full p-8 pt-0 flex flex-col inline-flex space-y-1 ">
58-
{navItems.map((navbar) => (
59-
<a href={navbar.href} class="w-full hover:bg-zinc-300 dark:hover:bg-zinc-700 dark:text-zinc-300 text-black p-2 transition-colors rounded-lg">
60-
{navbar.name}
61-
</a>
62-
))}
63-
</nav>
93+
<nav class="w-full p-8 pt-0 flex flex-col inline-flex space-y-1 ">
94+
{navItems.map((navbar) => (
95+
<a
96+
href={navbar.href}
97+
class="w-full hover:bg-zinc-300 dark:hover:bg-zinc-700 dark:text-zinc-300 text-black p-2 transition-colors rounded-lg"
98+
>
99+
{navbar.name}
100+
</a>
101+
))}
102+
</nav>
64103
)
65104
}
66-
67105
</header>

src/layouts/BlogLayout.astro

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ const canonicalURL = new URL(Astro.url).href;
8282
>
8383
<Header />
8484
<main class="mx-auto !max-w-screen-lg m-auto p-6 max-w-7xl">
85-
<section
86-
class="dark:text-slate-200 dark:bg-inherit px-3"
87-
>
85+
<section class="dark:text-slate-200 dark:bg-inherit px-3">
8886
<header class="mb-5">
8987
<h1 class="font-bold text-4xl mb-4 dark:text-white">
9088
{frontmatter.title}
@@ -103,13 +101,13 @@ const canonicalURL = new URL(Astro.url).href;
103101
<TagsLine tags={frontmatter.tags} />
104102
</div>
105103
</header>
106-
<article class="mx-auto !max-w-screen-lg prose prose-zinc sm:prose-lg prose-img:mx-auto prose-a:dark:text-blue-400 prose-a:no-underline prose-pre:scrollbar-thin prose-pre:scrollbar-thumb-zinc-400 prose-pre:scrollbar-track-zinc-300 prose-pre:dark:scrollbar-thumb-zinc-500 prose-pre:dark:scrollbar-track-zinc-700 dark:bg-zinc-900 hover:prose-a:underline prose-a:text-blue-700 dark:prose-invert prose-a:underline-offset-2">
104+
<article
105+
class="mx-auto !max-w-screen-lg prose prose-zinc sm:prose-lg prose-img:mx-auto prose-a:dark:text-blue-400 prose-a:no-underline prose-pre:scrollbar-thin prose-pre:scrollbar-thumb-zinc-400 prose-pre:scrollbar-track-zinc-300 prose-pre:dark:scrollbar-thumb-zinc-500 prose-pre:dark:scrollbar-track-zinc-700 dark:bg-zinc-900 hover:prose-a:underline prose-a:text-blue-700 dark:prose-invert prose-a:underline-offset-2"
106+
>
107107
<slot />
108108
</article>
109109
<section class="flex flex-row justify-between my-16">
110-
<a href="/snippets" class="hover:underline"
111-
>Back to snippets</a
112-
>
110+
<a href="/snippets" class="hover:underline">Back to snippets</a>
113111
</section>
114112
<Footer />
115113
</section>

src/layouts/Layout.astro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@ const canonicalURL = new URL(Astro.url).href;
4242
<script is:inline>
4343
// credits to satnaing on github
4444
const primaryColorScheme = "none";
45-
const darkModeMediaQuery = window.matchMedia("(prefers-color-scheme: dark)").matches;
45+
const darkModeMediaQuery = window.matchMedia(
46+
"(prefers-color-scheme: dark)"
47+
).matches;
4648
const currentTheme = localStorage.getItem("theme");
4749
let theme;
4850
if (currentTheme) {
4951
theme = currentTheme === "dark" ? "dark" : "";
5052
} else {
51-
if (primaryColorScheme === "dark" || (primaryColorScheme === "none" && darkModeMediaQuery)) {
53+
if (
54+
primaryColorScheme === "dark" ||
55+
(primaryColorScheme === "none" && darkModeMediaQuery)
56+
) {
5257
theme = "dark";
5358
} else if (primaryColorScheme === "light") {
5459
theme = "";
@@ -59,7 +64,6 @@ const canonicalURL = new URL(Astro.url).href;
5964
document.documentElement.className = theme;
6065
</script>
6166
<script src="@scripts/main.js"></script>
62-
6367
</head>
6468
<body
6569
class="font-inter dark:bg-zinc-900 dark:text-white selection:bg-sky-600/60 scrollbar-thin scrollbar-thumb-zinc-400 scrollbar-track-zinc-300 dark:scrollbar-thumb-zinc-600 dark:scrollbar-track-zinc-800"

src/pages/404.astro

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import { Icon } from "astro-icon";
88
<Icon name="simple-icons:astro" class="w-32 h-32 mb-10" />
99
<h1 class="text-6xl mb-5 font-semibold">404 Error</h1>
1010
<h2 class="text-xl mb-5">Are you lost or looking for some easter eggs?</h2>
11-
<a href="/" class="p-3 rounded-xl dark:bg-zinc-800 bg-zinc-300 text-black dark:text-zinc-300 m-2 ring-2 ring-opacity-0 ring-zinc-500 hover:ring-opacity-100 transition-all motion-reduce:transition-none">Go back to home</a>
11+
<a
12+
href="/"
13+
class="p-3 rounded-xl dark:bg-zinc-800 bg-zinc-300 text-black dark:text-zinc-300 m-2 ring-2 ring-opacity-0 ring-zinc-500 hover:ring-opacity-100 transition-all motion-reduce:transition-none"
14+
>
15+
Go back to home
16+
</a>
1217
</section>
13-
</Layout>
18+
</Layout>

src/pages/index.astro

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ blogs = blogs.sort(
1818
---
1919

2020
<Layout {...metadata}>
21-
<section class="flex flex-col sm:flex-row justify-between items-center sm:py-14">
21+
<section
22+
class="flex flex-col sm:flex-row justify-between items-center sm:py-14"
23+
>
2224
<div class="flex items-center justify-center sm:w-1/2 m-5 md:m-10 my-10">
2325
<Icon class="h-12 lg:h-20" name="simple-icons:angular" />
2426
</div>
@@ -64,8 +66,10 @@ blogs = blogs.sort(
6466
<div class="text-center dark:text-zinc-300 text-zinc-200 mt-5">
6567
<a
6668
class="text-base flex items-center dark:bg-zinc-800 bg-zinc-200/30 dark:ring-zinc-700 hover:ring-2 ring-zinc-300 transition-all dark:text-white flex-col m-2 p-2 rounded-xl text-black"
67-
href="/snippets">Show more snippets</a
69+
href="/snippets"
6870
>
71+
Show more snippets
72+
</a>
6973
</div>
7074
</section>
7175
</Layout>

0 commit comments

Comments
 (0)