Contributing to Corelink

First off, thanks for taking the time to contribute!

The following is a set of guidelines for contributing to Holodeck and its packages.These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

Style Guide

All JavaScript code must adhere to Airbnb JavaScript Style Guide

Behind the Scenes: What happens when you submit a pull request?

For consistency in our code style and formatting,tools like ESLint,Prettier,Husky and Lint-staged are used.

ESLint is a tool which checks that our code conforms to our defined "rules" about coding convention and style.Prettier is a formatting tool that will format our code in a consistent way every time we run the tool.

Lint-staged is a tool that allows us to run linters and other such tools against only the files that are currently staged on git (ie the files we have “git added”).Husky is a tool that allows us specify certain scripts to run as git hooks in our package.json file. Husky takes care of actually setting up the hooks and running our scripts, we just tell it when to run and what to run.

We will use lint-staged to run eslint, prettier and run our jest tests against the files that have been staged. Lint staged will be triggered to run by husky as a pre commit. Lint-staged will run eslint and prettier against the files that have been staged. Lint staged will be triggered to run by husky as a pre commit hook.

So the workflow looks like this:

  1. Make changes to the code
  2. git add the changed files
  3. git commit the changed files
  4. Before the code is actually committed husky will trigger lint-staged
  5. Lint staged will run eslint, prettier and jest against all the staged files
  6. If anything fails the commit won’t go through, if everything passes then the code is committed.