.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / formatters / needlessDisablesStringFormatter.js
1 "use strict";
2
3 const chalk = require("chalk");
4 const path = require("path");
5
6 function logFrom(fromValue) {
7   if (fromValue.charAt(0) === "<") return fromValue;
8   return path
9     .relative(process.cwd(), fromValue)
10     .split(path.sep)
11     .join("/");
12 }
13
14 module.exports = function(report) {
15   let output = "";
16
17   report.forEach(sourceReport => {
18     if (!sourceReport.ranges || sourceReport.ranges.length === 0) {
19       return;
20     }
21     output += "\n";
22     output += chalk.underline(logFrom(sourceReport.source)) + "\n";
23     sourceReport.ranges.forEach(range => {
24       output += `start: ${range.start}`;
25       if (range.end !== undefined) {
26         output += `, end: ${range.end}`;
27       }
28       output += "\n";
29     });
30   });
31
32   return output;
33 };