UNPKG

eslint-plugin-mdx

Version:
28 lines • 921 B
import { ENABLED_OPTION_SCHEMA, getRuleConfig } from './helpers.js'; export const tablePipes = { meta: { type: 'layout', docs: { description: 'Enforce table pipes' }, schema: [ENABLED_OPTION_SCHEMA], }, create(context) { const config = getRuleConfig(context, 'table-pipes'); if (!config) { return {}; } return { MDTable(node) { for (const row of node.children) { const trimmed = row.raw.trim(); if (!trimmed.startsWith('|') || !trimmed.endsWith('|')) { context.report({ loc: row.loc, message: 'Unexpected table row without leading or trailing pipe', }); } } }, }; }, }; //# sourceMappingURL=table-pipes.js.map