compactFormatter.cjs 682 B

1234567891011121314151617181920212223242526272829
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const preprocessWarnings = require('./preprocessWarnings.cjs');
  5. /**
  6. * @type {import('stylelint').Formatter}
  7. */
  8. function compactFormatter(results) {
  9. const lines = results.flatMap((result) => {
  10. const { warnings } = preprocessWarnings(result);
  11. return warnings.map(
  12. (warning) =>
  13. `${result.source}: ` +
  14. `line ${warning.line}, ` +
  15. `col ${warning.column}, ` +
  16. `${warning.severity} - ` +
  17. `${warning.text}`,
  18. );
  19. });
  20. lines.push('');
  21. return lines.join('\n');
  22. }
  23. module.exports = compactFormatter;