diff --git a/docs/.prettierrc.mjs b/docs/.prettierrc.mjs index 85ccfb56..83e385b0 100644 --- a/docs/.prettierrc.mjs +++ b/docs/.prettierrc.mjs @@ -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", }, }, ], diff --git a/docs/eslint.config.mjs b/docs/eslint.config.mjs new file mode 100644 index 00000000..eb54ba58 --- /dev/null +++ b/docs/eslint.config.mjs @@ -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.*"], + }, + }, + }, +]; diff --git a/docs/examples/record_api_dart/analysis_options.yaml b/docs/examples/record_api_dart/analysis_options.yaml index 32774075..03a9f26e 100644 --- a/docs/examples/record_api_dart/analysis_options.yaml +++ b/docs/examples/record_api_dart/analysis_options.yaml @@ -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/** diff --git a/docs/examples/record_api_ts/src/update.ts b/docs/examples/record_api_ts/src/update.ts index d46b4c19..fde99436 100644 --- a/docs/examples/record_api_ts/src/update.ts +++ b/docs/examples/record_api_ts/src/update.ts @@ -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); diff --git a/docs/examples/record_api_ts/tests/basic.test.ts b/docs/examples/record_api_ts/tests/basic.test.ts index 6b8fa4b2..53647958 100644 --- a/docs/examples/record_api_ts/tests/basic.test.ts +++ b/docs/examples/record_api_ts/tests/basic.test.ts @@ -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 () => { diff --git a/docs/examples/record_api_ts/tsconfig.json b/docs/examples/record_api_ts/tsconfig.json index d88d4043..4e9bb2de 100644 --- a/docs/examples/record_api_ts/tsconfig.json +++ b/docs/examples/record_api_ts/tsconfig.json @@ -14,8 +14,5 @@ } }, "include": ["src/**/*"], - "exclude": [ - "dist", - "node_modules" - ] + "exclude": ["dist", "node_modules"] } diff --git a/docs/package.json b/docs/package.json index 16e4f5d7..7cdea91e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -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" } } diff --git a/docs/src/components/BarChart.tsx b/docs/src/components/BarChart.tsx index b9e8c506..7ddfdd5c 100644 --- a/docs/src/components/BarChart.tsx +++ b/docs/src/components/BarChart.tsx @@ -63,8 +63,8 @@ export function BarChart(props: BarChartProps) { onCleanup(() => chart?.destroy()); return ( -