Skip to content

Commit

Permalink
Use import aliases where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed May 14, 2024
1 parent 27c1bb5 commit 4a81ca4
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import HeaderLink from './HeaderLink.astro';
import { SITE_TITLE } from '../consts';
import { SITE_TITLE } from '@consts';
---

<header>
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/using-mdx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If you have existing content authored in MDX, this integration will hopefully ma
Here is how you import and use a UI component inside of MDX.
When you open this page in the browser, you should see the clickable button below.

import HeaderLink from '../../components/HeaderLink.astro';
import HeaderLink from '@components/HeaderLink.astro';

<HeaderLink href="#" onclick="alert('clicked!')">
Embedded component in MDX
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/Base.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import Footer from '../components/Footer.astro';
import Header from '../components/Header.astro';
import Footer from '@components/Footer.astro';
import Header from '@components/Header.astro';
interface Props {
title: string;
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { CollectionEntry } from 'astro:content';
import FormattedDate from '../components/FormattedDate.astro';
import FormattedDate from '@components/FormattedDate.astro';
import Base from './Base.astro';
type Props = CollectionEntry<'blog'>['data'];
Expand Down
4 changes: 2 additions & 2 deletions src/pages/404.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
import Base from '../layouts/Base.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '@consts';
import Base from '@layouts/Base.astro';
---

<Base title={SITE_TITLE} description={SITE_DESCRIPTION}> 404</Base>
2 changes: 1 addition & 1 deletion src/pages/about.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import Layout from '../layouts/BlogPost.astro';
import Layout from '@layouts/BlogPost.astro';
---

<Layout
Expand Down
2 changes: 1 addition & 1 deletion src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import { type CollectionEntry, getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro';
import BlogPost from '@layouts/BlogPost.astro';
export async function getStaticPaths() {
const posts = await getCollection('blog');
Expand Down
6 changes: 3 additions & 3 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { SITE_TITLE, SITE_DESCRIPTION } from '@consts';
import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
import Base from '../../layouts/Base.astro';
import FormattedDate from '@components/FormattedDate.astro';
import Base from '@layouts/Base.astro';
const posts = (await getCollection('blog')).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
import Base from '../layouts/Base.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '@consts';
import Base from '@layouts/Base.astro';
---

<Base title={SITE_TITLE} description={SITE_DESCRIPTION}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/rss.xml.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
import { SITE_TITLE, SITE_DESCRIPTION } from '@consts';

export async function GET(context) {
const posts = await getCollection('blog');
Expand Down
19 changes: 17 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@components/*": [
"src/components/*"
],
"@assets/*": [
"src/assets/*"
],
"@layouts/*": [
"src/layouts/*"
],
"@consts": [
"src/consts.ts"
]
},
"strictNullChecks": true
}
}
},
}

0 comments on commit 4a81ca4

Please sign in to comment.