Skip to content

Commit c457afd

Browse files
committed
docs: add documentation with my new readme style
1 parent bd376df commit c457afd

File tree

1 file changed

+74
-13
lines changed

1 file changed

+74
-13
lines changed

README.md

+74-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,83 @@
11
# commitlint plugin function rules
22

3-
commitlint plugin to define rules as functions.
3+
[commitlint][commitlint] plugin to use functions as rule value.
4+
5+
- Create custom function, `sync` or `async`, as rule value.
6+
- Create rules that are based on the commit message.
7+
- Write rules with regular expressions.
8+
- Use the same rules that are [available](https://commitlint.js.org/#/reference-rules) in [commitlint][commitlint].
9+
10+
---
11+
12+
[![npm version](https://img.shields.io/npm/v/commitlint-plugin-function-rules?logo=npm&style=flat-square)](https://www.npmjs.com/package/commitlint-plugin-function-rules)
13+
[![npm downloads](https://img.shields.io/npm/dm/commitlint-plugin-function-rules?logo=npm&style=flat-square)](https://www.npmjs.com/package/commitlint-plugin-function-rules)
14+
[![Renovate enabled](https://img.shields.io/badge/Renovate-enabled-brightgreen.svg?logo=renovatebot&logoColor&style=flat-square)](https://renovatebot.com)
15+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
16+
[![Code coverage](https://img.shields.io/codecov/c/github/vidavidorra/commitlint-plugin-function-rules?logo=codecov&style=flat-square)](https://codecov.io/gh/vidavidorra/commitlint-plugin-function-rules)
17+
[![License](https://img.shields.io/github/license/vidavidorra/commitlint-plugin-function-rules.svg?style=flat-square)](LICENSE.md)
418

519
<a name="toc"></a>
620

721
## Table of contents
822

9-
- [Badges](#badges)
23+
- [Install](#install)
24+
- [Usage](#usage)
25+
- [Documentation](#documentation)
26+
- [Contributing](#contributing)
27+
- [Security policy](#security-policy)
1028
- [License](#license)
1129

12-
## Badges
30+
## Install
31+
32+
```shell
33+
npm install --save-dev commitlint-plugin-function-rules @commitlint/cli
34+
```
35+
36+
## Usage
37+
38+
Use this plugin in your project's commitlint configuration by specifying it as item in the `plugins` array. All rules have same name as the [commitlint][commitlint] rules, but with the `function-rules` prefix.
39+
40+
> **_Note:_** The available rules are the same as in [commitlint][commitlint], so it is recommended to disable the [commitlint][commitlint] rule when specifying a function rule to avoid undefined behaviour.
41+
42+
```js
43+
module.exports = {
44+
extends: ['@commitlint/config-conventional'],
45+
plugins: ['commitlint-plugin-function-rules'],
46+
rules: [
47+
'header-max-length': [0], // level: disabled
48+
'function-rules/header-max-length': [
49+
2, // level: error
50+
'always',
51+
(parsed) => {
52+
if (parsed.type === 'chore' && parsed.header.length < 20) {
53+
return [true];
54+
}
55+
return [false, 'chore header must not be longer than 120 characters'];
56+
},
57+
],
58+
]
59+
};
60+
```
61+
62+
## Documentation
1363

14-
| Badge | Description | Service |
15-
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------- |
16-
| <a href="https://github.com/prettier/prettier#readme"><img alt="code style" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a> | Code style | Prettier |
17-
| <a href="https://conventionalcommits.org"><img alt="Conventional Commits: 1.0.0" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square"></a> | Commit style | Conventional Commits |
18-
| <a href="https://github.com/semantic-release/semantic-release"><img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square"></a> | Version management | semantic-release |
19-
| <a href="https://renovatebot.com"><img alt="Renovate enabled" src="https://img.shields.io/badge/renovate-enabled-brightgreen.svg?style=flat-square"></a> | Dependencies | Renovate |
20-
| <a href="https://github.com/vidavidorra/commitlint-plugin-function-rules/actions"><img alt="GitHub workflow status" src="https://img.shields.io/github/workflow/status/vidavidorra/commitlint-plugin-function-rules/Lint%20commit%20messages?style=flat-square"></a> | Lint commit messages | GitHub Actions |
21-
| <a href="https://github.com/vidavidorra/commitlint-plugin-function-rules/actions"><img alt="GitHub workflow status" src="https://img.shields.io/github/workflow/status/vidavidorra/commitlint-plugin-function-rules/Build?style=flat-square"></a> | Build | GitHub Actions |
22-
| <a href="https://codecov.io/gh/vidavidorra/commitlint-plugin-function-rules"><img alt="Code coverage" src="https://img.shields.io/codecov/c/github/vidavidorra/commitlint-plugin-function-rules?style=flat-square"></a> | Code coverage | Codecov |
23-
| <a href="https://www.npmjs.com/package/commitlint-plugin-function-rules"><img alt="npm version" src="https://img.shields.io/npm/v/commitlint-plugin-function-rules?style=flat-square"></a> | npm version | npm |
64+
## Contributing
65+
66+
Please [create an issue](https://github.com/vidavidorra/commitlint-plugin-function-rules/issues/new/choose) if you have a bug report, feature proposal or question that does not yet exist.
67+
68+
Please give this project a star ⭐ if you like it and consider becoming a [sponsor](https://github.com/sponsors/jdbruijn) to support this project.
69+
70+
Refer to the [contributing guide](https://github.com/vidavidorra/.github/CONTRIBUTING.md) detailed information about other contributions, like pull requests.
71+
72+
[![Conventional Commits: 1.0.0](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)
73+
[![Code style](https://img.shields.io/badge/code_style-Prettier-ff69b4.svg?logo=prettier&style=flat-square)](https://github.com/prettier/prettier)
74+
[![Linting](https://img.shields.io/badge/linting-ESLint-lightgrey.svg?logo=eslint&style=flat-square)](https://eslint.org)
75+
[![Lint commit messages](https://img.shields.io/github/workflow/status/vidavidorra/commitlint-plugin-function-rules/Lint%20commit%20messages?logo=github&label=Lint%20commit%20messages&style=flat-square)](https://github.com/vidavidorra/commitlint-plugin-function-rules/actions)
76+
[![Build](https://img.shields.io/github/workflow/status/vidavidorra/commitlint-plugin-function-rules/Build?logo=github&label=Build&style=flat-square)](https://github.com/vidavidorra/commitlint-plugin-function-rules/actions)
77+
78+
## Security policy
79+
80+
Please refer to the [Security Policy on GitHub](https://github.com/vidavidorra/commitlint-plugin-function-rules/security/) for the security policy.
2481

2582
## License
2683

@@ -47,3 +104,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47104
The full text of the license is available in the [LICENSE](LICENSE.md) file in this repository and [online](https://www.gnu.org/licenses/gpl.html).
48105

49106
</details>
107+
108+
<!-- References -->
109+
110+
[commitlint]: https://commitlint.js.org/

0 commit comments

Comments
 (0)