1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | module.exports = function (results) {
|
12 | results.forEach((result) => {
|
13 |
|
14 | if (!result._postcssResult) {
|
15 | return;
|
16 | }
|
17 |
|
18 | const rangeData = result._postcssResult.stylelint.disabledRanges;
|
19 |
|
20 |
|
21 | const alreadyReported = new Set();
|
22 |
|
23 | Object.keys(rangeData).forEach((rule) => {
|
24 | rangeData[rule].forEach((range) => {
|
25 | if (range.description) return;
|
26 |
|
27 | if (alreadyReported.has(range.comment)) return;
|
28 |
|
29 | alreadyReported.add(range.comment);
|
30 |
|
31 |
|
32 |
|
33 | if (!range.comment.source || !range.comment.source.start) return;
|
34 |
|
35 | result.warnings.push({
|
36 | text: `Disable for "${rule}" is missing a description`,
|
37 | rule: '--report-descriptionless-disables',
|
38 | line: range.comment.source.start.line,
|
39 | column: range.comment.source.start.column,
|
40 | severity: 'error',
|
41 | });
|
42 | });
|
43 | });
|
44 | });
|
45 | };
|