So you want to contribute to the app? Great! Please read the following instructions to avoid any confusion. Working with many people on a single project can be a challenge, it can very painfull for both maintainers and contributors, so we need to set some guidelines to make it smooth.
NB : These guidelines are and will always be up for discussion. Just open a ticket if anything could be improved!
We love your input, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing improvement / new features
- Becoming a maintainer
We welcome pull requests to change to the codebase.
- Fork the repo and create your branch from
master
. - If you've added code that should be tested, add tests.
- Ensure the test suite passes.
- Make sure your code lints.
- Make your pull request
When you submit code changes, your submissions are understood to be under GPL-3.0 License.
You can read it here.
Please try to do the following :
- Every new piece of code requires tests. If you don't know how to do that, it's fine, but please create an issue and add a
/* TODO: write test for ...
so we don't forget about doing it. - Write stories for new components. If you don't know how to do that, write a todo like previously shown.
- Update tests / stories if you change anything
- Run
yarn lint
to make sure that your code passes linting. - Naming and folder structure is really important. Have a look to the current code and see how it's done 😉
- Do not reinvent the wheel : if you want to add a library like lodash instead of ramda, open a ticket first so we can discuss it.
The import ... from '...';
at the top of files follow some rules:
- Absolute imports before relative imports
- import { Emission } from './Emission';
- import React from 'react';
+ import React from 'react';
+ import { Emission } from './Emission';
- Absolute imports are sorted alphabetically by package name
- import { StackNavigation } from 'react-navigation';
- import React from 'react';
+ import React from 'react';
+ import { StackNavigation } from 'react-navigation';
- Relative imports are reverse-sorted by import depth, meaning deeper imports appear first
- import { Emission } from './Emission';
- import { calculation } from "../../utils";
+ import { calculation } from "../../utils";
+ import { Emission } from './Emission';
- Imports at the same depth are sorted alphabetically by module name
- import { Emission } from './Emission';
- import { About } from './About';
+ import { About } from './About';
+ import { Emission } from './Emission';
- Destructured fields are ordered alphabetically
- import { useState, useContext } from 'react';
- const { width, height } = props;
+ import { useContext, useState } from 'react';
+ const { height, width } = props;
- Props in React components are ordered alphabetically
- <Emission style={{ width: 30 }} distance={20} />
+ <Emission distance={20} style={{ width: 30 }} />