11# API
22
3- ## Install
3+ ## @commitlint/format
4+
5+ > Format commitlint reports
6+
7+ ### Install
48
59```
6- npm install --save @commitlint/core
10+ npm install --save @commitlint/format
711```
812
9- ## Methods
10-
11- ### format
12- > Format commitlint report data to a human-readable format
13+ ### Usage
1314
1415* ** Signature**
1516
@@ -47,7 +48,7 @@ format(report?: Report = {}, options?: formatOptions = {}) => string[];
4748* ** Example**
4849
4950``` js
50- const { format } = require (' @commitlint/core ' );
51+ const format = require (' @commitlint/format ' );
5152
5253format (); // => [ '\u001b[1m\u001b[32m✔\u001b[39m found 0 problems, 0 warnings\u001b[22m' ]
5354
@@ -82,9 +83,17 @@ format({
8283] */
8384```
8485
85- ### load
86+ ## @commitlint/load
87+
88+ > Load shared commitlint configuration
89+
90+ ### Install
8691
87- > load all relevant shared configuration
92+ ```
93+ npm install --save @commitlint/load
94+ ```
95+
96+ ### Usage
8897
8998* ** Signature**
9099
@@ -186,7 +195,7 @@ load(seed: Seed = {}) => Promise<Config>;
186195* ** Example**
187196
188197``` js
189- const { load } = require (' @commitlint/core ' );
198+ const load = require (' @commitlint/load ' );
190199
191200load ({
192201 rules: {
@@ -205,9 +214,17 @@ load({parserPreset: './parser-preset.js'})
205214// => { extends: [], rules: {}, parserPreset: {name: './parser-preset.js', path: './parser-preset.js', opts: {}}}
206215```
207216
208- ### read
217+ ### @ commitlint/ read
209218
210- > Read commit messages from as specified range
219+ > Read commit messages from a specified range or disk
220+
221+ ### Install
222+
223+ ```
224+ npm install --save @commitlint/read
225+ ```
226+
227+ ### Usage
211228
212229* ** Signature**
213230
@@ -228,7 +245,7 @@ read(range: Range) => Promise<string[]>
228245
229246``` js
230247// git commit -m "I did something"
231- const { read } = require (' @commitlint/core ' );
248+ const read = require (' @commitlint/read ' );
232249
233250read ({edit: true })
234251 .then (messages => console .log (messages));
@@ -249,6 +266,16 @@ read({from: 'HEAD~2', to: 'HEAD~1'})
249266
250267### lint
251268
269+ > Lint a string against commitlint rules
270+
271+ ### Install
272+
273+ ```
274+ npm install --save @commitlint/lint
275+ ```
276+
277+ ### Usage
278+
252279* ** Signature**
253280
254281``` ts
@@ -284,7 +311,7 @@ lint(message: string, rules: {[ruleName: string]: Rule}, opts?: Options) => Prom
284311* ** Basic Example**
285312
286313``` js
287- const { lint } = require (' @commitlint/core ' );
314+ const lint = require (' @commitlint/lint ' );
288315
289316lint (' foo: bar' )
290317 .then (report => console .log (report));
@@ -315,10 +342,11 @@ lint('foo-bar', {'type-enum': [2, 'always', ['foo']]}, opts).then(report => cons
315342* ** Load configuration**
316343
317344``` js
318- const {lint , load } = require (' @commitlint/core' );
345+ const load = require (' @commitlint/load' );
346+ const lint = require (' @commitlint/lint' );
319347
320348const CONFIG = {
321- extends: [' ./ @commitlint/config-conventional' ]
349+ extends: [' @commitlint/config-conventional' ]
322350};
323351
324352load (CONFIG )
@@ -338,7 +366,8 @@ load(CONFIG)
338366* ** Read git history**
339367
340368``` js
341- const {lint , read } = require (' @commitlint/core' );
369+ const lint = require (' @commitlint/lint' );
370+ const read = require (' @commitlint/read' );
342371
343372const RULES = {
344373 ' type-enum' : [2 , ' always' , [' foo' ]]
@@ -353,7 +382,9 @@ read({to: 'HEAD', from: 'HEAD~2'})
353382* ** Simplfied last-commit checker**
354383
355384``` js
356- const {lint , load , read } = require (' @commitlint/core' );
385+ const load = require (' @commitlint/load' );
386+ const read = require (' @commitlint/read' );
387+ const lint = require (' @commitlint/lint' );
357388
358389Promise .all ([load (), read ({from: ' HEAD~1' })])
359390 .then (tasks => {
0 commit comments