GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #34 from Rocketseat/feat/commitlint · unform/unform@7bd828a

This repository was archived by the owner on Apr 6, 2023. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • CONTRIBUTING.md
  • .travis.yml
  • commitlint.config.js
  • package.json
  • yarn.lock
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/CONTRIBUTING.md‎

Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+65-19Lines changed: 65 additions & 19 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [Code](#code)
1515
- [Dev environment](#dev-environment)
1616
- [Commiting](#commiting)
17+
- [Why all this rules?](#why-all-this-rules)
1718
- [Submitting a pull request](#submitting-a-pull-request)
1819

1920
## Getting started
@@ -118,45 +119,88 @@ This project uses [Prettier](http://prettier.io/) for code formatting. Consider
118119

119120
## Commiting
120121

121-
- Never use the `-m <msg>` / `--message=<msg>` flag to `git commit`;
122+
A commit message can consists of a **header**, **body** and **footer**. The header is the only mandatory part and consists of a type and a subject. The body is used to fully describe the change. The footer is the place to reference any issues or pull requests related to the commit. That said, we end with a template like this:
123+
124+
```
125+
<type>: <subject>
126+
127+
[optional body]
128+
129+
[optional footer]
130+
```
131+
132+
To ensure that a commit is valid, easy to read, and changelog-ready, we have a hook that lints the commit message before allowing a commit to pass. This linter verifies the following:
133+
134+
- The header (first line) is the only mandatory part of the commit message;
135+
- The body and footer are both optional but its use is highly encouraged;
136+
- The header should contains:
137+
- A type:
138+
- Must be lowercase;
139+
- Must be one of:
140+
- **chore**: A change that neither fix a bug nor adds a feature;
141+
- **ci**: A CI change;
142+
- **docs**: A documentation change or fix;
143+
- **feat**: A new feature;
144+
- **fix**: A bug fix;
145+
- **test**: A test-related change.
146+
- A subject:
147+
- Must be capitalized;
148+
- Must be limited to 50 characters or less;
149+
- Must omit any trailing punctuation.
150+
- The body:
151+
- Must have a leading blank line;
152+
- Each line must be limited to 72 characters or less.
153+
- The footer:
154+
- Must have a leading blank line;
155+
- Each line must be limited to 72 characters or less;
156+
- If needed, reference to issues and pull requests must be made here in the last line.
157+
158+
You also should follow these general guidelines when committing:
159+
122160
- Use the present tense ("Add feature" not "Added feature");
123161
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...");
124-
- The first line should:
125-
- Be capitalized;
126-
- Have 50 characters or less;
127-
- Omit any trailing punctuation;
128-
- Be followed by a blank line.
129-
- The following lines should have 72 characters or less;
130-
- Reference issues and pull requests liberally after the first line;
131-
- When creating a commit try to answer the following questions:
162+
- Try to answer the following questions:
132163
- Why is this change necessary?
133164
- How does it address the issue?
134165
- What side effects (if any) does this change may have?
135166

136-
Example:
167+
Example of a commit message:
137168

138169
```
139-
Commit message style guide for Git
170+
type: Commit message style guide for Git
140171
141172
The first line of a commit message serves as a summary. When displayed
142173
on the web, it's often styled as a heading, and in emails, it's
143-
typically used as the subject. As such, you should capitalize it and
174+
typically used as the subject. As such, you should specify a "type" and
175+
a "subject". The type must be lowercase and one of: chore, ci, docs,
176+
feat, fix, test. For the subject you'll need capitalize it and
144177
omit any trailing punctuation. Aim for about 50 characters, give or
145178
take, otherwise it may be painfully truncated in some contexts. Write
146-
it, along with the rest of your message, in the present tense and imperative mood: "Fix
147-
bug" and not "Fixed bug" or "Fixes bug". Consistent wording makes it
148-
easier to mentally process a list of commits.
179+
it, along with the rest of your message, in the present tense and
180+
imperative mood: "Fix bug" and not "Fixed bug" or "Fixes bug".
181+
Consistent wording makes it easier to mentally process a list of
182+
commits.
149183
150-
Oftentimes a subject by itself is sufficient. When it's not, add a
184+
Oftentimes a subject by itself is sufficient. When it's not, add a
151185
blank line (this is important) followed by one or more paragraphs hard
152-
wrapped to 72 characters. Git is strongly opinionated that the author
186+
wrapped to 72 characters. Git is strongly opinionated that the author
153187
is responsible for line breaks; if you omit them, command line tooling
154188
will show it as one extremely long unwrapped line. Fortunately, most
155189
text editors are capable of automating this.
156190
157-
When relevant, issues and pull request can be referenced using theirs numbers: #3 #12
191+
Issues and pull request can be referenced on the footer: #3 #12
158192
```
159193

194+
### Why all these rules?
195+
196+
We try to enforce these rules for the following reasons:
197+
198+
- Automatically generating changelog;
199+
- Communicating in a better way the nature of changes;
200+
- Triggering build and publish processes;
201+
- Automatically determining a semantic version bump (based on the types of commits);
202+
- Making it easier for people to contribute, by allowing them to explore a more structured commit history.
203+
160204
## Submitting a pull request
161205

162206
Before submitting a pull request, please make sure the following is done:
@@ -165,4 +209,6 @@ Before submitting a pull request, please make sure the following is done:
165209
- Example: `feature/my-awesome-feature` or `fix/annoying-bug`;
166210
- Run `yarn` in the repository root;
167211
- If you’ve fixed a bug or added code that should be tested, **add tests**;
168-
- Ensure the test suite passes.
212+
- Ensure the test suite passes;
213+
- Ensure your commit is validated;
214+
- If your pull request is about documentation or meta files, please add the tag **[skip ci]** in the title.
Collapse file

‎.travis.yml‎

Copy file name to clipboardExpand all lines: .travis.yml
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22

33
node_js:
4-
- "10"
4+
- '10'
55

66
cache:
77
yarn: true
@@ -12,8 +12,9 @@ install:
1212
- yarn
1313

1414
script:
15+
- commitlint-travis
1516
- yarn coveralls
16-
17+
1718
before_deploy:
1819
- yarn build
1920

Collapse file

‎commitlint.config.js‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ["rocketseat"]
3+
};
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"license": "MIT",
1414
"husky": {
1515
"hooks": {
16-
"pre-commit": "lint-staged"
16+
"pre-commit": "lint-staged",
17+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
1718
}
1819
},
1920
"lint-staged": {
@@ -34,6 +35,9 @@
3435
},
3536
"devDependencies": {
3637
"@babel/core": "^7.4.3",
38+
"@commitlint/cli": "^7.6.1",
39+
"@commitlint/config-conventional": "^7.6.0",
40+
"@commitlint/travis-cli": "^7.6.1",
3741
"@types/dot-object": "^1.7.0",
3842
"@types/jest": "^24.0.11",
3943
"@types/react": "^16.8.13",
@@ -42,6 +46,7 @@
4246
"@types/yup": "^0.26.12",
4347
"@typescript-eslint/eslint-plugin": "^1.6.0",
4448
"@typescript-eslint/parser": "^1.6.0",
49+
"commitlint-config-rocketseat": "^0.0.1",
4550
"coveralls": "^3.0.3",
4651
"eslint": "^5.16.0",
4752
"eslint-config-airbnb": "^17.1.0",

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.