Skip to content

Commit

Permalink
migrate to biome
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoux committed May 16, 2024
1 parent f0adb86 commit 1d6360d
Show file tree
Hide file tree
Showing 43 changed files with 171 additions and 302 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ web_modules/

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache
Expand Down
8 changes: 4 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"biomejs.biome",
"orta.vscode-twoslash-queries",
"yoavbls.pretty-ts-errors",
"zixuanchen.vitest-explorer"
"yoavbls.pretty-ts-errors"
],
"unwantedRecommendations": [
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
19 changes: 5 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [
{
"pattern": "./apps/*"
},
{
"pattern": "./packages/*"
},
],
"typescript.disableAutomaticTypeAcquisition": true,
"typescript.tsdk": "node_modules/typescript/lib",
"vitest.include": [
"apps/{api,cli}/**/*.test.ts",
"packages/core/**/*.test.ts",
],
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
20 changes: 13 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
"options": {
"shell": {
"executable": "nix",
"args": ["develop", "--impure", "--command", "bash", "-c"]
"args": [
"develop",
"--impure",
"--command",
"bash",
"-c"
]
}
},
"tasks": [
Expand All @@ -14,8 +20,8 @@
"isBackground": true,
"presentation": {
"reveal": "silent",
"panel": "dedicated",
},
"panel": "dedicated"
}
},
{
"label": "dev:type-check",
Expand All @@ -26,7 +32,7 @@
"reveal": "always",
"panel": "dedicated",
"group": "dev"
},
}
},
{
"label": "dev:api",
Expand All @@ -37,7 +43,7 @@
"reveal": "always",
"panel": "dedicated",
"group": "dev"
},
}
},
{
"label": "dev:web",
Expand All @@ -48,7 +54,7 @@
"reveal": "always",
"panel": "dedicated",
"group": "dev"
},
}
},
{
"label": "dev",
Expand All @@ -59,6 +65,6 @@
"dev:web"
],
"problemMatcher": []
},
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Opiniated TypeScript monorepo architecture including:
- [x] Pure ESM packages
- [x] Fast package manager (Pnpm)
- [x] Type-checking (TypeScript)
- [x] Lint (ESLint)
- [x] Lint (Biome)
- [x] Format (Prettier)
- [x] Task runner (Turborepo)
- [x] Monorepo lint (Knip)
Expand Down
2 changes: 1 addition & 1 deletion apps/api/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
dialect: "postgresql",
dbCredentials: {
url:
process.env["DATABASE_URL"] ??
process.env.DATABASE_URL ??
"postgresql://postgres@localhost:2345/acme",
},
verbose: true,
Expand Down
3 changes: 0 additions & 3 deletions apps/api/eslint.config.js

This file was deleted.

5 changes: 1 addition & 4 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,23 @@
"valibot": "0.30.0"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@total-typescript/ts-reset": "0.5.1",
"@types/node": "20.12.12",
"dotenv": "16.4.5",
"dotenv-cli": "7.4.2",
"drizzle-kit": "0.21.2",
"eslint": "8.57.0",
"tsx": "4.10.3",
"typescript": "5.5.0-dev.20240516",
"vitest": "1.6.0"
},
"scripts": {
"build": "tsc --build tsconfig.build.json",
"clean": "rm -rf .dts .turbo dist .eslintcache",
"clean": "rm -rf .dts .turbo dist",
"dev": "dotenv -c -- tsx --conditions development src/index.ts",
"drizzle-kit": "dotenv -c -- drizzle-kit",
"drizzle-kit:migrate": "dotenv -c -- tsx migrate.ts",
"env:pull": "infisical export --env=${INFISICAL_ENV:-dev} --path=/apps/api > .env",
"lint": "eslint --cache . --max-warnings 0",
"start": "node dist/index.js",
"test": "vitest run",
"type-check": "tsc --build"
Expand Down
6 changes: 3 additions & 3 deletions apps/api/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"rootDir": "src",
"outDir": "dist",
"emitDeclarationOnly": false,
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"include": [
"src",
"global.d.ts"
],
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.ts"
],
"references": [
{
"path": "../../packages/core/tsconfig.build.json"
},
}
]
}
3 changes: 0 additions & 3 deletions apps/cli/eslint.config.js

This file was deleted.

