Skip to main content
Thank you for your interest in contributing to Snapshot X! This guide covers the conventions and workflows for contributing to the project.

Code Conventions

TypeScript

  • Use TypeScript whenever possible
  • Avoid using any type
  • Ensure all code passes type checking before submitting
yarn typecheck

Code Style

The project uses ESLint and Prettier for code quality:
  • ESLint: @snapshot-labs config (Vue variant for UI)
  • Prettier: @snapshot-labs/prettier-config
yarn lint
CI will reject pull requests that have lint or type check failures. Always run these commands before committing.

Error Handling

Name errors in catch blocks as err:
try {
  // some code
} catch (err) {
  console.error(err);
}

Code Reuse

Before writing new logic:
  1. Check existing helpers in the codebase
  2. Review composables (for Vue components)
  3. Look for utility functions that might already solve your problem
Reusing existing code helps maintain consistency and reduces duplication.

Running Tests

Ensure all tests pass before submitting a pull request:
1

Unit Tests

Run all unit tests across packages:
yarn test
2

Integration Tests

Run integration tests:
yarn test:integration
3

E2E Tests

Run end-to-end tests using Playwright:
yarn test:e2e
CI runs all tests automatically on every pull request. All tests must pass before merging.

Versioning with Changesets

Snapshot X uses changesets for versioning packages, particularly for sx.js.

Creating a Changeset

When you make changes to versioned packages:
1

Generate Changeset

Run the changeset command:
yarn changeset
2

Select Package

Choose which package(s) you modified (e.g., sx.js).
3

Choose Version Bump

Specify the version bump following semver:
  • Major: Breaking changes
  • Minor: New features (backward compatible)
  • Patch: Bug fixes
4

Write Description

Provide a clear description of your changes.
5

Commit Generated Files

Commit the generated changeset files in your PR:
git add .changeset/
git commit -m "Add changeset for feature X"

Release Process

Once your PR is merged:
  1. Changesets action creates a release PR automatically
  2. Maintainers merge the release PR to publish packages

Pull Request Guidelines

Before Submitting

Ensure your PR meets these requirements:
1

Code Quality

  • All lint checks pass (yarn lint)
  • All type checks pass (yarn typecheck)
  • All tests pass (yarn test)
2

Documentation

  • Update relevant documentation
  • Add comments for complex logic
  • Update README if adding new features
3

Changesets

  • Add changeset if modifying sx.js or other published packages

PR Description

Provide a clear description including:
  • What: Summary of changes
  • Why: Reason for the changes
  • How: Approach taken (if non-obvious)
  • Testing: How you tested the changes

Commit Messages

Write clear, concise commit messages:
# Good
fix: resolve voting power calculation for staked tokens
add: support for cross-chain governance proposals
refactor: simplify space creation flow

# Avoid
fixed stuff
update
changes

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting
  5. Create changeset if needed
  6. Commit your changes
  7. Push to your fork
  8. Open a pull request

Getting Help

Code of Conduct

Be respectful and constructive in all interactions. We’re building together as a community.

Build docs developers (and LLMs) love