UNPKG

472 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Omit any properties starting with `_`, which are fake-private
5 *
6 * @type {import('stylelint').Formatter}
7 */
8module.exports = function jsonFormatter(results) {
9 const cleanedResults = results.map((result) =>
10 Object.entries(result)
11 .filter(([key]) => !key.startsWith('_'))
12 .reduce((/** @type {{ [key: string]: any }} */ obj, [key, value]) => {
13 obj[key] = value;
14
15 return obj;
16 }, {}),
17 );
18
19 return JSON.stringify(cleanedResults);
20};