eslint-rule-benchmark
Version:
Benchmark ESLint rules with detailed performance metrics for CI and plugin development
24 lines (23 loc) • 713 B
JavaScript
import { useMarkdownReport } from './use-markdown-report.js'
import { useConsoleReport } from './use-console-report.js'
import { useJsonReport } from './use-json-report.js'
let reporters = {
markdown: useMarkdownReport,
console: useConsoleReport,
json: useJsonReport,
}
async function createReporter(results, userConfig, format = 'console') {
if (!(format in reporters)) {
throw new Error(
`Unknown reporter format "${format}". Available formats: ${new Intl.ListFormat(
'en',
{
type: 'conjunction',
style: 'long',
},
).format(Object.keys(reporters))}`,
)
}
return await reporters[format](results, userConfig)
}
export { createReporter }