The following are a few ways you can contribute to the project, along with a guideline to follow when writing code or making a commit.
Contributing to this project is easy and appreciated.
You will need git for contributing.
- Fork the repo
- Create a new branch
git checkout -b branch-name
- Commit your changes and set commit message
git commit -m "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce rhoncus."
- Push your changes
git push -u origin branch-name
- Open a new pull request
Most of these here are taken from the Atom guidelines (they're really good)
- Use the present tense ("Add feature", not "Added feature")
- Use the imperative mood ("Move cursor to...", not "Moves cursor to")
- Limit the first line to 72 characters or less
- Describe the additions on the next line
- When changing documentation, prefix
[ci skip]
on the commit message
All of our code is styled with Prettier.
- Prefer using the spread syntax
{...someObj}
insteadObject.assign()
- Use different cases:
- camelCase for constants, variables and functions
- PascalCase for classes
- Inline exports when possible
// Use this:
export const functionName = (): void => {
// ...
}
// Not this:
const functionName = (): void => {
// ...
}
export functionName;
- Use arrow functions when possible
// Use this:
const functionName = (): void => {
// ...
};
// Not this:
function functionName(): void {
// ...
}
- Use different cases:
snake_case
for functions and variablesPascalCase
for structs and enumsSCREAMING_SNAKE_CASE
for constants
- Use JSDoc
- Use Markdown
- Reference types in documentation using
{}
- When making a function, use this
- If it invokes a Rust function, use
Typescript Function -> Rust Function
- If it's only a TypeScript function, use
Typescript Function
- If it invokes a Rust function, use
Example:
/*
* Typescript Function
* - Adds 2 + 2
*
* @returns {number} the number added
*/
const addNum = (): number => 2 + 2;