Skip to content
Closed
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
23 changes: 23 additions & 0 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint and Format Check

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
check:
name: Check code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: bun install

- name: Check code quality
run: bun run lint
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,21 @@ Export a static HTML version of the specification when your changes are done wit
In general, Community Group Draft Reports do not follow the same strict conventions as more mature specifications. We only archive major versions of the specification. For example, a copy of the [2021-03-17 draft report](https://github.com/WICG/webmonetization/tree/main/src/pages/specification/versions/CG-DRAFT-web-monetization-20210317.html) currently lives in [src/pages/specification/versions/](https://github.com/WICG/webmonetization/tree/main/src/pages/specification/versions).

Prettier is disabled on `src/pages/specification` as it conflicts with the code format style used by W3C specifications. There is [no way](https://github.com/prettier/prettier/issues/5246) to configure Prettier to follow the [W3C recommendation](https://github.com/validator/validator/wiki/Markup-%C2%BB-Void-elements) of not using trailing slashes on void elements.

## Code Quality

We use ESLint to keep the codebase consistent. Before submitting a pull request, please make sure your changes pass linting:

```sh
bun run lint
```

If ESLint finds issues that can be automatically fixed, you can run:

```sh
bun run lint:fix
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here - format and lint for consistency


This will fix most formatting and style issues automatically. Any remaining issues will need to be fixed manually.

Note that some files in `public/interactive-examples/` may have warnings for unused variables. These are intentional and can be ignored - they're example files that demonstrate different usage patterns.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ All commands are run from the root of the project, from a terminal:
| `bun run start` | Starts local dev server at `localhost:1100` |
| `bun run build` | Build your production site to `./dist/` |
| `bun run preview` | Preview your build locally before deploying |
| `bun run format` | Fix linting and formatting issues |
| `bun run lint` | Check code for linting errors |
| `bun run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `bun run astro -- --help` | Get help using the Astro CLI |

You can substitute the bun commands with your chosen package manager's commands.

### Code Formatting

This project uses [Biome](https://biomejs.dev/), [Prettier](https://prettier.io/), and [ESLint](https://eslint.org/) for code formatting and linting. Before submitting a pull request, please ensure your code passes linting:

1. **Fix issues**: Run `bun run format` to automatically fix linting and formatting issues
2. **Check before pushing**: Run `bun run lint` to verify everything passes (CI will also run this)

## Specification Development

Please refer to the [CONTRIBUTING.md](./CONTRIBUTING.md#specification-development).
Expand Down
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export default defineConfig({
'/docs/resources/libraries': '/developers/libraries',
'/docs/resources/op-wallets': '/wallets',
'/docs/resources/get-involved': '/resources/get-involved',
'/install': '/supporters'
'/install': '/supporters',
},
server: {
port: 1100,
Expand Down
49 changes: 49 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.7/schema.json",
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "none",
"jsxQuoteStyle": "single"
}
},
"files": {
"includes": [
"**/*.astro",
"**/*.{js,jsx,ts,tsx,json}",
"!**/node_modules",
"!**/dist",
"!**/.astro",
"!**/*.mdx"
]
},
"overrides": [
{
"includes": ["**/*.astro"],
"formatter": {
"enabled": true
},
"linter": {
"rules": {
"correctness": {
"noUnusedImports": "off",
"noUnusedVariables": "off"
}
}
}
}
]
}
Loading
Loading