Created
September 18, 2017 11:00
-
-
Save jahredhope/53aa2f0e6126444c896af56c0a1d114d to your computer and use it in GitHub Desktop.
Takes an eslint json file and pulls out the count of each error
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
// eslint -f json . > output.json | |
const data = require('./output.json'); | |
const result = {}; | |
const files = new Set(); | |
data | |
.filter(({ warningCount, errorCount }) => warningCount > 0 || errorCount > 0) | |
.forEach(fileProps => { | |
const { messages, filePath } = fileProps; | |
messages.forEach(props => { | |
const { ruleId } = props; | |
if (ruleId === 'no-unused-vars') { | |
files.add(filePath); | |
} | |
if (!result[ruleId]) { | |
result[ruleId] = 1; | |
} else { | |
result[ruleId]++; | |
} | |
}); | |
}); | |
console.log(result); | |
console.log('Files with issues', files.size); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment