Skip to content

Commit

Permalink
Migrate from vite, prettier and eslint to rsbuild and biome
Browse files Browse the repository at this point in the history
  • Loading branch information
sembrestels committed Jul 3, 2024
1 parent e7db30d commit 43239d4
Show file tree
Hide file tree
Showing 42 changed files with 202 additions and 204 deletions.
5 changes: 0 additions & 5 deletions .eslintrc.js

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ jobs:
- name: Build
run: bun run build

- name: Lint code
run: bun lint

- name: Check evmcrispr types
run: bun type-check
run: bun check

- name: Tests
if: steps.changed-files.outputs.any_changed == 'true'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- uses: oven-sh/setup-bun@v1

- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: "bun"
node-version: ${{ matrix.node-version }}
Expand Down
1 change: 0 additions & 1 deletion .pretierrc.json

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions apps/evmcrispr-terminal/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion apps/evmcrispr-terminal/.pretierrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions apps/evmcrispr-terminal/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"extends": ["@repo/biome-config"]
}
19 changes: 8 additions & 11 deletions apps/evmcrispr-terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,20 @@
"zustand-x": "^3.0.3"
},
"devDependencies": {
"@repo/eslint-config": "*",
"@repo/prettier-config": "*",
"@repo/biome-config": "*",
"@repo/typescript-config": "*",
"@rsbuild/core": "^0.7.10",
"@rsbuild/plugin-react": "^0.7.10",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-transition-group": "^4.4.10",
"@types/use-persisted-state": "^0.3.4",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"vite": "^5.2.1"
"@types/use-persisted-state": "^0.3.4"
},
"scripts": {
"dev": "vite --clearScreen false",
"build": "tsc && vite build",
"type-check": "tsc --noEmit",
"preview": "vite preview",
"lint": "eslint \"src/**/*.{ts,tsx}\""
"dev": "rsbuild --clearScreen false",
"build": "rsbuild build",
"check": "tsc --noEmit && biome check --write",
"preview": "rsbuild preview"
},
"license": "AGPL-3.0-or-later"
}
23 changes: 23 additions & 0 deletions apps/evmcrispr-terminal/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";

export default defineConfig({
plugins: [pluginReact()],
source: {
entry: {
main: "./src/main.tsx",
},
},
html: {
template: "./index.html",
},
server: {
port: 3000,
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET",
"Access-Control-Allow-Headers":
"X-Requested-With, content-type, Authorization",
},
},
});
2 changes: 1 addition & 1 deletion apps/evmcrispr-terminal/src/api/pinata/fetch-pin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const fetchPin = async (
}

return response.json();
} catch (e) {
} catch (_e) {
throw new Error("Bad response from server");
}
};
Expand Down
2 changes: 1 addition & 1 deletion apps/evmcrispr-terminal/src/api/pinata/pin-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const pinJSON = async (data: Record<string, any>): Promise<Res> => {
}

return response.json();
} catch (e) {
} catch (_e) {
throw new Error("Bad response from server");
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function ShareButton({ script, title }: ShareButtonProps) {
});
setLoading(false);
navigate(`/terminal/${hash}`, { replace: true });
} catch (e) {
} catch (_e) {
toast({
description: "The script could not be saved to IPFS",
status: "error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const runEagerExecutions = async (

return eagerFn;
// eslint-disable-next-line no-empty
} catch (err) {
} catch (_err) {
return;
}
});
Expand All @@ -276,7 +276,7 @@ export const runEagerExecutions = async (
try {
resolveLazyBinding(eagerBindingsManager);
// eslint-disable-next-line no-empty
} catch (err) {}
} catch (_err) {}
});
};

Expand Down
2 changes: 1 addition & 1 deletion apps/evmcrispr-terminal/src/overrides/safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { SafeAppProvider } from "@safe-global/safe-apps-provider";
import type { Opts } from "@safe-global/safe-apps-sdk";
// @ts-ignore
import type { type Connector } from "@wagmi/core";
import type { Connector } from "@wagmi/core";
import { ProviderNotFoundError, createConnector } from "@wagmi/core";
import type { Evaluate } from "@wagmi/core/internal";
import { getAddress, withTimeout } from "viem";
Expand Down
2 changes: 1 addition & 1 deletion apps/evmcrispr-terminal/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@repo/typescript-config/vite.json",
"extends": "@repo/typescript-config/rsbuild.json",
"include": ["src"],
"compilerOptions": {
"jsx": "react-jsx"
Expand Down
26 changes: 0 additions & 26 deletions apps/evmcrispr-terminal/vite.config.ts

This file was deleted.

4 changes: 4 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"extends": ["@repo/biome-config"]
}
Binary file modified bun.lockb
Binary file not shown.
7 changes: 2 additions & 5 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
module.exports = {
// Type check TypeScript files
"(apps|packages)/**/*.(ts|tsx)": () => "bun run type-check",
"(apps|packages)/**/*.(ts|tsx)": () => "bun run check",

// Lint then format TypeScript and JavaScript files
"(apps|packages)/**/*.(ts|tsx|js)": (filenames) => [
`bunx eslint --fix ${filenames.join(" ")}`,
`bunx prettier --write ${filenames.join(" ")}`,
],
"(apps|packages)/**/*.(ts|tsx|js)": "bun run format --staged",
};
15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
{
"private": true,
"scripts": {
"prepare": "husky install",
"prepare": "husky",
"build": "turbo build",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only",
"dev": "turbo dev",
"type-check": "turbo run type-check",
"lint": "turbo lint",
"check": "turbo run check",
"test": "turbo test",
"test:coverage": "turbo run test:coverage",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"format": "biome format --write",
"dev:terminal": "turbo run dev --filter=evmcrispr-terminal"
},
"devDependencies": {
"@changesets/cli": "^2.27.6",
"eslint": "^8.57.0",
"@repo/biome-config": "*",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"prettier": "^3.2.5",
"turbo": "^2.0.5"
},
"name": "evmcrispr-monorepo",
"packageManager": "bun@1.1.4",
"workspaces": [
"apps/*",
"packages/*"
]
"workspaces": ["apps/*", "packages/*"]
}
111 changes: 111 additions & 0 deletions packages/config-biome/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"organizeImports": {
"enabled": false
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noBannedTypes": "error",
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessTypeConstraint": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": {
"noNamespace": "error",
"noNonNullAssertion": "off",
"useAsConstAssertion": "error",
"useBlockStatements": "off"
},
"suspicious": {
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "off",
"noExplicitAny": "off",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
}
},
"overrides": [
{
"include": ["*.ts", "*.tsx", "*.mts", "*.cts"],
"linter": {
"rules": {
"correctness": {
"noUndeclaredVariables": "off"
},
"style": {
"noArguments": "error",
"noVar": "error",
"useConst": "error"
}
}
}
}
]
}
12 changes: 12 additions & 0 deletions packages/config-biome/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@repo/biome-config",
"version": "0.0.0",
"main": "biome.json",
"license": "MIT",
"dependencies": {
"@biomejs/biome": "^1.8.1"
},
"publishConfig": {
"access": "public"
}
}
Loading

0 comments on commit 43239d4

Please sign in to comment.