1 | 'use strict';
|
2 |
|
3 | const createPartialStylelintResult = require('./createPartialStylelintResult');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | module.exports = function (stylelint, postcssResult, filePath, cssSyntaxError) {
|
17 | let stylelintResult = createPartialStylelintResult(postcssResult, cssSyntaxError);
|
18 |
|
19 | return stylelint.getConfigForFile(filePath).then((configForFile) => {
|
20 |
|
21 | const config = (configForFile)
|
22 | .config;
|
23 | const file = stylelintResult.source || (cssSyntaxError && cssSyntaxError.file);
|
24 |
|
25 | if (config.resultProcessors) {
|
26 | config.resultProcessors.forEach((resultProcessor) => {
|
27 |
|
28 |
|
29 | const returned = resultProcessor(stylelintResult, file);
|
30 |
|
31 | if (returned) {
|
32 | stylelintResult = returned;
|
33 | }
|
34 | });
|
35 | }
|
36 |
|
37 | return stylelintResult;
|
38 | });
|
39 | };
|