Skip to content

Commit

Permalink
Replace prettier with biome (it's much faster)
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Sep 16, 2024
1 parent 9390d5d commit 1cd0830
Show file tree
Hide file tree
Showing 29 changed files with 210 additions and 187 deletions.
18 changes: 0 additions & 18 deletions .prettierrc

This file was deleted.

24 changes: 16 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,37 @@
"*.env.example": "properties",
"*.env.local.example": "properties",
"tsconfig.json": "jsonc",
"tsconfig.*.json": "jsonc",
"ts-library.json": "jsonc"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
}
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
}
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
"quickfix.biome": "explicit"
}
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit"
}
},
"eslint.rules.customizations": [],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.configPath": ".prettierrc",
"editor.defaultFormatter": "biomejs.biome",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"javascript.preferences.quoteStyle": "double",
Expand Down
2 changes: 1 addition & 1 deletion apps/client-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
savePODsToStorage
} from "./client/utils";
import { Rabbit } from "./rabbit";
import { ClientAction, clientReducer, ClientState } from "./state";
import { ClientAction, ClientState, clientReducer } from "./state";

function App() {
const [state, dispatch] = useReducer(clientReducer, {
Expand Down
4 changes: 2 additions & 2 deletions apps/client-web/src/client/pod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ParcnetPODRPC, PODQuery } from "@parcnet-js/client-rpc";
import { encodePrivateKey, POD, PODEntries } from "@pcd/pod";
import { PODQuery, ParcnetPODRPC } from "@parcnet-js/client-rpc";
import { POD, PODEntries, encodePrivateKey } from "@pcd/pod";
import { Identity } from "@semaphore-protocol/identity";
import { PODCollection } from "./pod_collection.js";
import { QuerySubscriptions } from "./query_subscriptions.js";
Expand Down
43 changes: 43 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"files": {
"ignore": [
"**/build/**",
"**/dist/**",
"**/node_modules/**",
"**/.turbo/**",
"**/.next/**",
"**/.vscode/**"
],
"include": ["./apps/**", "./packages/**", "./examples/**"]
},
/**
* Biome is enabled for formatting.
*/
"formatter": {
"enabled": true,
"indentStyle": "space"
},
/**
* ESLint is probably still better than Biome for now, so the Biome linter is disabled.
*/
"linter": {
"enabled": false
},
/**
* Biome is enabled for organizing imports.
*/
"organizeImports": {
"enabled": true
},
"javascript": {
"formatter": {
"trailingCommas": "none"
}
},
"json": {
"parser": {
"allowComments": true
}
}
}
2 changes: 1 addition & 1 deletion examples/test-app/src/apis/PODSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ParcnetAPI, Subscription } from "@parcnet-js/app-connector";
import * as p from "@parcnet-js/podspec";
import { POD, POD_INT_MAX, POD_INT_MIN, PODEntries, PODValue } from "@pcd/pod";
import { POD, PODEntries, PODValue, POD_INT_MAX, POD_INT_MIN } from "@pcd/pod";
import JSONBig from "json-bigint";
import {
Dispatch,
Expand Down
4 changes: 2 additions & 2 deletions examples/test-app/src/hooks/useParcnetClient.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { connect, ParcnetAPI, Zapp } from "@parcnet-js/app-connector";
import { ParcnetAPI, Zapp, connect } from "@parcnet-js/app-connector";
import {
createContext,
ReactNode,
createContext,
useContext,
useEffect,
useRef,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"scripts": {
"build": "TURBO_UI=0 turbo build",
"dev": "turbo dev",
"lint": "turbo lint",
"lint": "biome check --diagnostic-level=error && turbo lint",
"test": "turbo test",
"knip": "knip --no-gitignore",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"watch": "turbo watch build --filter='./packages/**'"
},
"devDependencies": {
"@biomejs/biome": "^1.9.1",
"@changesets/cli": "^2.27.8",
"knip": "^5.29.2",
"prettier": "^3.2.5",
"turbo": "^2.0.14",
"typescript": "^5.4.5",
"vitest": "^2.0.5"
Expand Down
5 changes: 1 addition & 4 deletions packages/app-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
"prepublish": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap --dts",
"test": "vitest run"
},
"files": [
"dist",
"LICENSE"
],
"files": ["dist", "LICENSE"],
"dependencies": {
"@brenoroosevelt/toast": "^2.0.3",
"@parcnet-js/client-rpc": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-connector/src/rpc_client.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
PODQuery,
ParcnetEvents,
ParcnetGPCRPC,
ParcnetIdentityRPC,
ParcnetPODRPC,
ParcnetRPC,
ParcnetRPCMethodName,
ParcnetRPCSchema,
PODQuery,
ProveResult,
RPCFunction,
RPCMessage,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-connector/test/parcnet-connector.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import crypto from "crypto";
import {
RPCMessage,
RPCMessageSchema,
Expand All @@ -6,7 +7,6 @@ import {
} from "@parcnet-js/client-rpc";
import * as p from "@parcnet-js/podspec";
import { POD } from "@pcd/pod";
import crypto from "crypto";
import * as v from "valibot";
import { assert, describe, expect, it } from "vitest";
import { postRPCMessage } from "../src/index.js";
Expand Down
5 changes: 1 addition & 4 deletions packages/client-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
"prepublish": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap --dts",
"lint": "eslint . --max-warnings 0"
},
"files": [
"dist",
"LICENSE"
],
"files": ["dist", "LICENSE"],
"dependencies": {
"@parcnet-js/client-rpc": "workspace:*",
"json-bigint": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/client-helpers/src/connection/iframe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
deepGet,
InitializationMessageSchema,
InitializationMessageType,
ParcnetRPC,
Expand All @@ -9,7 +8,8 @@ import {
RPCMessageSchema,
RPCMessageType,
SubscriptionUpdateResult,
Zapp
Zapp,
deepGet
} from "@parcnet-js/client-rpc";
import * as v from "valibot";
import { ConnectorAdvice } from "./advice.js";
Expand Down
5 changes: 1 addition & 4 deletions packages/client-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"build": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap",
"prepublish": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap --dts"
},
"files": [
"dist",
"LICENSE"
],
"files": ["dist", "LICENSE"],
"dependencies": {
"@parcnet-js/podspec": "workspace:*",
"@pcd/gpc": "0.0.6",
Expand Down
7 changes: 2 additions & 5 deletions packages/eslint-config/eslint.base.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginChaiFriendly from "eslint-plugin-chai-friendly";
import eslintPluginImport from "eslint-plugin-import";
import hooksPlugin from "eslint-plugin-react-hooks";
import eslintPluginPrettier from "eslint-plugin-prettier";
import eslintPluginTurbo from "eslint-plugin-turbo";
import eslintPluginImport from "eslint-plugin-import";
import tseslint from "typescript-eslint";

export default tseslint.config(
eslint.configs.recommended,
Expand Down Expand Up @@ -35,13 +34,11 @@ export default tseslint.config(
plugins: {
"chai-friendly": pluginChaiFriendly,
"react-hooks": hooksPlugin,
prettier: eslintPluginPrettier,
turbo: eslintPluginTurbo,
import: eslintPluginImport
},
rules: {
...hooksPlugin.configs.recommended.rules,
"prettier/prettier": "error",
"turbo/no-undeclared-env-vars": "error"
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config/eslint.reactInternal.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import baseConfig from "./eslint.base.config.mjs";
import tseslint from "typescript-eslint";
import globals from "globals";
import tseslint from "typescript-eslint";
import baseConfig from "./eslint.base.config.mjs";

export default tseslint.config(...baseConfig, {
languageOptions: {
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/eslint__js": "^8.42.3",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.0.0",
"eslint-plugin-chai-friendly": "^1.0.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-tree-shaking": "^1.12.2",
"eslint-plugin-turbo": "^2.1.1",
Expand Down
6 changes: 1 addition & 5 deletions packages/podspec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
"prepublish": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap --dts",
"test": "vitest run"
},
"files": [
"dist",
"./README.md",
"./LICENSE"
],
"files": ["dist", "./README.md", "./LICENSE"],
"dependencies": {
"@pcd/gpc": "0.0.6",
"@pcd/pod": "0.1.5"
Expand Down
8 changes: 4 additions & 4 deletions packages/podspec/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
PodspecProofRequest,
ProofRequest,
proofRequest,
ProofRequestSpec
ProofRequestSpec,
proofRequest
} from "./gpc/proof_request.js";
import { entries, EntriesOutputType, EntriesSpec } from "./parse/entries.js";
import { pod, PodSpec } from "./parse/pod.js";
import { EntriesOutputType, EntriesSpec, entries } from "./parse/entries.js";
import { PodSpec, pod } from "./parse/pod.js";
import { EntriesSchema } from "./schemas/entries.js";
import { PODSchema } from "./schemas/pod.js";
import { InferPodType } from "./type_inference.js";
Expand Down
8 changes: 4 additions & 4 deletions packages/podspec/src/parse/entries.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkPODName, PODEntries, PODValue } from "@pcd/pod";
import { PODEntries, PODValue, checkPODName } from "@pcd/pod";
import {
IssueCode,
PodspecBaseIssue,
Expand Down Expand Up @@ -32,10 +32,10 @@ import { deepFreeze } from "../utils.js";
import { parseEntry } from "./entry.js";
import {
FAILURE,
ParseResult,
PODValueNativeTypes,
safeCheckTuple,
SUCCESS
ParseResult,
SUCCESS,
safeCheckTuple
} from "./parse_utils.js";

const COERCERS: Record<PODValue["type"], (data: unknown) => unknown> = {
Expand Down
10 changes: 5 additions & 5 deletions packages/podspec/src/parse/entry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
checkBigintBounds,
PODCryptographicValue,
PODIntValue
PODIntValue,
checkBigintBounds
} from "@pcd/pod";
import {
IssueCode,
Expand All @@ -12,11 +12,11 @@ import { DefinedEntrySchema } from "../schemas/entry.js";
import { DEFAULT_ENTRIES_PARSE_OPTIONS } from "./entries.js";
import {
FAILURE,
ParseResult,
PODValueTypeNameToPODValue,
ParseResult,
SUCCESS,
safeCheckPODValue,
safeMembershipChecks,
SUCCESS
safeMembershipChecks
} from "./parse_utils.js";

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/podspec/src/parse/parse_utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
checkBigintBounds,
checkPODValue,
checkPublicKeyFormat,
PODCryptographicValue,
PODEdDSAPublicKeyValue,
PODIntValue,
PODStringValue,
PODValue
PODValue,
checkBigintBounds,
checkPODValue,
checkPublicKeyFormat
} from "@pcd/pod";
import {
IssueCode,
Expand Down
4 changes: 2 additions & 2 deletions packages/podspec/src/parse/pod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
import {
FAILURE,
ParseResult,
safeCheckTuple,
SUCCESS
SUCCESS,
safeCheckTuple
} from "./parse_utils.js";

/**
Expand Down
Loading

0 comments on commit 1cd0830

Please sign in to comment.