Skip to content

Commit e74388d

Browse files
committed
Update docs
1 parent 58b6c20 commit e74388d

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var Comb = require('csscomb-core');
1616
var comb = new Comb(options, 'css');
1717
```
1818

19-
For a simple example of usage take a look [at a template project](https://github.com/csscomb/core-template).
19+
For a simple example of usage take a look
20+
[at a template project](https://github.com/csscomb/core-template).
2021
Feel free to fork it and modify.
2122

2223
## List of public methods
@@ -60,6 +61,39 @@ Can be used inside plugin's `process` method.
6061

6162
- Return: *{String}* Syntax name
6263

64+
### comb.lintPath(path)
65+
66+
Lint a file or a directory.
67+
68+
- Params: *{String}* Path to file or directory</td>
69+
- Return: *{Promise}*
70+
71+
### comb.lintDirectory(path)
72+
73+
Lint all files in a directory.
74+
75+
- Params: *{String}* Path to file or directory</td>
76+
- Return: *{Promise}*
77+
78+
### comb.lintFile(path)
79+
80+
Lint a single file.
81+
82+
- Params: *{String}* Path to file
83+
- Return: *{Promise}*
84+
85+
### comb.lintString(string, options)
86+
87+
Lint a string.
88+
89+
- Params:
90+
*{String}* Code to process
91+
*{{context: String, filename: String, syntax: String}}* Options (optional)
92+
where *context* is
93+
Gonzales PE rule, *filename* is a file's name that is used to display errors and
94+
*syntax* is syntax name with `css` being a default value.
95+
- Return: *{Promise<Array>}* Resolves with list of found errors.
96+
6397
### comb.processPath(path)
6498

6599
Process a file or a directory.
@@ -91,7 +125,7 @@ Process a string.
91125
where *context* is
92126
Gonzales PE rule, *filename* is a file's name that is used to display errors and
93127
*syntax* is syntax name with `css` being a default value.
94-
- Return: *{String}* Processed string
128+
- Return: *{Promise<string>}* Resolves with processed string.
95129

96130
## Writing a plugin
97131

src/core.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class Comb {
2929
this.verbose = false;
3030
}
3131

32+
/**
33+
* Loads configuration from JSON.
34+
*
35+
* @param {!Object} config
36+
* @return {!Comb}
37+
*/
3238
configure(config) {
3339
if (typeof config !== 'object')
3440
// TODO: throw error
@@ -65,6 +71,8 @@ class Comb {
6571
}
6672

6773
/**
74+
* Lints all files in a directory.
75+
*
6876
* @param {String} path
6977
* @returns {Promise}
7078
*/
@@ -75,6 +83,8 @@ class Comb {
7583
}
7684

7785
/**
86+
* Lints a single file.
87+
*
7888
* @param {String} path
7989
* @returns {Promise}
8090
*/
@@ -86,6 +96,8 @@ class Comb {
8696
}
8797

8898
/**
99+
* Lints a file or a directory.
100+
*
89101
* @param {String} path
90102
*/
91103
lintPath(path) {
@@ -96,6 +108,8 @@ class Comb {
96108
}
97109

98110
/**
111+
* Lints a string.
112+
*
99113
* @param {String} text
100114
* @param {{context: String, filename: String, syntax: String}} options
101115
* @returns {Promise} Resolves with <Array> list of found errors.
@@ -183,7 +197,7 @@ class Comb {
183197
*
184198
* @param {String} text
185199
* @param {{context: String, filename: String, syntax: String}} options
186-
* @returns {String} Processed string
200+
* @returns {Promise<string>} Resolves in processed string
187201
*/
188202
processString(text, options) {
189203
return this._parseString(text, options)

0 commit comments

Comments
 (0)