Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ indent_style = space
indent_size = 2
end_of_line = LF
charset = utf-8
insert_final_newline = true
insert_final_newline = true
max_line_length = 100
quote_type = double
11 changes: 11 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxfmt/configuration_schema.json",
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf",
"trailingComma": "none",
"semi": true,
"singleQuote": false,
"arrowParens": "avoid",
"printWidth": 100
}
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Once the PR is there, **create an issue** and link the PR (mention the PR as you
> [!IMPORTANT]
> Mark the **allow edit by the maintainers** so we can more easily investigate the failing test and propose a fix. Otherwise we may need to close your PR and cherry-pick your commit.

### Formatting your code

We have a set of rules defined in the `.editorconfig` and `.oxfmtrc.json` files. Please format your code before opening a PR, so that we keep the codebase consistent. Regardless of what editor you use, running `pnpm format` will format your code according to our rules.

---

If you have read all the way here, you're already a champ! 🏆
Expand Down
2 changes: 1 addition & 1 deletion apps/fixtures/bare/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { solidStart } from "../../../packages/start/src/config";
import { nitroV2Plugin } from "../../../packages/start-nitro-v2-vite-plugin/src";

export default defineConfig({
plugins: [solidStart(), nitroV2Plugin()],
plugins: [solidStart(), nitroV2Plugin()]
});
2 changes: 1 addition & 1 deletion apps/fixtures/basic/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { solidStart } from "../../../packages/start/src/config";
import { nitroV2Plugin } from "../../../packages/start-nitro-v2-vite-plugin/src";

export default defineConfig({
plugins: [solidStart(), nitroV2Plugin()],
plugins: [solidStart(), nitroV2Plugin()]
});
4 changes: 2 additions & 2 deletions apps/fixtures/css/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const Layout = (props: FlowProps<{ title: string }>) => {

<ul class="list-inside list-disc mb-4 text-gray-400 font-semibold text-xs">
<li>
Enable throttling & disable cache in the network tab to see eventual FOUC's (frames of unstyled
content)
Enable throttling & disable cache in the network tab to see eventual FOUC's (frames of
unstyled content)
</li>
<li>Click on routes to test client navigation</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions apps/fixtures/css/src/components/lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "../styles/lazy.css";

const Lazy = () => {
return <></>
}
return <></>;
};

export default Lazy;
4 changes: 2 additions & 2 deletions apps/fixtures/css/src/components/lazyGlob.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "../styles/lazyGlob.css";

const Lazy = () => {
return <></>
}
return <></>;
};

export default Lazy;
2 changes: 1 addition & 1 deletion apps/fixtures/css/src/components/lazyLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import url from "../styles/lazyLink.css?url";

const Lazy = () => <link rel="stylesheet" href={url} />
const Lazy = () => <link rel="stylesheet" href={url} />;

export default Lazy;
2 changes: 1 addition & 1 deletion apps/fixtures/css/src/components/lazyLinkTmp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import url from "../styles/lazyLinkTmp.css?url";

const Lazy = () => <link rel="stylesheet" href={url} />
const Lazy = () => <link rel="stylesheet" href={url} />;

export default Lazy;
2 changes: 1 addition & 1 deletion apps/fixtures/css/src/components/test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const integrations = {
import: "import",
module: "import module",
url: "?url without render",
link: "?url + <link>",
link: "?url + <link>"
};
const Test = (props: {
invert?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion apps/fixtures/css/src/routes/[...404].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default function NotFound() {
</p>
</main>
);
}
}
4 changes: 2 additions & 2 deletions apps/fixtures/experiments/src/components/BreaksOnServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
const location = window.document.location;

export default function BreaksOnServer() {
return <div>Breaks on server {location.href}</div>
}
return <div>Breaks on server {location.href}</div>;
}
38 changes: 18 additions & 20 deletions apps/fixtures/experiments/src/entry-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@ declare module "@solidjs/start/server" {
}
}

