You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
429 B
22 lines
429 B
|
2 years ago
|
'use strict';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @typedef {import('stylelint').Severity} Severity
|
||
|
|
*
|
||
|
|
* @param {Severity} severity
|
||
|
|
* @param {Record<Severity, number>} counts
|
||
|
|
* @returns {void}
|
||
|
|
*/
|
||
|
|
module.exports = function calcSeverityCounts(severity, counts) {
|
||
|
|
switch (severity) {
|
||
|
|
case 'error':
|
||
|
|
counts.error += 1;
|
||
|
|
break;
|
||
|
|
case 'warning':
|
||
|
|
counts.warning += 1;
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
throw new Error(`Unknown severity: "${severity}"`);
|
||
|
|
}
|
||
|
|
};
|