mirror of
https://github.com/trailbaseio/trailbase.git
synced 2025-12-21 09:29:44 -06:00
Add eslint to docs.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// .prettierrc.mjs
|
||||
/** @type {import("prettier").Config} */
|
||||
export default {
|
||||
plugins: ['prettier-plugin-astro'],
|
||||
plugins: ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
|
||||
overrides: [
|
||||
{
|
||||
files: '*.astro',
|
||||
files: "*.astro",
|
||||
options: {
|
||||
parser: 'astro',
|
||||
parser: "astro",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
43
docs/eslint.config.mjs
Normal file
43
docs/eslint.config.mjs
Normal file
@@ -0,0 +1,43 @@
|
||||
import globals from "globals";
|
||||
import pluginJs from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import tailwind from "eslint-plugin-tailwindcss";
|
||||
import solid from "eslint-plugin-solid/configs/recommended";
|
||||
import astro from "eslint-plugin-astro";
|
||||
|
||||
export default [
|
||||
pluginJs.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
solid,
|
||||
...tailwind.configs["flat/recommended"],
|
||||
...astro.configs.recommended,
|
||||
{
|
||||
ignores: ["dist/", "node_modules/", ".astro/", "src/env.d.ts"],
|
||||
},
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,mts,ts,tsx,jsx,astro}"],
|
||||
rules: {
|
||||
// https://typescript-eslint.io/rules/no-explicit-any/
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"@typescript-eslint/no-wrapper-object-types": "warn",
|
||||
// http://eslint.org/docs/rules/no-unused-vars
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
vars: "all",
|
||||
args: "after-used",
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
// Collides with astro, we'd have to configure the solid plugin to ignore astro files.
|
||||
"solid/no-unknown-namespaces": "off",
|
||||
},
|
||||
languageOptions: { globals: globals.browser },
|
||||
settings: {
|
||||
tailwindcss: {
|
||||
whitelist: ["hide-scrollbars", "collapsible.*"],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -6,7 +6,6 @@ linter:
|
||||
unnecessary_brace_in_string_interps: false
|
||||
unawaited_futures: true
|
||||
sort_child_properties_last: false
|
||||
|
||||
# analyzer:
|
||||
# exclude:
|
||||
# - path/to/excluded/files/**
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Client } from "trailbase";
|
||||
|
||||
export const update = async (client: Client, id: string | number, record: object) =>
|
||||
await client.records("simple_strict_table").update(id, record);
|
||||
export const update = async (
|
||||
client: Client,
|
||||
id: string | number,
|
||||
record: object,
|
||||
) => await client.records("simple_strict_table").update(id, record);
|
||||
|
||||
@@ -25,13 +25,13 @@ test("Test code examples", async () => {
|
||||
|
||||
{
|
||||
const record = await read(client, id);
|
||||
expect(record).toMatchObject({ "text_not_null": "test" });
|
||||
expect(record).toMatchObject({ text_not_null: "test" });
|
||||
}
|
||||
|
||||
{
|
||||
await update(client, id, { "text_not_null": "updated" });
|
||||
await update(client, id, { text_not_null: "updated" });
|
||||
const record = await read(client, id);
|
||||
expect(record).toMatchObject({ "text_not_null": "updated" });
|
||||
expect(record).toMatchObject({ text_not_null: "updated" });
|
||||
}
|
||||
|
||||
await remove(client, id);
|
||||
@@ -57,7 +57,6 @@ test("Test code examples", async () => {
|
||||
}
|
||||
recordStream.cancel();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
test("Test list examples", async () => {
|
||||
|
||||
@@ -14,8 +14,5 @@
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
]
|
||||
"exclude": ["dist", "node_modules"]
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"build": "astro check && astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro",
|
||||
"check": "astro check",
|
||||
"format": "prettier -w tailwind.config.ts astro.config.mjs src "
|
||||
"check": "astro check && eslint",
|
||||
"format": "prettier -w ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.9.4",
|
||||
@@ -31,8 +31,16 @@
|
||||
"devDependencies": {
|
||||
"@astrojs/sitemap": "^3.2.1",
|
||||
"@astrojs/solid-js": "^5.0.4",
|
||||
"@eslint/js": "^9.21.0",
|
||||
"astro-robots-txt": "^1.0.0",
|
||||
"eslint": "^9.21.0",
|
||||
"eslint-plugin-astro": "^1.3.1",
|
||||
"eslint-plugin-solid": "^0.14.5",
|
||||
"eslint-plugin-tailwindcss": "^3.18.0",
|
||||
"globals": "^15.15.0",
|
||||
"prettier": "^3.5.2",
|
||||
"prettier-plugin-astro": "^0.14.1"
|
||||
"prettier-plugin-astro": "^0.14.1",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"typescript-eslint": "^8.25.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ export function BarChart(props: BarChartProps) {
|
||||
onCleanup(() => chart?.destroy());
|
||||
|
||||
return (
|
||||
<div class="canvas-container w-full h-full">
|
||||
<canvas ref={ref}></canvas>
|
||||
<div id="canvas-container" class="size-full">
|
||||
<canvas ref={ref} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -161,8 +161,8 @@ export function BarChartWithErrors(props: BarChartWithErrorsProps) {
|
||||
onCleanup(() => chart?.destroy());
|
||||
|
||||
return (
|
||||
<div class="canvas-container w-full h-full">
|
||||
<canvas ref={ref}></canvas>
|
||||
<div id="canvas-container" class="size-full">
|
||||
<canvas ref={ref} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ export function LineChart(props: LineChartProps) {
|
||||
onCleanup(() => chart?.destroy());
|
||||
|
||||
return (
|
||||
<div class="canvas-container w-full h-full">
|
||||
<canvas ref={ref}></canvas>
|
||||
<div id="canvas-container" class="size-full">
|
||||
<canvas ref={ref} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ export function ScatterChart(props: ScatterChartProps) {
|
||||
onCleanup(() => chart?.destroy());
|
||||
|
||||
return (
|
||||
<div class="canvas-container w-full h-full">
|
||||
<canvas ref={ref}></canvas>
|
||||
<div id="canvas-container" class="size-full">
|
||||
<canvas ref={ref} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
import { Card } from "@astrojs/starlight/components";
|
||||
import { type StarlightIcon } from "@astrojs/starlight/types";
|
||||
|
||||
export interface Props {
|
||||
title: string;
|
||||
icon?: any;
|
||||
icon?: StarlightIcon;
|
||||
reverse?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ export const recordApiIdPlaceholder = "<url-safe_b64_uuid_or_int>";
|
||||
|
||||
export function apiPath(opts: ApiOptions): string {
|
||||
const apiBase = "/api/records/v1";
|
||||
let suffix = opts.suffix ? `/${opts.suffix}` : "";
|
||||
const suffix = opts.suffix ? `/${opts.suffix}` : "";
|
||||
return `${opts.prefix ?? ""}${apiBase}/${opts.name}${suffix}`;
|
||||
}
|
||||
|
||||
@@ -148,6 +148,13 @@ export function Duration100kInsertsChart() {
|
||||
);
|
||||
}
|
||||
|
||||
type Percentiles = {
|
||||
p50: number;
|
||||
p75: number;
|
||||
p90: number;
|
||||
p95: number;
|
||||
};
|
||||
|
||||
export function PocketBaseAndTrailBaseReadLatencies() {
|
||||
// 2024-10-12
|
||||
// TB: Read 1 000 000 messages, took 0:00:57.952120 (limit=64) (Dart JIT)
|
||||
@@ -202,7 +209,7 @@ export function PocketBaseAndTrailBaseReadLatencies() {
|
||||
p95: 20503,
|
||||
};
|
||||
|
||||
const latenciesMs = (d: any) =>
|
||||
const latenciesMs = (d: Percentiles) =>
|
||||
[d.p50, d.p75, d.p90, d.p95].map((p) => p / 1000);
|
||||
|
||||
const data: ChartData<"bar"> = {
|
||||
@@ -300,7 +307,7 @@ export function PocketBaseAndTrailBaseInsertLatencies() {
|
||||
p95: 61512,
|
||||
};
|
||||
|
||||
const latenciesMs = (d: any) =>
|
||||
const latenciesMs = (d: Percentiles) =>
|
||||
[d.p50, d.p75, d.p90, d.p95].map((p) => p / 1000);
|
||||
|
||||
const data: ChartData<"bar"> = {
|
||||
|
||||
@@ -11,9 +11,5 @@
|
||||
"@root/*": ["../*"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules",
|
||||
"public"
|
||||
]
|
||||
"exclude": ["dist", "node_modules", "public"]
|
||||
}
|
||||
|
||||
24
pnpm-lock.yaml
generated
24
pnpm-lock.yaml
generated
@@ -60,15 +60,39 @@ importers:
|
||||
'@astrojs/solid-js':
|
||||
specifier: ^5.0.4
|
||||
version: 5.0.4(@testing-library/jest-dom@6.6.3)(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(solid-devtools@0.30.1(solid-js@1.9.5)(vite@6.2.0(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(yaml@2.7.0)))(solid-js@1.9.5)(yaml@2.7.0)
|
||||
'@eslint/js':
|
||||
specifier: ^9.21.0
|
||||
version: 9.21.0
|
||||
astro-robots-txt:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
eslint:
|
||||
specifier: ^9.21.0
|
||||
version: 9.21.0(jiti@2.4.2)
|
||||
eslint-plugin-astro:
|
||||
specifier: ^1.3.1
|
||||
version: 1.3.1(eslint@9.21.0(jiti@2.4.2))
|
||||
eslint-plugin-solid:
|
||||
specifier: ^0.14.5
|
||||
version: 0.14.5(eslint@9.21.0(jiti@2.4.2))(typescript@5.7.3)
|
||||
eslint-plugin-tailwindcss:
|
||||
specifier: ^3.18.0
|
||||
version: 3.18.0(tailwindcss@3.4.17(ts-node@10.9.2(@types/node@22.13.5)(typescript@5.7.3)))
|
||||
globals:
|
||||
specifier: ^15.15.0
|
||||
version: 15.15.0
|
||||
prettier:
|
||||
specifier: ^3.5.2
|
||||
version: 3.5.2
|
||||
prettier-plugin-astro:
|
||||
specifier: ^0.14.1
|
||||
version: 0.14.1
|
||||
prettier-plugin-tailwindcss:
|
||||
specifier: ^0.6.11
|
||||
version: 0.6.11(prettier-plugin-astro@0.14.1)(prettier@3.5.2)
|
||||
typescript-eslint:
|
||||
specifier: ^8.25.0
|
||||
version: 8.25.0(eslint@9.21.0(jiti@2.4.2))(typescript@5.7.3)
|
||||
|
||||
docs/examples/record_api_ts:
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user