Skip to content

Instantly share code, notes, and snippets.

@jamesridgway
Created March 19, 2019 13:34
Show Gist options
  • Save jamesridgway/897582b099f43a1b9c538bb04969d89f to your computer and use it in GitHub Desktop.
Save jamesridgway/897582b099f43a1b9c538bb04969d89f to your computer and use it in GitHub Desktop.
Calculate total number of errors and warnings from an eslint json output
 jq 'def sum(f): reduce .[] as $row (0; . + ($row|f) );[.[] | {"errorCount": .errorCount, "warningCount": .warningCount}] | . as $in | reduce (.[0] | keys)[] as $key ( {}; . + {($key): ($in | sum(.[$key]))})' eslint.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment