Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PR Template and update docs #2504

Merged
merged 8 commits into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
Before submitting this PR, please make sure that:
- You have read and understand the contributing.md
- You have checked docs/code_style.md for information on code style
-->
## Description
<!--
Tell us what your PR does.
Please attach a screenshot/ video/gif image describing your PR if possible.
-->

## Issue fixed
<!--
Please list out all issue fixed with this PR here.
-->

<!--
Please make sure you fill in these checkboxes,
your PR will be reviewed faster if we know exactly what it does.

Change :white_circle: to :radio_button: in all the options that apply
-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZeroX-DG can you add the following text?

Put an `x` in all the boxes that apply.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daiyam Thanks for the feedback, I've updated the message. Do you have any other idea?

## Type of changes

- :white_circle: Bug fix (Change that fixed an issue)
- :white_circle: Breaking change (Change that can cause existing functionality to change)
- :white_circle: Improvement (Change that improves the code. Maybe performance or development improvement)
- :white_circle: Feature (Change that adds new functionality)
- :white_circle: Documentation change (Change that modifies documentation. Maybe typo fixes)

## Checklist:

- :white_circle: My code follows [the project code style](docs/code_style.md)
- :white_circle: I have written test for my code and it has been tested
- :white_circle: All existing tests have been passed
- :white_circle: I have attached a screenshot/video to visualize my change if possible
18 changes: 15 additions & 3 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# Contributing to Boostnote (English)

### When you open an issue or a bug report
There is no issue template, but there is a request.

**Please paste screenshots of Boostnote with the developer tool open**
There is an issue template for you to follow. Please provide as much information as you can according to the template.

Thank you in advance for your help.

### When you open a pull request
There is a pull request template for your to follow. Please fill in the template before submitting your code. Your pull request will be reviewed faster if we know exactly what it does.

Make sure that you have:
- Checked [`code_style.md`](docs/code_style.md) for information on code style
- Write tests for your code and run test with the following command
```
npm run test
```
- Lint your code using the following command
```
npm run lint
```

### Concerning Copyright

By making a pull request you agree to transfer ownership of your code to BoostIO.
Expand Down
82 changes: 82 additions & 0 deletions docs/code_style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Boostnote Code Style
When submitting your PR, please make sure that your code is well tested and follow the code style of Boostnote.

The code style of Boostnote is listed in [`.eslintrc`](.eslintrc). We also have additional code styles that is not mentioned in that file.

## Additional code styles
### Use ES6 Object Destructing

Please use Object Destructing whenever it's possible.

**Example**: Importing from library

```js

// BAD
import Code from 'library'
const subCode = Code.subCode
subCode()

// GOOD
import { subCode } from 'library'
subCode()
```

**Example**: Extract data from react component state

```
// BAD
<h1>{this.state.name}</h1>

// GOOD
const { name } = this.state
<h1>{name}</h1>
```

### Use meaningful name
This is actually not a "code style" but rather a requirement in every projects. Please name your variables carefully.

**Example**: Naming callback function for event

```js
// BAD
<h1 onclick={onClick}>Name</h1>

// GOOD
<h1 onclick={onNameClick}>Name</h1>
```

### Don't write long conditional statement
When writing a conditional statement, if it's too long, cut it into small meaningful variables.

```js
// BAD
if (note.type == 'markdown' && note.index == 2 && note.content.indexOf('string') != -1)

// GOOD
const isSecondMarkdownNote = note.type == 'markdown' && note.index == 2
const isNoteHasString = note.content.indexOf('string') != -1
if (isSecondMarkdownNote && isNoteHasString)
```

### Use class property instead of class methods
When writing React components, try to use class property instead of class methods. The reason for this is explained perfectly here:
https://codeburst.io/use-class-properties-to-clean-up-your-classes-and-react-components-93185879f688

**Example**:

```js
// BAD
class MyComponent extends React.Component {
myMethod () {
// code goes here...
}
}

// GOOD
class MyComponent extends React.Component {
myMethod = () => {
// code goes here...
}
}
```