Skip to content

Contributing

We welcome contributions of all kinds — bug reports, feature requests, documentation improvements, and code changes. This page explains how to get started.


  1. Fork the repository on GitHub
  2. Clone your fork locally
  3. Create a branch for your feature or bugfix (see branch naming below)
  4. Make your changes and test thoroughly
  5. Submit a pull request with a clear description

Terminal window
git clone https://github.com/YOUR_USERNAME/AstroChart.git
cd AstroChart
npm ci # install exact dependency versions
npm run build # compile TypeScript → dist/astrochart.js
npm test # run the full test suite

Node version: Use Node 24. If npm commands fail, run nvm use 24 first.


Terminal window
npm test # run all tests
npm run test:coverage # run tests with coverage report
npx jest project/src/utils.test.ts # run a single test file

Tests 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.


The documentation website lives in the website/ sub-directory and is a completely separate project built with Astro + Starlight.

Terminal window
cd website
npm ci
npm run dev

The site will be available at http://localhost:4321.

  • Astro — static site builder
  • Starlight — documentation theme for Astro
  • MDX — use .mdx extension (not .md) for any content page that imports and uses components
  • Content lives in website/src/content/docs/

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 exclude list in the root tsconfig.json
  • the exclude regex in webpack.config.js

After any structural change, verify isolation by running npm run build and npm test from the repo root.


The project follows these conventions (enforced by ESLint):

RuleValue
Indentation2 spaces
QuotesSingle quotes '
SemicolonsNone
Line endingsUnix (LF)
Trailing commasNone
var keywordNever — 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 type for type-only; relative ./ paths, no extensions
  • Errors: throw plain Error('descriptive message') — no custom error classes
  • Null checks: use loose equality == null (catches both null and undefined)
  • JSDoc: add @param and @return tags on all public methods and classes

Run the linter before committing:

Terminal window
npm run lint

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 are welcome! Please describe:

  • The desired behavior
  • Your use case
  • Why this would be valuable for other users
  • Any alternative solutions you have considered

TypePatternExample
Bug fixfix/<short-description>fix/collision-radius-scaling
Featurefeat/<short-description>feat/sextile-aspect-support
Documentationdocs/<short-description>docs/vue-integration-guide
Chore / refactorchore/<short-description>chore/update-jest
  • 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
  • npm run lint passes with no errors
  • npm test passes with no failures
  • npm run build produces a clean dist/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)

  • Open an issue on GitHub
  • Review existing issues for similar questions

By contributing, you agree that your contributions will be licensed under the MIT License.

Thank you for making AstroChart better! 🙌