Skip to content
Open
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
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dependencies and build output (prettier ignores node_modules by default; listed for clarity)
node_modules
dist
build
.next
.astro
.ponder
generated

# Lockfiles
pnpm-lock.yaml

# Generated changelogs — owned by changesets, do not reformat
**/CHANGELOG.md
15 changes: 15 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"printWidth": 100,
"proseWrap": "preserve",
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro",
"bracketSameLine": true,
"astroSkipFrontmatter": true
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const referenceSidebarTopic = {
link: "/docs/reference/contributing/building",
},
{ label: "Creating a Release", link: "/docs/reference/contributing/releases" },
{ label: "Format & Lint", link: "/docs/reference/contributing/formatting" },
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ label: "Format & Lint", link: "/docs/reference/contributing/formatting" },
{ label: "Formatting", link: "/docs/reference/contributing/formatting" },

What do we think? I'm not a fan of Format & Lint, or Formatting & Linting.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ label: "Format & Lint", link: "/docs/reference/contributing/formatting" },
{ label: "Linting", link: "/docs/reference/contributing/formatting" },

Maybe just Linting?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@notrab Hmm good question. I'm happy to go with either "Formatting" or "Linting". Whatever you think is best 👍

Or maybe "Code Standards" which will then be an umbrella home to where we can grow this page more and more over time with related ideas.

{
label: "REST API Documentation",
link: "/docs/reference/contributing/rest-api-docs",
Expand Down
4 changes: 4 additions & 0 deletions docs/ensnode.io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"astro": "astro",
"lint": "biome check --write",
"lint:ci": "biome ci",
"lint:prettier": "prettier --write \"**/*.astro\"",
"lint:prettier:ci": "prettier --check \"**/*.astro\"",
"omnigraph-examples:refresh-responses": "tsx --tsconfig tsconfig.json scripts/fetch-omnigraph-example-responses.mts",
"omnigraph:snapshot": "tsx --tsconfig tsconfig.json scripts/snapshot-omnigraph-version.mts",
"test": "vitest",
Expand Down Expand Up @@ -57,6 +59,8 @@
"devDependencies": {
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"prettier": "catalog:",
"prettier-plugin-astro": "catalog:",
"tsx": "^4.19.3",
"vitest": "catalog:"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Formatting with Biome and Prettier
sidebar:
label: Formatting
order: 6
---

We use Biome to format most of the codebase, and Prettier to cover the rest:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We use Biome to format most of the codebase, and Prettier to cover the rest:
We use Biome to format most of the code in the ENSNode monorepo, and Prettier to cover the rest:


- Biome handles JS, TS, JSON, CSS, and the frontmatter of `.astro` files.
- Prettier handles Markdown (`.md` and `.mdx`) across the repo, and the template portion of `.astro` files in `docs/ensnode.io` and `docs/ensrainbow.io` via [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro). The `astroSkipFrontmatter: true` option keeps the frontmatter under Biome's ownership.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Prettier handles Markdown (`.md` and `.mdx`) across the repo, and the template portion of `.astro` files in `docs/ensnode.io` and `docs/ensrainbow.io` via [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro). The `astroSkipFrontmatter: true` option keeps the frontmatter under Biome's ownership.
- Prettier handles Markdown (`.md` and `.mdx`) across the monorepo, and the template portion of `.astro` files in `docs/ensnode.io` and `docs/ensrainbow.io` via [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro). The `astroSkipFrontmatter: true` option keeps the frontmatter under Biome's ownership.


## Running the formatters

From the monorepo root:

```bash
pnpm lint
```

CI runs `pnpm lint:ci` (check-only) on every PR.

## Windows: line-ending diffs

Git on Windows checks files out with CRLF (`\r\n`) line endings by default. Biome and Prettier write LF (`\n`). After `pnpm lint`, files may appear modified, but Git normalizes the endings back to LF when staging, so nothing changes in the resulting commit.

To clear the noise from your working tree:

- One-off: run `git add --all`. The index normalizes the endings and the files drop out of `git status`.
- Permanent: run `git config --global core.autocrlf input`, then `git checkout -- .`. Your working tree converts to LF and future checkouts keep it that way.
8 changes: 6 additions & 2 deletions docs/ensrainbow.io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"preview": "astro preview",
"astro": "astro",
"lint": "biome check --write .",
"lint:ci": "biome ci"
"lint:ci": "biome ci",
Comment thread
notrab marked this conversation as resolved.
Comment thread
notrab marked this conversation as resolved.
Comment thread
notrab marked this conversation as resolved.
"lint:prettier": "prettier --write \"**/*.astro\"",
"lint:prettier:ci": "prettier --check \"**/*.astro\""
Comment thread
coderabbitai[bot] marked this conversation as resolved.
},
"dependencies": {
"@astrojs/react": "catalog:",
Expand All @@ -30,6 +32,8 @@
},
"devDependencies": {
"@types/react": "catalog:",
"@types/react-dom": "catalog:"
"@types/react-dom": "catalog:",
"prettier": "catalog:",
"prettier-plugin-astro": "catalog:"
}
}
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
"private": true,
"packageManager": "pnpm@10.33.0",
"scripts": {
"lint": "biome check --write .",
"lint:ci": "biome ci",
"lint": "pnpm run lint:biome && pnpm run lint:prettier",
"lint:ci": "pnpm run lint:biome:ci && pnpm run lint:prettier:ci",
"lint:prettier": "pnpm exec prettier --write \"**/*.{md,mdx}\" && pnpm -r lint:prettier",
Comment thread
notrab marked this conversation as resolved.
"lint:prettier:ci": "pnpm exec prettier --check \"**/*.{md,mdx}\" && pnpm -r lint:prettier:ci",
Comment thread
notrab marked this conversation as resolved.
"lint:biome": "biome check --write .",
"lint:biome:ci": "biome ci",
Comment thread
notrab marked this conversation as resolved.
"test": "vitest --silent passed-only",
"test:integration": "vitest --config vitest.integration.config.ts --silent passed-only",
"test:integration:ci": "pnpm -F @ensnode/integration-test-env start:ci",
Expand Down Expand Up @@ -36,6 +40,8 @@
"@changesets/cli": "^2.29.8",
"@typescript/native-preview": "7.0.0-dev.20260128.1",
"jsdom": "^27.0.1",
"prettier": "catalog:",
"prettier-plugin-astro": "catalog:",
"tsup": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
Expand Down
68 changes: 61 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ catalog:
pino: 10.1.0
ponder: 0.16.6
postcss: 8.5.12
prettier: 3.6.2
prettier-plugin-astro: 0.14.1
react: 19.2.1
react-dom: 19.2.1
tailwind-merge: ^3.4.0
Expand Down
Loading