elsewhencode /project-guidelines

A set of best practices for JavaScript projects

★ 29,412⑂ 3,116👁 612⑃ 134● 39▤ 0
JavaScriptMITCreated 2017-06-30
-1
Daily
-5
Weekly
-6
Monthly
29,412
stars
3,116
forks
612
watchers
134
prs
39
issues
0
releases

README

中文版
| 日本語版
| 한국어
| Русский
| Português
| Italiana
| Persian/فارسی



 Project Guidelines · 

 While developing a new project is like rolling on a green field for you, maintaining it is a potential dark twisted nightmare for someone else.
 Here's a list of guidelines we've found, written and gathered that (we think) works really well with most JavaScript projects here at elsewhen.
 If you want to share a best practice, or think one of these guidelines should be removed, feel free to share it with us.



- Git
  - Some Git rules
  - Git workflow
  - Writing good commit messages
- Documentation
- Environments
  - Consistent dev environments
  - Consistent dependencies
- Dependencies
- Testing
- Structure and Naming
- Code style
  - Some code style guidelines
  - Enforcing code style standards
- Logging
- API
  - API design
  - API security
  - API documentation
- Accessibility
- Licensing



 1. Git

!Git


 1.1 Some Git rules

There are a set of rules to keep in mind:

- Perform work in a feature branch.

  _Why:_

   Because this way all work is done in isolation on a dedicated branch rather than the main branch. It allows you to submit multiple pull requests without confusion. You can iterate without polluting the master branch with potentially unstable, unfinished code. read more...

- Branch out from develop

  _Why:_

   This way, you can make sure that code in master will almost always build without problems, and can be mostly used directly for releases (this might be overkill for some projects).

- Never push into develop or master branch. Make a Pull Request.

  _Why:_

   It notifies team members that they have completed a feature. It also enables easy peer-review of the code and dedicates forum for discussing the proposed feature.

- Update your local develop branch and do an interactive rebase before pushing your feature and making a Pull Request.

  _Why:_

   Rebasing will merge in the requested branch (master or develop) and apply the commits that you have made locally to the top of the history without creating a merge commit (assuming there were no conflicts). Resulting in a nice and clean history. read more ...

- Resolve potential conflicts while rebasing and before making a Pull Request.
- Delete local and remote feature branches after merging.

  _Why:_

   It will clutter up your list of branches with dead branches. It ensures you only ever merge the branch back into (master or develop) once. Feature branches should only exist while the work is still in progress.

- Before making a Pull Request, make sure your feature branch builds successfully and passes all tests (including code style checks).

  _Why:_

   You are about to add your code to a stable branch. If your feature-branch tests fail, there is a high chance that your destination branch build will fail too. Additionally, you need to apply code style check before making a Pull Request. It aids readability and reduces the chance of formatting fixes being mingled in 

Top issues

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON