/** * @fileoverview HTML reporter * @author Julian Laval */ "use strict"; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ const encodeHTML = (function() { const encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }; const matchHTML = /[&<>"']/ug; return function(code) { return code ? code.toString().replace(matchHTML, m => encodeHTMLRules[m] || m) : ""; }; }()); /** * Get the final HTML document. * @param {Object} it data for the document. * @returns {string} HTML document. */ function pageTemplate(it) { const { reportColor, reportSummary, date, results } = it; return `

# ESLint Report

${reportSummary} - Generated on ${date}

${results}