leasot
Version:
Parse and output TODOs and FIXMEs from comments in your files
18 lines (17 loc) • 671 B
JavaScript
import { getTransformedComments, joinBlocksByHeaders, prepareConfig } from './custom.js';
const reporterConfig = {
transformComment(file, line, text, _tag, ref) {
if (ref) {
text = `@${ref} ${text}`;
}
return [`| [${file}](${file}#L${line}) | ${line} | ${text}`];
},
transformHeader(tag) {
return [`### ${tag}s`, `| Filename | line # | ${tag}`, '|:------|:------:|:------'];
},
};
export const reporter = (todos, config) => {
const parsedConfig = prepareConfig(reporterConfig, config);
const output = getTransformedComments(todos, parsedConfig);
return joinBlocksByHeaders(output, parsedConfig);
};