Last active
June 10, 2021 12:14
-
-
Save jozsefs/9a1431093c2ad580a4f53e61ce36a853 to your computer and use it in GitHub Desktop.
eslint collect errors warnings counted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy eslint output here replace ` to ' before copying to avoid js error | |
str = ``; | |
str.split(/\n/) | |
// get rules from the lines containing warning or error | |
.map(t => { | |
const match = t.match(/^\s+(\d+\:\d+).+\s+([0-9@_\/\-a-zA-Z]+)$/); | |
return match && match[2]; | |
}) | |
// remove nulls | |
.filter(i => i) | |
// create object with count | |
.reduce((acc, rule) => ({...acc, [rule]: acc[rule] ? acc[rule] + 1 : 1}), {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment