Skip to content

Commit

Permalink
Merge pull request #106 from magne4000/biome
Browse files Browse the repository at this point in the history
Replace eslint and prettier by biome
  • Loading branch information
magne4000 authored Aug 20, 2024
2 parents 5a75f94 + d0839f0 commit f3fb9f4
Show file tree
Hide file tree
Showing 130 changed files with 1,949 additions and 3,520 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -32,5 +32,7 @@ jobs:
run: pnpm run build:all
- name: Typecheck
run: pnpm run typecheck:all
- name: Lint
run: pnpm lint
- name: Test
run: pnpm test
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

140 changes: 0 additions & 140 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

29 changes: 29 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["dist/", "package.json"]
},
"formatter": {
"indentWidth": 2,
"indentStyle": "space"
},
"javascript": {
"formatter": {
"lineWidth": 120
}
},
"vcs": {
"enabled": true,
"clientKind": "git"
},
"overrides": [
{
"include": ["**/*.test.ts"],
"linter": {
"rules": {
"suspicious": { "noExplicitAny": "off" }
}
}
}
]
}
9 changes: 3 additions & 6 deletions examples/demo/_api/name/[name].ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import type { VercelRequest, VercelResponse } from '@vercel/node';
import type { VercelRequest, VercelResponse } from "@vercel/node";

export default async function handler(
request: VercelRequest,
response: VercelResponse,
) {
return response.send('Name: ' + request.query.name);
export default async function handler(request: VercelRequest, response: VercelResponse) {
return response.send(`Name: ${request.query.name}`);
}
11 changes: 4 additions & 7 deletions examples/demo/_api/page.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import type { VercelRequest, VercelResponse } from '@vercel/node';
import type { VercelRequest, VercelResponse } from "@vercel/node";

export const headers = {
'X-VitePluginVercel-Test': 'test',
"X-VitePluginVercel-Test": "test",
};

export default async function handler(
request: VercelRequest,
response: VercelResponse,
) {
return response.send('OK');
export default async function handler(request: VercelRequest, response: VercelResponse) {
return response.send("OK");
}
9 changes: 3 additions & 6 deletions examples/demo/_api/post.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import type { VercelRequest, VercelResponse } from '@vercel/node';
import type { VercelRequest, VercelResponse } from "@vercel/node";

export default async function handler(
request: VercelRequest,
response: VercelResponse,
) {
return response.send('OK');
export default async function handler(request: VercelRequest, response: VercelResponse) {
return response.send("OK");
}
6 changes: 3 additions & 3 deletions examples/demo/endpoints/edge.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { get } from '@vercel/edge-config';
import { get } from "@vercel/edge-config";

export const edge = true;

export default async function handler() {
await get('someKey');
await get("someKey");

return new Response('Edge Function: OK', {
return new Response("Edge Function: OK", {
status: 200,
});
}
43 changes: 19 additions & 24 deletions examples/demo/endpoints/og-edge.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
import React from 'react';
import { ImageResponse } from '@vercel/og';
import React from "react";
import { ImageResponse } from "@vercel/og";

import type { VercelRequest, VercelResponse } from '@vercel/node';
import type { VercelRequest, VercelResponse } from "@vercel/node";

export const edge = true;

export default async function handler(
request: VercelRequest,
response: VercelResponse,
) {
export default async function handler(request: VercelRequest, response: VercelResponse) {
return new ImageResponse(
(
<div
style={{
fontSize: 40,
color: 'black',
background: 'white',
width: '100%',
height: '100%',
padding: '50px 200px',
textAlign: 'center',
justifyContent: 'center',
alignItems: 'center',
}}
>
👋 Hello
</div>
),
<div
style={{
fontSize: 40,
color: "black",
background: "white",
width: "100%",
height: "100%",
padding: "50px 200px",
textAlign: "center",
justifyContent: "center",
alignItems: "center",
}}
>
👋 Hello
</div>,
{
width: 1200,
height: 630,
Expand Down
63 changes: 28 additions & 35 deletions examples/demo/endpoints/og-node.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
import React from 'react';
import { ImageResponse } from '@vercel/og';
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { Readable } from "node:stream";
import type { ReadableStream } from "node:stream/web";
import type { VercelRequest, VercelResponse } from "@vercel/node";
import { ImageResponse } from "@vercel/og";
import React from "react";

import type { VercelRequest, VercelResponse } from '@vercel/node';
import { Readable } from 'node:stream';
import type { ReadableStream } from 'node:stream/web';
const font = readFileSync(join(__dirname, "./Roboto-Regular.ttf"));

import { readFileSync } from 'node:fs';
import { join } from 'node:path';

const font = readFileSync(join(__dirname, './Roboto-Regular.ttf'));

export default async function handler(
request: VercelRequest,
response: VercelResponse,
) {
export default async function handler(request: VercelRequest, response: VercelResponse) {
const resp = new ImageResponse(
(
<div
style={{
fontFamily: 'Roboto',
fontSize: 40,
color: 'black',
background: 'white',
width: '100%',
height: '100%',
padding: '50px 200px',
textAlign: 'center',
justifyContent: 'center',
alignItems: 'center',
}}
>
👋 Hello
</div>
),
<div
style={{
fontFamily: "Roboto",
fontSize: 40,
color: "black",
background: "white",
width: "100%",
height: "100%",
padding: "50px 200px",
textAlign: "center",
justifyContent: "center",
alignItems: "center",
}}
>
👋 Hello
</div>,
{
width: 1200,
height: 630,
fonts: [
{
name: 'Roboto',
name: "Roboto",
// Use `fs` (Node.js only) or `fetch` to read the font as Buffer/ArrayBuffer and provide `data` here.
data: font,
weight: 400,
style: 'normal',
style: "normal",
},
],
},
);

Readable.fromWeb(resp.body as ReadableStream<any>).pipe(response);
Readable.fromWeb(resp.body as ReadableStream).pipe(response);
}
Loading

0 comments on commit f3fb9f4

Please sign in to comment.