project-guidelines README

The project's README from github.com/elsewhencode/project-guidelines. As one markdown file: README.md.

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

Project Guidelines · PRs Welcome

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.


1. Git

Git

1.1 Some Git rules

There are a set of rules to keep in mind:

1.2 Git workflow

Because of most of the reasons above, we use Feature-branch-workflow with Interactive Rebasing and some elements of Gitflow (naming and having a develop branch). The main steps are as follows:

1.3 Writing good commit messages

Having a good guideline for creating commits and sticking to it makes working with Git and collaborating with others a lot easier. Here are some rules of thumb (source):

2. Documentation

Documentation

3. Environments

Environments

3.1 Consistent dev environments:

3.2 Consistent dependencies:

4. Dependencies

Github

5. Testing

Testing

6. Structure and Naming

Structure and Naming

7. Code style

Code style

7.1 Some code style guidelines

7.2 Enforcing code style standards

8. Logging

Logging

9. API

API

9.1 API design

Why:

Because we try to enforce development of sanely constructed RESTful interfaces, which team members and clients can consume simply and consistently.

Why:

Lack of consistency and simplicity can massively increase integration and maintenance costs. Which is why API design is included in this document.

9.2 API security

These are some basic security best practices:

9.3 API documentation

For each endpoint explain:

10. Accessibility (a11y)

Accessibility

10.1 Laying accessibility practices in place

Take the following steps at the start of your project to ensure an intentional level of accessibility is sustained:

Why:

Web content is accessible by default. We compromise this when we build complex features. It's much easier to reduce this impact by considering accessibility from the start rather than re-implement these features later.

10.2 Some basic accessibility rules to add to your project:

More accessibility rules can be found here.

11. Licensing

Licensing

Make sure you use resources that you have the rights to use. If you use libraries, remember to look for MIT, Apache or BSD but if you modify them, then take a look at the license details. Copyrighted images and videos may cause legal problems.


Sources: RisingStack Engineering, Mozilla Developer Network, Heroku Dev Center, Airbnb/javascript, Atlassian Git tutorials, Apigee, Wishtack

Icons by icons8

project-guidelines (elsewhencode/project-guidelines)

Searching Database…

这是什么?一套公开的 JavaScript 项目最佳实践,由 elsewhen 团队编写和整理——针对 Git、文档、环境、依赖、测试、代码风格、API 等方面的编号规则。
它是一个需要安装的软件包,还是只是一份文档?只是一份文档——一份结构化的 README,里面是编号的准则,每条都附有 Why(为什么)说明。没有任何东西需要安装;你只需复制它链接的 .gitignore 和 README 模板,其余的在代码评审中逐步采用。
我该怎么把这些准则用到实践中?从头到尾通读一遍,采纳适合你的部分:复制它链接的 .gitignore 和 README.md 模板,用 .nvmrc 固定你的 node 版本,使用 lockfile 锁定依赖,其余的在 pull request 中强制执行。
它是假设我用 Node,还是与技术栈无关?关于环境和依赖的建议以 Node/npm 为中心——nvm 和 .nvmrc、package.json 里的 engines、package-lock.json 或 Yarn——而 Git、提交信息和文档方面的规则适用于任何技术栈。
这是一套严格的标准,还是带主观倾向的建议?是带主观倾向的建议,而不是强制执行的工具:每条规则都附有 Why(为什么)说明,作者也欢迎大家讨论增删准则。执行这些规则靠你自己,比如通过代码评审。
它是写给团队用的,还是给独立开发者用的?主要面向团队:带 pull request 评审的功能分支工作流、受保护的 develop 和 master 分支,以及各台机器上完全一致的依赖版本。独立开发者也可以只挑提交和代码风格方面的规则来用。
我可以复用或改编这份指南吗?可以——按仓库元数据是 MIT 许可,所以 fork 它并为自己的团队做改编完全没问题。指南末尾还有一个 Licensing(许可)章节,讲解如何为自己的项目选择许可证。
Git 方面的规则有多具体?非常具体:永远不要直接向 develop 或 master 推送代码,pull request 之前先做交互式 rebase,合并之后删除功能分支;提交方面——主题行不超过 50 个字符,正文在 72 个字符处换行,使用祈使语气,正文要说明改了什么以及为什么改。
关于测试有什么建议?把测试文件放在被测代码旁边,按 moduleName.spec.js 或 moduleName.test.js 这样的方式命名;当生产环境的分析统计或 API 速率限制会碍事时,另建一个独立的测试环境。
它有没有提到具体的工具?有:用 depcheck 查找没在用的包,用 npm-stat 和 npm view 了解一个包的流行度和维护情况,用 npm outdated 和 npm-check-updates 保持依赖更新,用 Snyk 检查安全漏洞,用 joi 在启动时校验环境变量,以及用 Docker 保持环境一致。
这份指南有其他语言的版本吗?有——README 顶部链接了中文、日文、韩文、俄文、葡萄牙文、意大利文和波斯文的社区翻译。该仓库最早发布于 2017 年,目前仍是公开状态,也没有被归档。
Size
0.5 MB
Stars
29.4K
Updated
CommitDec 09
Age
9y
Commits · 90 Days