Skip to content

Commit

Permalink
Merge branch 'main' into update-ts-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Nov 27, 2023
2 parents d8887a7 + e4ebafa commit 81b74e6
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 33 deletions.
12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"lint-staged": "^13.2.3",
"mdsvex": "^0.11.0",
"package-name-regex": "^3.0.0",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"prettier": "^3.1.0",
"prettier-plugin-svelte": "^3.1.2",
"rehype-slug": "^5.1.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.5",
Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @ts-check

/** @type {import('prettier').Config} */
const config = {
useTabs: true,
singleQuote: true,
trailingComma: 'none',
printWidth: 100,
plugins: ['prettier-plugin-svelte'],
overrides: [
{ files: '*.svelte', options: { parser: 'svelte' } },
{ files: '*.svx', options: { parser: 'mdx' } }
]
};

export default config;
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
7 changes: 7 additions & 0 deletions src/lib/Mdsvx.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type RecipeMetadata = {
title: string;
layout: string;
date: string;
children?: Array<unknown>;
};
export type EventMetadata = { title: string; layout: string; date: string };
4 changes: 3 additions & 1 deletion src/routes/cheatsheet/_CheatSheetCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
height: var(--s-5);
border-radius: 50%;
background-color: var(--primary);
box-shadow: 25px 0 0 0 var(--caution), 50px 0 0 0 var(--success);
box-shadow:
25px 0 0 0 var(--caution),
50px 0 0 0 var(--success);
margin-right: 50px;
margin-left: 20px;
}
Expand Down
6 changes: 5 additions & 1 deletion src/routes/events/+page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { error } from '@sveltejs/kit';
import { getPages } from '../pageList';
import type { SvxMetadata } from '../pageList';
import type { EventMetadata } from '$lib/Mdsvx';

