Skip to content

Commit 5d6bf9a

Browse files
wagoidbyCedric
authored andcommitted
docs: add options parameter for load function (#867)
1 parent b131a18 commit 5d6bf9a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/reference-api.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,18 @@ type Config = {
217217
rules: {[ruleName: string]: Rule};
218218
};
219219

220-
load(seed: Seed = {}) => Promise<Config>;
220+
type LoadOptions = {
221+
/*
222+
* Path to the config file to load.
223+
*/
224+
file?: string;
225+
/*
226+
* The cwd to use when loading config from file parameter.
227+
*/
228+
cwd: string;
229+
};
230+
231+
load(seed: Seed = {}, options?: LoadOptions = {cwd: process.cwd()}) => Promise<Config>;
221232
```
222233

223234
* **Example**
@@ -240,6 +251,10 @@ load({extends: ['./package']})
240251
load({parserPreset: './parser-preset.js'})
241252
.then(config => console.log(config));
242253
// => { extends: [], rules: {}, parserPreset: {name: './parser-preset.js', path: './parser-preset.js', opts: {}}}
254+
255+
load({}, {file: '.commitlintrc.yml', cwd: process.cwd()})
256+
.then(config => console.log(config));
257+
// => { extends: [], rules: { 'body-leading-blank': [ 1, 'always' ] }, formatter: '@commitlint/format', plugins: {} }
243258
```
244259

245260
### @commitlint/read

0 commit comments

Comments
 (0)