5 changes: 1 addition & 4 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
"yargs": "17.7.2"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@total-typescript/ts-reset": "0.5.1",
"@types/node": "20.12.12",
"@types/yargs": "17.0.32",
"eslint": "8.57.0",
"execa": "9.1.0",
"tsx": "4.10.3",
"typescript": "5.5.0-dev.20240516",
Expand All @@ -31,8 +29,7 @@
},
"scripts": {
"build": "tsc --build tsconfig.build.json",
"clean": "rm -rf .dts .turbo dist .eslintcache",
"lint": "eslint --cache . --max-warnings 0",
"clean": "rm -rf .dts .turbo dist",
"start": "node dist/index.js",
"start:dev": "tsx --conditions development src/index.ts",
"test": "vitest run",
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/hello/hello.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Argv } from "yargs";
import type { Argv } from "yargs";

export function helloCommand(program: Argv) {
return program.command(
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/posts/commands/list/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Argv } from "yargs";
import type { Argv } from "yargs";

export function listCommand(program: Argv) {
return program.command("list", "list posts", async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/posts/posts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Argv } from "yargs";
import type { Argv } from "yargs";
import { listCommand } from "./commands/list/list.js";

export function postsCommand(program: Argv) {
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/config/trpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type AppRouter } from "@acme/api";
import type { AppRouter } from "@acme/api";
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";

export const trpc = createTRPCProxyClient<AppRouter>({
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/test/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
export async function run(command: string, options?: Options): Promise<Result> {
const processedCommand = command.replace(
"acme",
process.env["CI"]
process.env.CI
? "node dist/index.js"
: "tsx --conditions development src/index.ts",
);
Expand Down
6 changes: 3 additions & 3 deletions apps/cli/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
"rootDir": "src",
"outDir": "dist",
"emitDeclarationOnly": false,
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"include": [
"src",
"global.d.ts"
],
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.ts"
],
"references": [
{
"path": "../api/tsconfig.build.json"
},
{
"path": "../../packages/core/tsconfig.build.json"
},
}
]
}
2 changes: 1 addition & 1 deletion apps/web/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type StorybookConfig } from "@storybook/react-vite";
import type { StorybookConfig } from "@storybook/react-vite";
import { dirname, join } from "node:path";

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/web/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Preview } from "@storybook/react";
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
Expand Down
3 changes: 0 additions & 3 deletions apps/web/eslint.config.js

This file was deleted.

5 changes: 1 addition & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
"type": "module",
"scripts": {
"build": "vite build",
"clean": "rm -rf .dts .turbo dist playwright-report test-results .eslintcache",
"clean": "rm -rf .dts .turbo dist playwright-report test-results",
"dev": "vite",
"lint": "eslint --cache . --max-warnings 0",
"preview": "vite preview",
"test:components": "playwright test -c playwright-ct.config.ts",
"test:e2e": "playwright test",
Expand All @@ -24,7 +23,6 @@
"react-dom": "18.3.1"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@playwright/experimental-ct-react": "1.44.0",
"@playwright/test": "1.44.0",
"@storybook/addon-a11y": "8.1.1",
Expand All @@ -42,7 +40,6 @@
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.2.1",
"axe-playwright": "2.0.1",
"eslint": "8.57.0",
"start-server-and-test": "2.0.3",
"storybook": "8.1.1",
"typescript": "5.5.0-dev.20240516",
Expand Down
6 changes: 3 additions & 3 deletions apps/web/playwright-ct.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export default defineConfig({
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env["CI"],
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env["CI"] ? 2 : 0,
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env["CI"] ? 1 : undefined,
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down
6 changes: 3 additions & 3 deletions apps/web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export default defineConfig({
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env["CI"],
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env["CI"] ? 2 : 0,
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env["CI"] ? 1 : undefined,
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function App() {
<h1>Vite + React</h1>
<div className="card">
<button
type="button"
onClick={() => {
setCount((count) => count + 1);
}}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/stories/Button.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Meta, type StoryObj } from "@storybook/react";
import type { Meta, StoryObj } from "@storybook/react";
import { Button } from "./Button";

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/stories/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Meta, type StoryObj } from "@storybook/react";
import type { Meta, StoryObj } from "@storybook/react";
import { Header } from "./Header";

const meta = {
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/stories/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const Header = ({
width="32"
xmlns="http://www.w3.org/2000/svg"
>
<title>Storybook Logo</title>
<g fill="none" fillRule="evenodd">
<path
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/stories/Page.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "@storybook/jest";
import { type Meta, type StoryObj } from "@storybook/react";
import type { Meta, StoryObj } from "@storybook/react";
import { userEvent, within } from "@storybook/testing-library";
import { Page } from "./Page";

Expand Down
1 change: 1 addition & 0 deletions apps/web/src/stories/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const Page: React.FC = () => {
width="10"
xmlns="http://www.w3.org/2000/svg"
>
<title>Viewports</title>
<g fill="none" fillRule="evenodd">
<path
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
Expand Down

0 comments on commit 1d6360d

Please sign in to comment.