From 080e678e4f36c0ddb0cb8c67bfccbba35a80d90e Mon Sep 17 00:00:00 2001 From: tiago <70700766+tiagozip@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:52:55 +0100 Subject: [PATCH] contributing!! --- CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ biome.json | 18 ++++++++++++++++++ demo/solver/README.md | 2 +- solver/index.js | 10 +++++----- 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 biome.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..32c0d94 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing + +Thanks for your interest in contributing to Cap! + +## Ways to help + +- Report bugs by opening issues. +- Suggest features with clear use cases. +- Improve docs or add examples. +- Submit pull requests. + +## Development setup + +**Notes**: + +- You need to have the latest release version of [Bun](https://bun.com/) installed. For WASM, Rust is also required. + +- VSCode is the recommended IDE for working on Cap. + +- Put new docs in `docs/guide` and make sure to update the sidebar in `docs/.vitepress/config.mjs`, not scattered in subfolders. + +Run `bun install` in each package you want to work on. + +## Guidelines + +- Formatting uses [Biome](https://biomejs.dev/). Make sure there are no warnings or errors before submitting a PR. + +- Keep PRs small and focused. + +- We prefer conventional commits, but they are not enforced. See [here](https://www.conventionalcommits.org/en/v1.0.0/) for reference. + +- Avoid excessive duplication of code or code comments. + +- No AI-generated code please! AI autocomplete is fine, but not fully AI code. If you submit AI-generated code without making it clear, it may be rejected. + +- Don't edit type files directly, they're auto-generated from JSDoc comments. + +- For optimizations, please always publish a benchmark of the before/after difference before submitting a PR, ideally including your device specs. RAM/CPU usage is also appreciated. + +Maintainers may reject PRs at their discretion if they don't follow these guidelines or don't align with the project's goals. + +Please also read our [code of conduct](CODE_OF_CONDUCT.md). diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..6299ea8 --- /dev/null +++ b/biome.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.1.2/schema.json", + "formatter": { + "indentStyle": "space", + "indentWidth": 2 + }, + "linter": { + "enabled": true, + "rules": { + "style": { + "useConst": "error" + }, + "correctness": { + "noUnusedVariables": "error" + } + } + } +} diff --git a/demo/solver/README.md b/demo/solver/README.md index 3d2fb84..f103a45 100644 --- a/demo/solver/README.md +++ b/demo/solver/README.md @@ -12,4 +12,4 @@ To run: bun run index.js ``` -This project was created using `bun init` in bun v1.2.9. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. +This project was created using `bun init` in bun v1.2.9. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime. diff --git a/solver/index.js b/solver/index.js index 4c9cb8f..7c44ab7 100644 --- a/solver/index.js +++ b/solver/index.js @@ -1,5 +1,5 @@ -import { Worker } from "worker_threads"; -import os from "os"; +import os from "node:os"; +import { Worker } from "node:worker_threads"; function prng(seed, length) { function fnv1a(str) { @@ -61,7 +61,7 @@ try { ], { type: "application/typescript", - } + }, ); const workerUrl = URL.createObjectURL(workerBlob); @@ -114,7 +114,7 @@ export default function solve(challenge, config = {}) { if (result.error) { console.error( `Error in worker for challenge ${currentChallengeIndex}:`, - result.error + result.error, ); reject(new Error(`Worker error: ${result.error}`)); return; @@ -126,7 +126,7 @@ export default function solve(challenge, config = {}) { if (config?.onProgress) { config.onProgress({ progress: Math.floor( - (challengesProcessed / totalChallenges) * 100 + (challengesProcessed / totalChallenges) * 100, ), currentChallenge: currentChallengeIndex, challengesProcessed,