Calculates the severity of a eslint.linter.verify result
@param {Array} result Eslint verify result array
@param {Object} config Eslint eslint/lib/config
@return {Number} If the returned number is greater than 0 the result contains errors.
function getResultSeverity (result, config) {
  // Count all errors
  return result.reduce((previous, message) => {
    let severity

    if (message.fatal) {
      return previous + 1
    }

    severity = message.messages[0] ? message.messages[0].severity : 0

    if (severity === 2) {
      return previous + 1
    }

    return previous
  }, 0)
}