Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"jsxSingleQuote": false,
"quoteProps": "preserve",
"trailingComma": "none",
"arrowParens": "always",
"experimentalOperatorPosition": "start",
"proseWrap": "preserve",
"sortPackageJson": false,
"ignorePatterns": [
"**/dist",
"**/build",
"**/docs",
"**/coverage",
"contracts/**",
"packages/amp/src/protobuf/**",
"*.yml",
"*.yaml",
"*.toml",
"*.css",
"*.html",
"*.jsonc"
]
}
8 changes: 2 additions & 6 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
// See related issue: https://github.com/oxc-project/oxc/issues/13204
"packages/amp/src/protobuf/**/*"
],
"jsPlugins": [
"@amp/oxc/oxlint"
],
"jsPlugins": ["@amp/oxc/oxlint"],
"overrides": [
{
"files": [
"**/{test,dtslint,examples,benchmark,bundle,scripts,scratchpad}/**"
],
"files": ["**/{test,dtslint,examples,benchmark,bundle,scripts,scratchpad}/**"],
"rules": {
"eslint/no-console": "off",
"effect/no-import-from-barrel-package": "off"
Expand Down
2 changes: 1 addition & 1 deletion .rulesync/commands/review-pr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: 'Review a pull request'
description: "Review a pull request"
targets: ["*"]
---

Expand Down
44 changes: 21 additions & 23 deletions .rulesync/rules/effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ import { Effect, Schema, Stream } from "effect"
Define services with `Context.Tag`:

```typescript
class MyService extends Context.Tag("Amp/MyService")<MyService, {
readonly doSomething: (input: string) => Effect.Effect<Result, MyError>
}>() {}
class MyService extends Context.Tag("Amp/MyService")<
MyService,
{
readonly doSomething: (input: string) => Effect.Effect<Result, MyError>
}
>() {}
```

Access services in generators with `yield*`:

```typescript
Effect.gen(function*() {
Effect.gen(function* () {
const svc = yield* MyService
return yield* svc.doSomething("input")
})
Expand All @@ -63,13 +66,15 @@ Multiple `Effect.provide` calls each wrap the effect in another layer of indirec

```typescript
// Bad — repeated provide calls
Effect.runPromise(program.pipe(
Effect.provide(TransactionalStream.layer),
Effect.provide(InMemoryStateStore.layer),
Effect.provide(ProtocolStream.layer),
Effect.provide(ArrowFlight.layer),
Effect.provide(Transport.layer)
))
Effect.runPromise(
program.pipe(
Effect.provide(TransactionalStream.layer),
Effect.provide(InMemoryStateStore.layer),
Effect.provide(ProtocolStream.layer),
Effect.provide(ArrowFlight.layer),
Effect.provide(Transport.layer)
)
)

// Good — compose first, provide once
const AppLayer = TransactionalStream.layer.pipe(
Expand All @@ -89,22 +94,19 @@ Wrapping `Effect.gen` in an arrow function allocates a new generator on every ca
```typescript
// Bad — allocates a generator per invocation
const query = (sql: string) =>
Effect.gen(function*() {
Effect.gen(function* () {
const svc = yield* ArrowFlight
return yield* svc.query(sql)
})

// Good
const query = Effect.fn("query")(function*(sql: string) {
const query = Effect.fn("query")(function* (sql: string) {
const svc = yield* ArrowFlight
return yield* svc.query(sql)
})

// With explicit return type annotation
const query = Effect.fn("query")(function*(sql: string): Effect.fn.Return<
QueryResult,
ArrowFlightError
> {
const query = Effect.fn("query")(function* (sql: string): Effect.fn.Return<QueryResult, ArrowFlightError> {
const svc = yield* ArrowFlight
return yield* svc.query(sql)
})
Expand All @@ -115,9 +117,7 @@ const query = Effect.fn("query")(function*(sql: string): Effect.fn.Return<
Use `Schema.brand` for domain primitives:

```typescript
export const Network = Schema.Lowercase.pipe(
Schema.brand("Amp/Models/Network")
).annotations({ identifier: "Network" })
export const Network = Schema.Lowercase.pipe(Schema.brand("Amp/Models/Network")).annotations({ identifier: "Network" })
export type Network = typeof Network.Type
```

Expand All @@ -126,9 +126,7 @@ export type Network = typeof Network.Type
Use `Schema.TaggedError` for typed, serializable errors:

```typescript
export class MyError extends Schema.TaggedError<MyError>(
"Amp/MyError"
)("MyError", {
export class MyError extends Schema.TaggedError<MyError>("Amp/MyError")("MyError", {
cause: Schema.Defect
}) {}
```
6 changes: 3 additions & 3 deletions .rulesync/rules/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ Each public module has a **root-level barrel `.ts` file** in `src/` that re-expo
```bash
pnpm check # Type check root project
pnpm check:recursive # Type check all packages
pnpm lint # Check with oxlint + dprint
pnpm lint:fix # Auto-fix with oxlint + dprint
pnpm lint # Check with oxlint + oxfmt
pnpm lint:fix # Auto-fix with oxlint + oxfmt
pnpm test # Run all tests (vitest)
pnpm vitest run <file> # Single test file
pnpm build # Full build (tsc + babel)
```

## Code Style

- **Formatter**: dprint — no semicolons (ASI), double quotes, no trailing commas, 120 char line width
- **Formatter**: oxfmt — no semicolons (ASI), double quotes, no trailing commas, 120 char line width
- **Linter**: oxlint with custom `@amp/oxc` plugin
- **Array syntax**: `Array<T>` and `ReadonlyArray<T>`, never `T[]` (enforced by `typescript/array-type`)
- **Effect imports**: Always namespace imports from subpaths — `import * as Effect from "effect/Effect"`, never `from "effect"`
Expand Down
5 changes: 1 addition & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"oxc.oxc-vscode",
"dprint.dprint"
]
"recommendations": ["oxc.oxc-vscode"]
}
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"dprint.path": "node_modules/.bin/dprint",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "dprint.dprint",
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSaveMode": "file",
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "explicit"
Expand Down
29 changes: 0 additions & 29 deletions dprint.json

This file was deleted.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"type": "module",
"packageManager": "pnpm@11.8.0+sha512.c1f5e7c4cb241c8f174b743851d82f42b802324afc8b0f116b96adb15aa06664948dde36960a3ba1079ba5b4b29dd0140135b94b5b5f5263592249d68e555f26",
"packageManager": "pnpm@12.6.0+sha512.3ef68f951cb111ac204b4a5a16f0b2ddf0da56a96e0413e81d855d9f0b55ef926714709028e1cd00c405c2c5fb7b9e8ec4dc46777c805d0373c2f2ff00fd20ec",
"scripts": {
"prepare": "effect-language-service patch",
"build": "tspc -b tsconfig.packages.json && pnpm --recursive --parallel --filter \"./packages/**/*\" run build",
Expand All @@ -11,31 +11,31 @@
"check:recursive": "pnpm --recursive --filter \"./packages/**/*\" exec tspc -b tsconfig.json",
"circular": "node scripts/circular.mjs",
"clean": "node scripts/clean.mjs",
"lint": "oxlint && dprint check",
"lint:fix": "oxlint --fix && dprint fmt",
"lint": "oxlint && oxfmt --check",
"lint:fix": "oxlint --fix && oxfmt",
"test": "vitest"
},
"devDependencies": {
"@amp/oxc": "workspace:^",
"@babel/cli": "^8.0.1",
"@babel/core": "^8.0.1",
"@babel/cli": "^8.0.6",
"@babel/core": "^8.0.6",
"@babel/plugin-transform-export-namespace-from": "^8.0.1",
"@babel/plugin-transform-modules-commonjs": "^8.0.1",
"@effect/language-service": "catalog:",
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"@typescript/native-preview": "7.0.0-dev.20260130.1",
"@typescript/native-preview": "7.0.0-dev.20260707.2",
"@vitest/coverage-v8": "catalog:",
"@vitest/ui": "catalog:",
"babel-plugin-annotate-pure-calls": "^0.5.0",
"dprint": "^0.54.0",
"glob": "^13.0.6",
"globals": "^17.7.0",
"globals": "^17.12.0",
"madge": "^8.0.0",
"oxlint": "^1.71.0",
"rulesync": "^8.31.0",
"oxfmt": "^0.70.0",
"oxlint": "^1.85.0",
"rulesync": "^19.0.0",
"ts-patch": "^4.0.1",
"typescript": "^6.0.3",
"typescript": "^7.0.2",
"vite-tsconfig-paths": "^6.1.1",
"vitest": "catalog:",
"vitest-mock-express": "^2.2.0"
Expand Down
20 changes: 10 additions & 10 deletions packages/amp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@edgeandnode/amp",
"version": "0.0.51",
"version": "0.0.52",
"type": "module",
"license": "BUSL-1.1",
"description": "Build and manage blockchain datasets.",
Expand Down Expand Up @@ -42,22 +42,22 @@
"coverage": "vitest --coverage"
},
"peerDependencies": {
"@bufbuild/protobuf": "^2.12.1",
"@connectrpc/connect": "^2.1.2",
"@connectrpc/connect-node": "^2.1.2",
"@bufbuild/protobuf": "^2.15.0",
"@connectrpc/connect": "^2.2.0",
"@connectrpc/connect-node": "^2.2.0",
"effect": "catalog:"
},
"devDependencies": {
"@bufbuild/buf": "^1.71.0",
"@bufbuild/protobuf": "^2.12.1",
"@bufbuild/protoc-gen-es": "^2.12.1",
"@connectrpc/connect": "^2.1.2",
"@connectrpc/connect-node": "^2.1.2",
"@bufbuild/buf": "^1.73.0",
"@bufbuild/protobuf": "^2.15.0",
"@bufbuild/protoc-gen-es": "^2.15.0",
"@connectrpc/connect": "^2.2.0",
"@connectrpc/connect-node": "^2.2.0",
"effect": "catalog:"
},
"dependencies": {
"jiti": "^2.7.0",
"jose": "^6.2.3",
"jose": "^6.2.12",
"viem": "catalog:"
}
}
Loading
Loading