1 | > Lint a string against commitlint rules
|
2 |
|
3 | # @commitlint/lint
|
4 |
|
5 | ## Getting started
|
6 |
|
7 | ```shell
|
8 | npm install --save @commitlint/lint
|
9 | ```
|
10 |
|
11 | ## Example
|
12 |
|
13 | ```js
|
14 | const lint = require('@commitlint/lint').default;
|
15 |
|
16 | lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then((report) =>
|
17 | console.log(report)
|
18 | );
|
19 | // => { valid: true, errors: [], warnings: [] }
|
20 |
|
21 | lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then((report) =>
|
22 | console.log(report)
|
23 | );
|
24 | /* =>
|
25 | { valid: true,
|
26 | errors: [],
|
27 | warnings:
|
28 | [ { level: 1,
|
29 | valid: false,
|
30 | name: 'type-enum',
|
31 | message: 'type must be one of [bar]' } ] }
|
32 | */
|
33 | ```
|
34 |
|
35 | Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation.
|