@alauda/doom
Version:
Doctor Doom making docs.
13 lines (12 loc) • 516 B
JavaScript
import { lintRule } from 'unified-lint-rule';
import { visitParents } from 'unist-util-visit-parents';
export const noEmptyTableCell = lintRule('doom-lint:no-empty-table-cell', (root, vfile) => {
visitParents(root, 'tableCell', (tableCell, parents) => {
if (!tableCell.children.length) {
vfile.message('Table cell cannot be empty, please add some content', {
ancestors: [...parents, tableCell],
place: tableCell.position,
});
}
});
});