Contributing
Contributing to AstroChart
Section titled “Contributing to AstroChart”We welcome contributions of all kinds — bug reports, feature requests, documentation improvements, and code changes. This page explains how to get started.
Getting Started
Section titled “Getting Started”- Fork the repository on GitHub
- Clone your fork locally
- Create a branch for your feature or bugfix (see branch naming below)
- Make your changes and test thoroughly
- Submit a pull request with a clear description
Development Setup
Section titled “Development Setup”git clone https://github.com/YOUR_USERNAME/AstroChart.gitcd AstroChartnpm ci # install exact dependency versionsnpm run build # compile TypeScript → dist/astrochart.jsnpm test # run the full test suiteNode version: Use Node 24. If
npmcommands fail, runnvm use 24first.
Testing
Section titled “Testing”npm test # run all testsnpm run test:coverage # run tests with coverage reportnpx jest project/src/utils.test.ts # run a single test fileTests are co-located with source files (foo.test.ts lives next to foo.ts). Use describe/test (not it), prefer toStrictEqual, and never commit .only.
Website Development
Section titled “Website Development”The documentation website lives in the website/ sub-directory and is a completely separate project built with Astro + Starlight.
Running the dev server
Section titled “Running the dev server”cd websitenpm cinpm run devThe site will be available at http://localhost:4321.
Website stack
Section titled “Website stack”- Astro — static site builder
- Starlight — documentation theme for Astro
- MDX — use
.mdxextension (not.md) for any content page that imports and uses components - Content lives in
website/src/content/docs/
Isolation rule
Section titled “Isolation rule”website/ must never affect the library build or tests. If you add any new sub-directory at the repo root, add it to both:
- the
excludelist in the roottsconfig.json - the
excluderegex inwebpack.config.js
After any structural change, verify isolation by running npm run build and npm test from the repo root.
Code Style
Section titled “Code Style”The project follows these conventions (enforced by ESLint):
| Rule | Value |
|---|---|
| Indentation | 2 spaces |
| Quotes | Single quotes ' |
| Semicolons | None |
| Line endings | Unix (LF) |
| Trailing commas | None |
var keyword | Never — use const or let |
Additional conventions:
- Class methods have a space before the parameter list:
radix (data: AstroData) { - Standalone functions use arrow-function exports:
export const fn = (...) => { ... } - Naming: Classes/interfaces PascalCase · methods/variables camelCase · settings keys UPPER_SNAKE_CASE · files lowercase single-word
- Imports: default imports for classes, named imports for functions,
import typefor type-only; relative./paths, no extensions - Errors: throw plain
Error('descriptive message')— no custom error classes - Null checks: use loose equality
== null(catches bothnullandundefined) - JSDoc: add
@paramand@returntags on all public methods and classes
Run the linter before committing:
npm run lintBug Reports
Section titled “Bug Reports”When reporting bugs, please include:
- A clear description of the issue
- Steps to reproduce
- Expected vs. actual behavior
- Browser and version information
- A minimal code example if possible
Feature Requests
Section titled “Feature Requests”Feature requests are welcome! Please describe:
- The desired behavior
- Your use case
- Why this would be valuable for other users
- Any alternative solutions you have considered
Submitting a PR
Section titled “Submitting a PR”Branch naming
Section titled “Branch naming”| Type | Pattern | Example |
|---|---|---|
| Bug fix | fix/<short-description> | fix/collision-radius-scaling |
| Feature | feat/<short-description> | feat/sextile-aspect-support |
| Documentation | docs/<short-description> | docs/vue-integration-guide |
| Chore / refactor | chore/<short-description> | chore/update-jest |
What to include in the PR description
Section titled “What to include in the PR description”- What the change does
- Why it is needed (link to the related issue if one exists)
- How to test it (steps or test file)
- Screenshots for any visual / chart-rendering changes
Checklist before opening a PR
Section titled “Checklist before opening a PR”-
npm run lintpasses with no errors -
npm testpasses with no failures -
npm run buildproduces a cleandist/astrochart.js - New behaviour is covered by a test
- Public API is unchanged (this is a production library — breaking changes require a major version bump and a migration guide)
Questions?
Section titled “Questions?”- Open an issue on GitHub
- Review existing issues for similar questions
License
Section titled “License”By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for making AstroChart better! 🙌