#849 [DOC-48] Add contributor style guide for code and documentation … - #921
Merged
Conversation
|
@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! 🚀 |
Contributor
Author
|
@anumukul PLEASE REVIEW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
TypeScript Style Conventions — File structure, indentation/formatting (Prettier), type system preferences, React component patterns, import organization, and error handling approach
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
Comment & Docstring Formats — Detailed conventions for both TypeScript (
//,/** */, TSDoc with@param/@returns/@throws/@example) and Rust (///,//,//!) with real code examples from the codebaseNaming 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
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
Automated Linting Configuration — Tool reference tables linking to actual config files:
frontend/eslint.config.mjs), TypeScript (frontend/tsconfig.json), Prettier (via ESLint)contracts/escrow/Cargo.toml).pre-commit-config.yamlQuick 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-referencedocs/README.md— Added STYLE_GUIDE.md to the Getting Started indexDesign decisions:
titleToBytesN64,resolve_dispute,post_job_with_nonce) to ensure conventions match realityValidation
soroban contract buildandcargo testincontracts/escrow) if contract code changed. — N/A: Documentation only changeAdditional Notes
This is a documentation-only change that creates the style guide referenced in the issue. The guide is designed to be:
No code changes were made — this PR only adds documentation files. Tests continue to pass as before.