export async function load() {
const events = await getPages(import.meta.glob('./**/*.svx'));
const events = await getPages<EventMetadata>(
import.meta.glob<SvxMetadata<EventMetadata>>('./**/*.svx')
);

if (events) {
events.sort((a, b) => Date.parse(b.date) - Date.parse(a.date));
Expand Down
8 changes: 5 additions & 3 deletions src/routes/pageList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export async function getPages(
metaGlob: Array<string>
): Promise<Array<{ [key: string]: string; filename: string; path: string; title?: string }>> {
export type SvxMetadata<T extends object> = { metadata: T };

export async function getPages<T extends object>(
metaGlob: Record<string, () => Promise<SvxMetadata<T>>> // Should be `ReturnType<vite.ImportGlobFunction>` but the ast function overload is pick, which is the wrong one
): Promise<Array<T & { filename: string; path: string }>> {
const pages = await Promise.all(
Object.entries(metaGlob).map(async ([fullPath, page]) => {
const { metadata } = await page();
Expand Down
6 changes: 5 additions & 1 deletion src/routes/recipes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { error } from '@sveltejs/kit';
import '$styles/highlight.css';
import { getPages } from '../pageList';
import type { SvxMetadata } from '../pageList';
import type { RecipeMetadata } from '$lib/Mdsvx';

export async function load() {
const pages = (await getPages(import.meta.glob('./**/*.svx'))).map((element) => ({
const pages = (
await getPages<RecipeMetadata>(import.meta.glob<SvxMetadata<RecipeMetadata>>('./**/*.svx'))
).map((element) => ({
...element,
path: '/recipes' + element.path.substring(1)
}));
Expand Down
19 changes: 19 additions & 0 deletions src/routes/tools/tools.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,71 @@
[
{
"title": "rollup-plugin-svelte",
"npm": "rollup-plugin-svelte",
"category": "Bundler Plugins",
"description": "Compile Svelte components with Rollup",
"repository": "https://github.com/sveltejs/rollup-plugin-svelte",
"tags": ["official"]
},
{
"title": "svelte-loader",
"npm": "svelte-loader",
"category": "Bundler Plugins",
"description": "Webpack loader for svelte components",
"repository": "https://github.com/sveltejs/svelte-loader",
"tags": ["official"]
},
{
"title": "vite-plugin-svelte",
"npm": "@sveltejs/vite-plugin-svelte",
"category": "Bundler Plugins",
"description": "This is the official svelte plugin for vite",
"repository": "https://github.com/sveltejs/vite-plugin-svelte",
"tags": ["official"]
},
{
"title": "esbuild-svelte",
"npm": "esbuild-svelte",
"category": "Bundler Plugins",
"description": "An esbuild plugin to compile Svelte components",
"repository": "https://github.com/EMH333/esbuild-svelte",
"tags": []
},
{
"title": "rollup-plugin-svelte-hot",
"npm": "rollup-plugin-svelte-hot",
"category": "Bundler Plugins",
"description": "Fork of official rollup-plugin-svelte with added HMR support (for both Nollup or Rollup)",
"repository": "https://github.com/rixo/rollup-plugin-svelte-hot",
"tags": []
},
{
"title": "parcel-transformer-svelte3-plus",
"npm": "parcel-transformer-svelte3-plus",
"category": "Bundler Plugins",
"description": "Transformer plugin for Parcel v2; works with Svelte 3 & Svelte 4",
"repository": "https://github.com/HellButcher/parcel-transformer-svelte3-plus",
"tags": []
},
{
"title": "parcel-plugin-svelte",
"npm": "parcel-plugin-svelte",
"category": "Bundler Plugins",
"description": "A Parcel v1 plugin that enables Svelte support",
"repository": "https://github.com/DeMoorJasper/parcel-plugin-svelte",
"tags": []
},
{
"title": "sveltify",
"npm": "sveltify",
"category": "Bundler Plugins",
"description": "Browserify transform for Svelte",
"repository": "https://github.com/tehshrike/sveltify",
"tags": []
},
{
"title": "gulp-svelte",
"npm": "gulp-svelte",
"category": "Bundler Plugins",
"description": "A gulp 4 plugin to compile Svelte template to vanilla JavaScript",
"repository": "https://github.com/shinnn/gulp-svelte",
Expand All @@ -71,6 +80,7 @@
},
{
"title": "sveltejs-brunch",
"npm": "sveltejs-brunch",
"category": "Bundler Plugins",
"description": "Compile Svelte components inside Brunch projects",
"repository": "https://github.com/StarpTech/sveltejs-brunch",
Expand All @@ -92,6 +102,7 @@
},
{
"title": "svelte-preprocess",
"npm": "svelte-preprocess",
"category": "Preprocessors",
"description": "A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more",
"repository": "https://github.com/sveltejs/svelte-preprocess",
Expand Down Expand Up @@ -119,6 +130,7 @@
},
{
"title": "svelte-preprocess-less",
"npm": "svelte-preprocess-less",
"category": "Preprocessors",
"description": "Svelte preprocessor for less",
"repository": "https://github.com/ls-age/svelte-preprocess-less",
Expand All @@ -133,48 +145,55 @@
},
{
"title": "modular-css",
"npm": "@modular-css/svelte",
"category": "Preprocessors",
"description": "Svelte preprocessor support for modular-css",
"repository": "https://github.com/tivac/modular-css/tree/main/packages/svelte",
"tags": []
},
{
"title": "svelte-preprocess-sass",
"npm": "svelte-preprocess-sass",
"category": "Preprocessors",
"description": "Svelte preprocessor for sass",
"repository": "https://github.com/ls-age/svelte-preprocess-sass",
"tags": []
},
{
"title": "svelte-preprocess-css-hash",
"npm": "svelte-preprocess-css-hash",
"category": "Preprocessors",
"description": "Passing hashed css class name to child component. It is used to avoid class name conflicts.",
"repository": "https://github.com/jiangfengming/svelte-preprocess-css-hash",
"tags": []
},
{
"title": "svelte-preprocess-html-asset",
"npm": "svelte-preprocess-html-asset",
"category": "Preprocessors",
"description": "Transform html asset relative path. Works with snowpack & webpack 5.",
"repository": "https://github.com/jiangfengming/svelte-preprocess-html-asset",
"tags": []
},
{
"title": "svelte-preprocessor-fetch",
"npm": "svelte-preprocessor-fetch",
"category": "Preprocessors",
"description": "A preprocessor for Svelte can be used to fetch data before the component is compiled.",
"repository": "https://github.com/kevmodrome/svelte-preprocessor-fetch",
"tags": []
},
{
"title": "prettier-plugin-svelte",
"npm": "prettier-plugin-svelte",
"category": "Linting and Formatting",
"description": "Format your svelte components using prettier.",
"repository": "https://github.com/sveltejs/prettier-plugin-svelte",
"tags": ["official"]
},
{
"title": "svelte-check",
"npm": "svelte-check",
"category": "Linting and Formatting",
"description": "Detects unused css. Adds Svelte A11y hints. Provides JavaScript/TypeScript diagnostics.",
"repository": "https://github.com/sveltejs/language-tools/tree/master/packages/svelte-check",
Expand Down

0 comments on commit 81b74e6

Please sign in to comment.