Skip to content

Latest commit

 

History

History
65 lines (37 loc) · 5.07 KB

CONTRIBUTING.md

File metadata and controls

65 lines (37 loc) · 5.07 KB

Contributing to Mongoose-PII

We’re thrilled that you want to help! 🎉😍

Here are a few guidelines to help you get on the right tracks.

A word about our Code of Conduct

This project uses the Contributor Covenant code of conduct. Please read it carefully if you’re not already familiar with it. We expect you to behave in accordance with it on all online spaces related to this project.

Check existing issues and discuss

Before you start spending time on this, it’s best to check that you’re not going to waste your time re-inventing something that is already being worked on (an effort which you could then join), or putting together something that we would end up refusing for various reasons.

Check out existing issues (including closed ones, as such discussions might be resolved already) to verify that your intended contribution is both new and relevant.

If you can't find anything related, please open an issue and discuss your proposal, so we can help you figure out the best way to go about it for a smooth, successful merge in the project. Feel free to at-mention @tdd in there for extra confidence in our getting promptly notified.

Issues are the best place to hash out the details and approaches early, before too much code has been committed to it. You can then proceed to coding (or writing docs, or improving other aspects)!

Working on the code

Getting started is the usual stuff:

  1. Fork the project
  2. Clone your forked repo on your local machine
  3. npm install
  4. Create a well-named branch for your work (git checkout -b your-branch-name)

Coding style

In accordance with the usual “Your House, Your Rules” approach, contributions are expected to honor the codebase’s coding style. To facilitate this, the repo comes with:

  • Detailed VS Code workspace settings (in .vscode/settings.json), including whitespace management and ESLint / Prettier extension settings.
  • Recommended VS Code extensions (in .vscode/extensions.json), including ESLint and Prettier. If you use other JS linters / beautifiers, make sure you disable them for this workspace to avoid conflicts.
  • EditorConfig settings for the larger use-case (in .editorconfig)
  • A npm run lint script you can use to ensure consistency. It’s part of the npm test script, which in turn is run through the pre-commit and pre-push Git hooks.

Testing

The project files all have full tests. We use Jest for this, and have two npm scripts ready:

  • npm test runs both the linter and the tests (test:core). Run at commit and push time through Git hooks installed by Husky.
  • npm run test:core does a one-pass; it includes full test coverage reporting.
  • npm run test:watch runs a developer test watch; this is what you should use when working on your code and tests.

The test suite uses the amazing MongoDB Memory Server package, which means you won't need to have a running MongoDB server with a test database to run our tests! How cool is that!

We use Jest’s built-in expect() and matchers, along with its native mocking abilities. If you’re not familiar with them, here are the docs for matchers, function mocking and module mocking. Look at the existing tests for inspiration and guidance.

Make sure any new code you send has matching tests, and that the test suite passes.

Sending a Pull Request

Once you have something ready to contribute, or if you’re too stuck and need help, send a Pull Request from your fork’s code to our main repository. GitHub makes that easy for you in multiple ways. If you’re new to Pull Requests, check out their neat docs about it.

Any Pull Request submitted to main repository will trigger various Checks, including Continuous Integration on Travis and quality auditing on CodeClimate. These may result in failed checks that would prevent regular merging, but don't worry, we'll work on this together.

We currently achieve 100% test coverage, and we’d love to keep it that way. If you’re not clear on why your tests do not cover 100% of your code in some ways, ask us about it in your Pull Request’s conversation.

We currently achieve a zero-issue, A-level quality grade on CodeClimate; it will be tested on your Pull Requests as well, and we'd love for you to address any issues that may be surfaced. If you’re unsure how, ask us and we'll review it with you.

Thanks again!

🙏🏻 Thanks a ton for helping out! That's what Open-Source is all about! 🙏🏻