Skip to content

Commit 00404d7

Browse files
author
Vahid Panjganj
authored
Merge pull request elsewhencode#28 from yeskunall/master
✎ Improve general sentence structure and fix grammatical errors
2 parents 3216020 + 908596b commit 00404d7

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ Having a good guideline for creating commits and sticking to it makes working wi
7474
* Limit the subject line to 50 characters
7575
* Capitalize the subject line
7676
* Do not end the subject line with a period
77-
* Use the imperative mood in the subject line
77+
* Use imperative mood in the subject line
7878
* Wrap the body at 72 characters
79-
* Use the body to explain what and why vs. how
79+
* Use the body to explain **what** and **why** as opposed to **how**
8080
8181
## 2. Documentation <a name="documentation"></a>
8282
* Use this [template](./README.sample.md) for `README.md`, Feel free to add uncovered sections.
83-
* For project with more than one repository, provide links to between them in their `README.md` files.
83+
* For projects with more than one repository, provide links to them in their respective `README.md` files.
8484
* Keep `README.md` updated as project evolves.
8585
* Comment your code. Try to make it as clear as possible what you are intending with each major section.
8686
* Comment small sections of code if you think it's not self explanatory.
@@ -90,56 +90,59 @@ Having a good guideline for creating commits and sticking to it makes working wi
9090
* Depending on project size, define separate `development`, `test` and `production` environments.
9191
* Load your deployment specific configurations from environment variables and never add them to the codebase as constants, [look at this sample](./config.sample.js).
9292
* Your config should be correctly separated from the app internals as if the codebase could be made public at any moment. Use `.env` files to store your variables and add them to `.gitignore` to be excluded from your code base because of course, you want the environment to provide them. Instead commit a `.env.example` which serves as a guide for developers to know which environment variables the project needs. It is important to remember that this setup should only be used for development. For production you should still set your environment variables in the standard way.
93-
* It’s recommended to validate environment variables before your app starts , [look at this sample](./configWithTest.sample.js) using `joi` to validate provided values:
93+
* It’s recommended to validate environment variables before your app starts. [Look at this sample](./configWithTest.sample.js) using `joi` to validate provided values.
9494
9595
### 3.1 Consistent dev environments:
9696
* Set `engines` in `package.json` to specify the version of node your project works on.
97-
* Additionally, Use `nvm` and create a `.nvmrc` in your project root. Don't forget to mention in documentation
97+
* Additionally, use `nvm` and create a `.nvmrc` in your project root. Don't forget to mention it in the documentation
9898
* You can also use a `preinstall` script that checks node and npm versions
99-
* Or if it doesn't make things complicated use a docker images
100-
* Use local modules instead of requiring global installation
99+
* Use Docker images provided it doesn't make things more complicated
100+
* Use local modules instead of using globally installed modules
101101
102102
## 4. Dependencies <a name="dependencies"></a>
103-
Before using a package check its Github open issues, daily downloads and number of contributors as well as the date package last updated.
103+
Before using a package, check its GitHub. Look for the number of open issues, daily downloads and number of contributors as well as the date the package was last updated.
104104
105-
* If less known dependency is needed, discuss it with the team before using it.
105+
* If less known dependency is needed, discuss it with the team before using it.
106106
* Keep track of your currently available packages: e.g., `npm ls --depth=0` ([documentation](https://docs.npmjs.com/cli/ls)).
107107
* See if any of your packages have become unused or irrelevant: `depcheck` ([documentation](https://www.npmjs.com/package/depcheck)).
108108
* Check download statistics to see if the dependency is heavily used by the community: `npm-stat` ([documentation](https://npm-stat.com/)).
109109
* Check to see if the dependency has a good, mature version release frequency with a large number of maintainers: e.g., `npm view async` ([documentation](https://docs.npmjs.com/cli/view)).
110110
* Always make sure your app works with the latest versions of dependencies without breaking: `npm outdated` ([documentation](https://docs.npmjs.com/cli/outdated)).
111-
* Check to see package has known security vulnerabilities with, e.g., [Snyk](https://snyk.io/test?utm_source=risingstack_blog).
111+
* Check to see if the package has known security vulnerabilities with, e.g., [Snyk](https://snyk.io/test?utm_source=risingstack_blog).
112112
113113
### 4.1 Consistent dependencies:
114-
* Use `package-lock.json` on npm 5 or higher
115-
* For older versions of npm Use `—save --save-exact` when installing a new dependency and create `npm-shrinkwrap.json` before publishing.
114+
* Use `package-lock.json` on `npm@5` or higher
115+
* For older versions of `npm`, use `—save --save-exact` when installing a new dependency and create `npm-shrinkwrap.json` before publishing.
116116
* Alternatively you can use `Yarn` and make sure to mention it in `README.md`. Your lock file and `package.json` should have the same versions after each dependency update.
117117
* Read more here: [package-locks | npm Documentation](https://docs.npmjs.com/files/package-locks)
118118
119119
## 5. Testing <a name="testing"></a>
120120
* Have a test mode environment if needed.
121121
* Place your test files next to the tested modules using `*.test.js` or `*.spec.js` naming convention, like `module_name.spec.js`
122122
* Put your additional test files into a separate test folder to avoid confusion.
123-
* write testable code, avoid side effect, extract side effects, write pure functions
124-
* Don’t write too many tests to check types, instead use a Static type checker
125-
* Run tests locally before any pull request to `develop`.
123+
* Write testable code, avoid side effects, extract side effects, write pure functions
124+
* Don’t write too many tests to check types, instead use a static type checker
125+
* Run tests locally before making any pull requests to `develop`.
126126
* Document your tests, with instructions.
127127
128128
## 6. Structure and Naming <a name="structure-and-naming"></a>
129-
* Organize your files around product features / pages / components, not Roles:
130-
```
131-
// BAD
129+
* Organize your files around product features / pages / components, not roles
130+
131+
**Bad**
132+
133+
```
132134
.
133135
├── controllers
134136
| ├── product.js
135137
| └── user.js
136138
├── models
137139
| ├── product.js
138140
| └── user.js
139-
```
141+
```
140142
141-
```
142-
// GOOD
143+
**Good**
144+
145+
```
143146
.
144147
├── product
145148
| ├── index.js
@@ -149,15 +152,15 @@ Before using a package check its Github open issues, daily downloads and number
149152
| ├── index.js
150153
| ├── user.js
151154
| └── user.test.js
152-
```
153-
* Place your test files next to the implementation.
155+
```
156+
* Place your test files next to their implementation.
154157
* Put your additional test files to a separate test folder to avoid confusion.
155-
* Use a `./config` folder. Values to be used in config files are provided by environmental variables.
156-
* Put your scripts in a `./scripts` folder. This includes bash and node scripts for database synchronisation, build and bundling and so on.
158+
* Use a `./config` folder. Values to be used in config files are provided by environment variables.
159+
* Put your scripts in a `./scripts` folder. This includes `bash` and `node` scripts for database synchronisation, build and bundling and so on.
157160
* Place your build output in a `./build` folder. Add `build/` to `.gitignore`.
158-
* Use `PascalCase' 'camelCase` for filenames and directory names too. Use `PascalCase` only for Components.
161+
* Use `PascalCase' 'camelCase` for filenames and directory names. Use `PascalCase` only for Components.
159162
* `CheckBox/index.js` should have the `CheckBox` component, as could `CheckBox.js`, but **not** `CheckBox/CheckBox.js` or `checkbox/CheckBox.js` which are redundant.
160-
* Ideally the directory name would match the name of the default export of `index.js`.
163+
* Ideally the directory name should match the name of the default export of `index.js`.
161164
162165
## 7. Code style <a name="code-style"></a>
163166
* Use stage-1 and higher JavaScript (modern) syntax for new projects. For old project stay consistent with existing syntax unless you intend to modernise the project.
@@ -167,7 +170,7 @@ Before using a package check its Github open issues, daily downloads and number
167170
* Use [Flow type style check rules for ESLint.](https://github.com/gajus/eslint-plugin-flowtype) for [FlowType](https://flow.org/).
168171
* Use `.eslintignore` to exclude file or folders from code style check.
169172
* Remove any of your `eslint` disable comments before making a Pull Request.
170-
* Always use `//todo:` comments to remind yourself and others about an unfinished job.
173+
* Always use `//TODO:` comments to remind yourself and others about an unfinished job.
171174
* Always comment and keep them relevant as code changes.
172175
* Remove commented block of code when possible.
173176
* Avoid js alerts in production.
@@ -177,7 +180,7 @@ Before using a package check its Github open issues, daily downloads and number
177180
* Organize your functions in a file according to the step-down rule. Higher level functions should be on top and lower levels below. It makes it more natural to read the source code.
178181
179182
## 8. Logging <a name="logging"></a>
180-
* Avoid client side console logs in production
183+
* Avoid client-side console logs in production
181184
* Produce readable production logging. Ideally use logging libraries to be used in production mode (such as [winston](https://github.com/winstonjs/winston) or
182185
[node-bunyan](https://github.com/trentm/node-bunyan)).
183186

0 commit comments

Comments
 (0)