export default createHandler(
() => (
<StartServer
document={({ assets, children, scripts }) => (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<div id="app">{children}</div>
{scripts}
</body>
</html>
)}
/>
)
);
export default createHandler(() => (
<StartServer
document={({ assets, children, scripts }) => (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<div id="app">{children}</div>
{scripts}
</body>
</html>
)}
/>
));
30 changes: 15 additions & 15 deletions apps/fixtures/experiments/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import { getRequestURL } from "@solidjs/start/http";
import { createMiddleware } from "@solidjs/start/middleware";

export default createMiddleware({
onRequest: [
(event) => {
event.locals.foo = "bar";
console.log("REQUEST", event.request.url);
console.log(
"SEARCH PARAM KEYS FROM ASYNC CONTEXT",
Array.from(getRequestURL().searchParams.keys()),
);
},
],
onBeforeResponse: [
(event, { body }) => {
console.log("BEFORE RESPONSE", body);
},
],
onRequest: [
event => {
event.locals.foo = "bar";
console.log("REQUEST", event.request.url);
console.log(
"SEARCH PARAM KEYS FROM ASYNC CONTEXT",
Array.from(getRequestURL().searchParams.keys())
);
}
],
onBeforeResponse: [
(event, { body }) => {
console.log("BEFORE RESPONSE", body);
}
]
});
14 changes: 8 additions & 6 deletions apps/fixtures/experiments/src/routes/(group).tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { RouteSectionProps } from "@solidjs/router";

export default function(props: RouteSectionProps) {
return <>
<h1>Group</h1>
{props.children}
</>
}
export default function (props: RouteSectionProps) {
return (
<>
<h1>Group</h1>
{props.children}
</>
);
}
6 changes: 3 additions & 3 deletions apps/fixtures/experiments/src/routes/(group)/other.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function() {
return <section>OTHER</section>
}
export default function () {
return <section>OTHER</section>;
}
14 changes: 8 additions & 6 deletions apps/fixtures/experiments/src/routes/(group2).tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { RouteSectionProps } from "@solidjs/router";

export default function(props: RouteSectionProps) {
return <>
<h1>Group 2</h1>
{props.children}
</>
}
export default function (props: RouteSectionProps) {
return (
<>
<h1>Group 2</h1>
{props.children}
</>
);
}
6 changes: 3 additions & 3 deletions apps/fixtures/experiments/src/routes/(group2)/something.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function() {
return <section>SOMETHING</section>
}
export default function () {
return <section>SOMETHING</section>;
}
3 changes: 1 addition & 2 deletions apps/fixtures/experiments/src/routes/[...404].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { Title } from "@solidjs/meta";
import { HttpStatusCode } from "@solidjs/start";
import type { APIEvent } from "@solidjs/start/server";


export const GET = (event: APIEvent) => {
if (event.request.headers.get("accept") !== "application/json") return;
return { notFound: "API"}
return { notFound: "API" };
};

export default function NotFound() {
Expand Down
6 changes: 3 additions & 3 deletions apps/fixtures/experiments/src/routes/[[option]]/thing.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RouteSectionProps } from "@solidjs/router";

export default function(props: RouteSectionProps) {
return <section>THING: {props.params.option || "NO"}</section>
}
export default function (props: RouteSectionProps) {
return <section>THING: {props.params.option || "NO"}</section>;
}
2 changes: 1 addition & 1 deletion apps/fixtures/experiments/src/routes/api/hello/[name].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import type { APIHandler } from "@solidjs/start/server";

