From e96a96a8fdb6d29bab8b8745ba215e21d1cdeff8 Mon Sep 17 00:00:00 2001 From: Keisuke Umeno <9renpoto@gmail.com> Date: Wed, 3 Jan 2024 10:18:44 +0900 Subject: [PATCH] feat: add biomejs (#1951) * feat: add biomejs * fix: null guard * fix: skip deno format * fix: rename label * fix: remove unused * feat: add biome ci * refactor: rename element * refactor: rename a element --- .eslintignore | 3 - .eslintrc.json | 3 - .github/workflows/bump.yml | 2 +- .github/workflows/deno.yml | 29 - .github/workflows/node.js.yml | 13 +- apps/desktop/src/App.tsx | 10 +- apps/desktop/src/main.tsx | 5 +- apps/desktop/vite.config.ts | 4 +- apps/web/next.config.js | 16 +- apps/web/pages/404.tsx | 5 +- apps/web/pages/_document.tsx | 3 +- apps/web/pages/index.tsx | 12 +- apps/web/playwright.config.ts | 2 +- apps/web/utils/gtag.ts | 10 +- biome.json | 25 + cspell.json | 20 +- package-lock.json | 1145 +++------------------ package.json | 13 +- packages/ui/src/Button/Button.stories.tsx | 6 +- packages/ui/src/Button/index.tsx | 1 + packages/ui/src/Footer/index.tsx | 16 +- packages/ui/src/Header/index.tsx | 9 +- 22 files changed, 208 insertions(+), 1144 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.json delete mode 100644 .github/workflows/deno.yml create mode 100644 biome.json diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 2813fa31..00000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -lib/ -.cache/ -node_modules/ diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index fd23a557..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["@9renpoto/eslint-config-typescript"] -} diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 2f7c0c4e..543094ee 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -84,6 +84,6 @@ jobs: body: ${{ steps.get_release_note.outputs.result }} title: "chore: bump v${{ steps.get_version.outputs.NEW_VERSION }}" labels: | - documentation + "Type: Documentation" draft: true milestone: "v${{ steps.get_version.outputs.NEW_VERSION }}" diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml deleted file mode 100644 index c646bd36..00000000 --- a/.github/workflows/deno.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Deno - -on: - pull_request: - paths: - - "**.json" - - "**.ts" - - "**.tsx" - push: - branches: - - main - paths: - - "**.json" - - "**.ts" - - "**.tsx" - -jobs: - format: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - - name: Verify formatting - run: deno fmt --check diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7ad0b33a..518e7bc7 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -29,7 +29,6 @@ jobs: - run: npm ci - run: npm run build - - run: npm run lint - run: npx playwright install --with-deps - name: Build Storybook @@ -48,6 +47,18 @@ jobs: - uses: codecov/codecov-action@v3 + quality: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Biome + uses: biomejs/setup-biome@v1 + with: + version: latest + - name: Run Biome + run: biome ci . + chromatic-deployment: runs-on: ubuntu-latest steps: diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index 525d75b1..8f161f9f 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -1,7 +1,7 @@ -import { useState } from "preact/hooks"; -import preactLogo from "./assets/preact.svg"; import { invoke } from "@tauri-apps/api/tauri"; +import { useState } from "preact/hooks"; import "./App.css"; +import preactLogo from "./assets/preact.svg"; function App() { const [greetMsg, setGreetMsg] = useState(""); @@ -17,13 +17,13 @@ function App() {

Welcome to Tauri!

- + - + - +
diff --git a/apps/desktop/src/main.tsx b/apps/desktop/src/main.tsx index 435ae44b..a68b2c99 100644 --- a/apps/desktop/src/main.tsx +++ b/apps/desktop/src/main.tsx @@ -2,4 +2,7 @@ import { render } from "preact"; import App from "./App"; import "./styles.css"; -render(, document.getElementById("root")!); +const root = document.getElementById("root"); +if (root) { + render(, root); +} diff --git a/apps/desktop/vite.config.ts b/apps/desktop/vite.config.ts index f7759559..4f4ee7b7 100644 --- a/apps/desktop/vite.config.ts +++ b/apps/desktop/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite"; import preact from "@preact/preset-vite"; +import { defineConfig } from "vite"; // https://vitejs.dev/config/ export default defineConfig(async () => ({ @@ -18,7 +18,7 @@ export default defineConfig(async () => ({ envPrefix: ["VITE_", "TAURI_"], build: { // Tauri supports es2021 - target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13", + target: process.env.TAURI_PLATFORM === "windows" ? "chrome105" : "safari13", // don't minify for debug builds minify: !process.env.TAURI_DEBUG ? "esbuild" : false, // produce sourcemaps for debug builds diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 4d795529..77cbd227 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -1,17 +1,7 @@ // @ts-check const withPreact = require("next-plugin-preact"); -const { - NODE_ENV, - VERCEL_GITHUB_COMMIT_SHA, - VERCEL_GITLAB_COMMIT_SHA, - VERCEL_BITBUCKET_COMMIT_SHA, - GA_TRACKING_ID, -} = process.env; - -const COMMIT_SHA = VERCEL_GITHUB_COMMIT_SHA || - VERCEL_GITLAB_COMMIT_SHA || - VERCEL_BITBUCKET_COMMIT_SHA; +const { GA_TRACKING_ID } = process.env; /** * @type {import('next').NextConfig} @@ -19,10 +9,6 @@ const COMMIT_SHA = VERCEL_GITHUB_COMMIT_SHA || const config = { productionBrowserSourceMaps: true, env: { - // Make the COMMIT_SHA available to the client so that Sentry events can be - // marked for the release they belong to. It may be undefined if running - // outside of Vercel - NEXT_PUBLIC_COMMIT_SHA: COMMIT_SHA, GA_TRACKING_ID, }, }; diff --git a/apps/web/pages/404.tsx b/apps/web/pages/404.tsx index 13c0cf31..10f6753e 100644 --- a/apps/web/pages/404.tsx +++ b/apps/web/pages/404.tsx @@ -1,6 +1,5 @@ -import Error from "next/error"; +import ErrorPage from "next/error"; export default function NotFound() { - // Opinionated: do not record an exception in Sentry for 404 - return ; + return ; } diff --git a/apps/web/pages/_document.tsx b/apps/web/pages/_document.tsx index e650e1aa..6ebdb055 100644 --- a/apps/web/pages/_document.tsx +++ b/apps/web/pages/_document.tsx @@ -29,7 +29,7 @@ export default class MyDocument extends Document { type="image/png" sizes="32x32" /> - + {/* Global Site Tag (gtag.js) - Google Analytics */}