Skip to content

#849 [DOC-48] Add contributor style guide for code and documentation … - #921

Merged
anumukul merged 1 commit into
anumukul:mainfrom
solidsole:#849--DOC-48]-Add-contributor-style-guide-for-code-and-documentation-FIX
Sep 4, 2026
Merged

#849 [DOC-48] Add contributor style guide for code and documentation …#921
anumukul merged 1 commit into
anumukul:mainfrom
solidsole:#849--DOC-48]-Add-contributor-style-guide-for-code-and-documentation-FIX

Conversation

@solidsole

Copy link
Copy Markdown
Contributor

Closes #849

What Changed

Created a new comprehensive style guide document (docs/STYLE_GUIDE.md) that consolidates all code, comment, and documentation conventions into a single reference. This addresses the inconsistency between contributors by providing clear, enforceable guidelines.

Key additions:

  1. TypeScript Style Conventions — File structure, indentation/formatting (Prettier), type system preferences, React component patterns, import organization, and error handling approach

  2. Rust Style Conventions — rustfmt/clippy enforcement, naming conventions (PascalCase for types, snake_case for functions/variables, SCREAMING_SNAKE_CASE for constants), documentation requirements for public functions, error handling patterns, testing requirements, and attribute usage

  3. Comment & Docstring Formats — Detailed conventions for both TypeScript (//, /** */, TSDoc with @param/@returns/@throws/@example) and Rust (///, //, //!) with real code examples from the codebase

  4. Naming Conventions — Comprehensive tables for TypeScript/React (PascalCase components, camelCase functions, UPPER_SNAKE_CASE constants) and Rust/Soroban (snake_case contract functions, PascalCase types, SCREAMING_SNAKE_CASE constants) with examples

  5. Commit Message Guidelines — Conventional Commits format with complete type table (feat, fix, docs, style, refactor, test, chore, ci, build, perf, revert), scope table, description rules (imperative mood, lowercase, no period, <72 chars), and good/bad examples

  6. Automated Linting Configuration — Tool reference tables linking to actual config files:

    • Frontend: ESLint (frontend/eslint.config.mjs), TypeScript (frontend/tsconfig.json), Prettier (via ESLint)
    • Rust: rustfmt, clippy, cargo test (contracts/escrow/Cargo.toml)
    • Pre-commit hooks table from .pre-commit-config.yaml
    • CI enforcement details
  7. Quick Reference — Side-by-side comparison table of conventions across TypeScript and Rust

Documentation updates:

  • CONTRIBUTING.md — Added "Style Guide" subsection under Coding Standards with cross-reference
  • docs/README.md — Added STYLE_GUIDE.md to the Getting Started index

Design decisions:

  • Used actual code examples from the existing codebase (e.g., titleToBytesN64, resolve_dispute, post_job_with_nonce) to ensure conventions match reality
  • Cross-referenced existing documents (PR Title Conventions, CONTRIBUTING.md, eslint.config.mjs, pre-commit-config.yaml) rather than duplicating content
  • Followed the existing documentation style (Markdown tables, code blocks, section headers matching other docs)

Validation

  • I referenced the related issue in this PR.
  • Contract checks pass (soroban contract build and cargo test in contracts/escrow) if contract code changed. — N/A: Documentation only change
  • Frontend checks/build pass for changed frontend files. — N/A: Documentation only change
  • I included screenshots or short clips for UI changes (or noted N/A). — N/A: No UI changes
  • I verified the UI changes in the preview deployment. — N/A: No UI changes

Additional Notes

This is a documentation-only change that creates the style guide referenced in the issue. The guide is designed to be:

  • Enforceable: Links to automated linting configuration (ESLint, rustfmt, clippy, pre-commit hooks) so conventions can be checked in CI
  • Discoverable: Added to both CONTRIBUTING.md and docs/README.md for easy findability
  • Practical: All examples are drawn from actual code in the repository to avoid prescriptive rules that don't match reality
  • Maintainable: Clear section structure that can be updated independently as conventions evolve

No code changes were made — this PR only adds documentation files. Tests continue to pass as before.

@drips-wave

drips-wave Bot commented Sep 2, 2026

Copy link
Copy Markdown

@solidsole Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@solidsole

Copy link
Copy Markdown
Contributor Author

@anumukul PLEASE REVIEW

@anumukul
anumukul merged commit 2a16621 into anumukul:main Sep 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC-48] Add contributor style guide for code and documentation

2 participants