summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-07-29 08:20:26 -0400
committerChristopher Speller <crspeller@gmail.com>2015-07-29 08:20:26 -0400
commit9e64500e316199287a305a93d7ac6d12d78ea435 (patch)
tree0e3b249c951fb47ec2f393dc053f447feea1ed6b
parentbf5548ad6da9dc4a12ffde56658f7d9a9748cb80 (diff)
downloadchat-9e64500e316199287a305a93d7ac6d12d78ea435.tar.gz
chat-9e64500e316199287a305a93d7ac6d12d78ea435.tar.bz2
chat-9e64500e316199287a305a93d7ac6d12d78ea435.zip
Fixing spelling and clarifying a few parts of style guide.
-rw-r--r--STYLE-GUIDE.md30
1 files changed, 16 insertions, 14 deletions
diff --git a/STYLE-GUIDE.md b/STYLE-GUIDE.md
index a370e7d74..e3fe2addf 100644
--- a/STYLE-GUIDE.md
+++ b/STYLE-GUIDE.md
@@ -9,20 +9,20 @@
All go code must follow the golang official [Style Guide](https://golang.org/doc/effective_go.html)
-In addition all code must be run though the official go formater tool [gofmt](https://golang.org/cmd/gofmt/)
+In addition all code must be run though the official go formatter tool [gofmt](https://golang.org/cmd/gofmt/)
## Javascript
-Part of the buld process is running ESLint. ESLint is the final athority on all style issues. PRs will not be accepted unless there are no errors or warnings running ESLint. The ESLint configuration file can be found in: [web/react/.eslintrc](https://github.com/mattermost/platform/blob/master/web/react/.eslintrc.json)
+Part of the build process is running ESLint. ESLint is the final authority on all style issues. PRs will not be accepted unless there are no errors or warnings running ESLint. The ESLint configuration file can be found in: [web/react/.eslintrc](https://github.com/mattermost/platform/blob/master/web/react/.eslintrc.json)
Instructions on how to use ESLint with your favourite editor can be found here: [http://eslint.org/docs/user-guide/integrations](http://eslint.org/docs/user-guide/integrations)
-The following is an abriged version of the [Airbnb Javascript Style Guide](https://github.com/airbnb/javascript/blob/master/README.md#airbnb-javascript-style-guide-), with modifications. Anything that is unclear here follow that guide. If there is a conflict, follow what is said below.
+The following is an abridged version of the [Airbnb Javascript Style Guide](https://github.com/airbnb/javascript/blob/master/README.md#airbnb-javascript-style-guide-), with modifications. Anything that is unclear here follow that guide. If there is a conflict, follow what is said below.
### Whitespace
-- Indentaiton is four spaces
+- Indentation is four spaces
- Use a space before the leading brace
- Use one space between the comma and the next argument in a bracketed list. No other space.
- Use whitespace to make code more readable.
@@ -62,23 +62,25 @@ var x = 1
### Variables
- Declarations must always use var, let or const.
-- Perfer let or const over var.
+- Prefer let or const over var.
+- camelCase for all variable names.
```javascript
// Correct
-let x = 4;
+let myVariable = 4;
// OK
-var x = 4;
+var myVariable = 4;
// Incorrect
-x = 4;
+myVariable = 4;
+var my_variable = 4;
```
### Blocks
-- Braces must be used on all multi-line blocks.
-- Braces must start on the same line as the statment starting the block.
+- Braces must be used on all blocks.
+- Braces must start on the same line as the statement starting the block.
- Else and else if must be on the same line as the if block closing brace.
```javascript
@@ -124,16 +126,16 @@ function wrongGetStr(stuff) {
## React-JSX
-Part of the buld process is running ESLint. ESLint is the final athority on all style issues. PRs will not be accepted unless there are no errors or warnings running ESLint. The ESLint configuration file can be found in: [web/react/.eslintrc](https://github.com/mattermost/platform/blob/master/web/react/.eslintrc.json)
+Part of the build process is running ESLint. ESLint is the final authority on all style issues. PRs will not be accepted unless there are no errors or warnings running ESLint. The ESLint configuration file can be found in: [web/react/.eslintrc](https://github.com/mattermost/platform/blob/master/web/react/.eslintrc.json)
Instructions on how to use ESLint with your favourite editor can be found here: [http://eslint.org/docs/user-guide/integrations](http://eslint.org/docs/user-guide/integrations)
-This is an abriged version of the [Airbnb React/JSX Style Guide](https://github.com/airbnb/javascript/tree/master/react#airbnb-reactjsx-style-guide). Anything that is unclear here follow that guide. If there is a conflict, follow what is said below.
+This is an abridged version of the [Airbnb React/JSX Style Guide](https://github.com/airbnb/javascript/tree/master/react#airbnb-reactjsx-style-guide). Anything that is unclear here follow that guide. If there is a conflict, follow what is said below.
### General
- Include only one React component per file.
-- Use class \<name\> extends React.Componet over React.createClass unless you need mixins
+- Use class \<name\> extends React.Component over React.createClass unless you need mixins
- CapitalCamelCase with .jsx extension for component filenames.
- Filenames should be the component name.
@@ -153,7 +155,7 @@ This is an abriged version of the [Airbnb React/JSX Style Guide](https://github.
<Tag propertyOne="1" />
```
-### Nameing
+### Naming
- Property names use camelCase.
- React component names use CapitalCamelCase.