-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6244e44
added pr template
ZeroX-DG fa3700d
updated pr template
ZeroX-DG 80c4601
fixed grammar in PR template
ZeroX-DG 83243b6
smaller header font size
ZeroX-DG 3b7bedb
update pull request message
ZeroX-DG c5554e8
update pull request template
ZeroX-DG 6cb6cd3
updated docs and pull request template
ZeroX-DG 4550d88
updated code style with class property style
ZeroX-DG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
--> | ||
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... | ||
} | ||
} | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?