export const GET: APIHandler = async ({ params }) => {
return `Hello ${params.name}!`;
};
};
2 changes: 1 addition & 1 deletion apps/fixtures/experiments/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Home() {
console.log(v);
console.log(await v.hello);
});
const port = isServer ? new URL(getRequestEvent()!.request.url).port: location.port;
const port = isServer ? new URL(getRequestEvent()!.request.url).port : location.port;
fetch(`http://localhost:${port}${import.meta.env.BASE_URL}/unknown`, {
headers: { Accept: "application/json" }
}).then(async res => console.log(await res.json()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function() {
return <section>DIFFERENT CONTENT</section>
}
export default function () {
return <section>DIFFERENT CONTENT</section>;
}
6 changes: 3 additions & 3 deletions apps/fixtures/experiments/src/routes/test/(hi).tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function() {
return <section>CONTENT</section>
}
export default function () {
return <section>CONTENT</section>;
}
6 changes: 3 additions & 3 deletions apps/fixtures/experiments/src/routes/test/[name].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RouteSectionProps } from "@solidjs/router";

export default function(props: RouteSectionProps) {
return <section>{props.params.name}</section>
}
export default function (props: RouteSectionProps) {
return <section>{props.params.name}</section>;
}
6 changes: 3 additions & 3 deletions apps/fixtures/experiments/src/routes/漢字.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function() {
return <section>漢字</section>
}
export default function () {
return <section>漢字</section>;
}
4 changes: 2 additions & 2 deletions apps/fixtures/experiments/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "vite";
import { solidStart } from "../../../packages/start/src/config";
import { nitroV2Plugin } from '../../../packages/start-nitro-v2-vite-plugin/src'
import { nitroV2Plugin } from "../../../packages/start-nitro-v2-vite-plugin/src";

export default defineConfig({
plugins: [solidStart({ middleware: "./src/middleware.ts" }), nitroV2Plugin()],
plugins: [solidStart({ middleware: "./src/middleware.ts" }), nitroV2Plugin()]
});
8 changes: 4 additions & 4 deletions apps/fixtures/hackernews/public/sw.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
self.addEventListener("fetch", (e) => {
self.addEventListener("fetch", e => {
(e.request.url.includes("localhost") || e.request.url.includes("workers")) &&
e.respondWith(
caches
.open("solid-hn")
.then((t) =>
.then(t =>
t
.match(e.request)
.then((n) => n || fetch(e.request).then((n) => (t.put(e.request, n.clone()), n)))
.then(n => n || fetch(e.request).then(n => (t.put(e.request, n.clone()), n)))
)
);
});

self.addEventListener("activate", (e) => e.waitUntil(caches.delete("solid-hn")));
self.addEventListener("activate", e => e.waitUntil(caches.delete("solid-hn")));
4 changes: 2 additions & 2 deletions apps/fixtures/hackernews/src/components/comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const Comment: Component<{ comment: CommentDefinition }> = props => {
return (
<li class="comment">
<div class="by">
<A href={`/users/${props.comment.user}`}>{props.comment.user}</A>{" "}
{props.comment.time_ago} ago
<A href={`/users/${props.comment.user}`}>{props.comment.user}</A> {props.comment.time_ago}{" "}
ago
</div>
<div class="text" innerHTML={props.comment.content} />
<Show when={props.comment.comments.length}>
Expand Down
11 changes: 7 additions & 4 deletions apps/fixtures/hackernews/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ const mapStories = {
job: "jobs"
} as const;

export const getStories = query(async (type: StoryTypes, page: number): Promise<StoryDefinition[]> => {
"use server";
return fetchAPI(`${mapStories[type]}?page=${page}`);
}, "stories");
export const getStories = query(
async (type: StoryTypes, page: number): Promise<StoryDefinition[]> => {
"use server";
return fetchAPI(`${mapStories[type]}?page=${page}`);
},
"stories"
);

export const getStory = query(async (id: string): Promise<StoryDefinition> => {
"use server";
Expand Down
2 changes: 1 addition & 1 deletion apps/fixtures/hackernews/src/routes/users/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ export default function User(props: RouteSectionProps) {
</Show>
</div>
);
};
}
2 changes: 1 addition & 1 deletion apps/fixtures/hackernews/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { solidStart } from "../../../packages/start/src/config";
import { nitroV2Plugin } from "../../../packages/start-nitro-v2-vite-plugin/src";

export default defineConfig({
plugins: [solidStart()],
plugins: [solidStart()]
});
Loading
Loading