Skip to content

Development

Samuel Ping edited this page May 12, 2021 · 3 revisions

Development

General

The general process for contributing to Sledge is as follows:

  1. You have been assigned to work on a feature.
  2. Create and checkout a new branch for your feature.
  3. Make your changes to the code.
  4. Write a test for your changes, if applicable.
  5. Run npm run lint to run ESLint and see what changes you need to make.
    • Note: To test a specific file, you can run npx eslint <your file>.
  6. Run npm test to test your code.
  7. If everything looks good, push your changes to your branch.
  8. When you're done making changes, in GitHub, make a pull request to merge your branch into env/dev.
  9. Notify and wait for someone to review your code (usually project lead).
  10. If they request changes, repeat steps 3-7.
  • Note: Your pull request will automatically be updated with your new changes on your branch.
  1. If not, they'll approve merge your changes!

Notes:

  • Getting the latest changes from the repository's main branch (env/dev)
    • To get the latest changes, you need to first pull the changes from GitHub, then merge them into your own branch. To do so:
      1. git checkout env/dev: Move to env/dev branch.
      2. git pull origin env/dev: Pull latest changes on this branch from GitHub.
      3. git checkout <your branch>: Move to your branch.
      4. git merge --no-ff env/dev: Merge the changes from env/dev into your branch.
      5. If you get any merge conflicts, be sure to fully resolve them!
  • If you have any questions or issues, do not hesitate to reach out and ask your project lead!

Linting and Formatting

We use ESLint and Prettier to automatically format and lint our code. At the moment, we follow Airbnb's JavaScript Style Guide.

Linting Commands

  • To run ESLint, run npm run lint.
  • To run ESLint and automatically fix linting errors when possible, run npm run lint-fix.
  • You can also run ESLint by running npx eslint <file/directory>.

Other

  • If you run into any linting errors that you need clarification on or don't know how to fix, reading Airbnb's Style Guide will likely help point you in the right direction.
  • Ask any questions you might have to your Project Lead!

Testing

Frontend

Testing in the frontend has not been implemented yet.

Backend

We use Jest and Supertest to test our backend.

  • To run tests locally, simply run npm test.

Our GitHub Actions pipeline will also run these tests automatically whenever a push is made to a branch.

Clone this wiki locally