@bhsd/stylelint-browserify 16.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/bundle/stylelint.js.LEGAL.txt +12 -0
- package/bundle/stylelint.min.js +52 -0
- package/bundle/stylelint.min.js.map +7 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
The `stylelint` global variable has a `lint()` method.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
const result = await stylelint.lint(options);
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Options
|
|
10
|
+
|
|
11
|
+
### `config`
|
|
12
|
+
|
|
13
|
+
A [configuration object](https://stylelint.io/user-guide/configure).
|
|
14
|
+
|
|
15
|
+
### `code`
|
|
16
|
+
|
|
17
|
+
A string to lint.
|
|
18
|
+
|
|
19
|
+
## The returned promise
|
|
20
|
+
|
|
21
|
+
`stylelint.lint()` returns a `Promise` that resolves with an object containing the following properties:
|
|
22
|
+
|
|
23
|
+
### `code`
|
|
24
|
+
|
|
25
|
+
A string that contains the autofixed code, if the `fix` option is set to `true`. Otherwise, it is `undefined`.
|
|
26
|
+
|
|
27
|
+
### `errored`
|
|
28
|
+
|
|
29
|
+
Boolean. If `true`, at least one rule with an "error"-level severity registered a problem.
|
|
30
|
+
|
|
31
|
+
### `report`
|
|
32
|
+
|
|
33
|
+
A JSON string that contains the formatted problems.
|
|
34
|
+
|
|
35
|
+
### `results`
|
|
36
|
+
|
|
37
|
+
An array containing all the Stylelint result objects (the objects that formatters consume).
|
|
38
|
+
|
|
39
|
+
### Edit info
|
|
40
|
+
|
|
41
|
+
When the [`computeEditInfo` option](https://stylelint.io/user-guide/options#computeeditinfo) is enabled, a warning may include a `fix` property that provides information about suggested fixes:
|
|
42
|
+
|
|
43
|
+
- `range` (`[number, number]`) - the pair of 0-based indices in source code text to remove
|
|
44
|
+
- `text` (`string`) - the text to add
|
|
45
|
+
|
|
46
|
+
For example, to change `a { opacity: 10%; }` to `a { opacity: 0.1; }`, the `EditInfo` might look like:
|
|
47
|
+
|
|
48
|
+
```jsonc
|
|
49
|
+
{
|
|
50
|
+
// "line", "column", "rule", ...
|
|
51
|
+
"fix": {
|
|
52
|
+
"range": [13, 16], // Indices of "10%"
|
|
53
|
+
"text": "0.1" // Replacement text
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Only a single `EditInfo` will be recorded for a specific region in source code. If multiple report ranges overlap, only the first will contain `EditInfo`.
|
|
59
|
+
|
|
60
|
+
## Syntax errors
|
|
61
|
+
|
|
62
|
+
`stylelint.lint()` does not reject the `Promise` when your CSS contains syntax errors.
|
|
63
|
+
It resolves with an object (see [the returned promise](#the-returned-promise)) that contains information about the syntax error.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Bundled license information:
|
|
2
|
+
|
|
3
|
+
is-plain-object/dist/is-plain-object.mjs:
|
|
4
|
+
/*!
|
|
5
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
8
|
+
* Released under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
cssesc/cssesc.js:
|
|
12
|
+
/*! https://mths.be/cssesc v3.0.0 by @mathias */
|