-
Notifications
You must be signed in to change notification settings - Fork 16
chore: add prettier for markdown and astro formatting #2153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1f9064d
61a85e4
1bda9d2
38424bf
00ee495
4ed57ff
0cb7c80
ccb76d9
f48ffed
93f67b8
706d5d2
164ef19
9851858
6f039ae
a521ac1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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" }, | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Maybe just Linting?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||||||
|
|
||||||
| 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: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| - 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. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## 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. | ||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we think? I'm not a fan of Format & Lint, or Formatting & Linting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lightwalker-eth