-
Notifications
You must be signed in to change notification settings - Fork 3
Contribution Guide
Zhang Qixiang edited this page May 14, 2025
·
1 revision
Thank you for your interest in contributing to the Pie interpreter! This guide will help you understand how to contribute effectively to the project.
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- Git
- Fork the repository on GitHub.
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/pie-slang.git cd pie-slang
- Add the original repository as a remote:
git remote add upstream https://github.com/ZhangQixiang123/pie-slang.git
- Install dependencies:
npm install
- Build the project:
npm run build
- Run tests to verify your setup:
npm test
We follow a feature branch workflow:
- Create a new branch for your feature:
git checkout -b feature/your-feature-name
- Make your changes.
- Write tests for your changes.
- Run the tests:
npm test
- Commit your changes with a descriptive commit message.
- Push your branch to your fork:
git push origin feature/your-feature-name
- Create a pull request from your fork to the main repository.
There is no strict standard, these guidelines are for your references.
- Use TypeScript's strict mode.
- Follow the Single Responsibility Principle.
- Keep functions and methods small and focused.
- Use descriptive names for variables, functions, and classes.
- Comment your code where necessary, especially for complex logic.
- Use explicit type annotations for function parameters and return types.
- Prefer interfaces over type aliases for object types.
- Use readonly for immutable properties.
- Use optional parameters and properties where appropriate.
- Use union types instead of enums when possible.
We use Prettier for code formatting. You can format your code with:
npm run format
We use ESLint to catch errors and enforce code quality. Run the linter with:
npm run lint
We use Jest for testing. All code should be covered by tests.
- Tests should be placed in the
__tests__
directory. - Test files should be named
[component].test.ts
. - Use descriptive test names that explain what is being tested.
- Test both successful and error cases.
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run a specific test file
npx jest path/to/test/file.test.ts