Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 12x 12x 2x 2x 1x 12x 12x | import cheerio from 'cheerio';
import * as logger from './logger.js';
function logWarningForMissingTbody(rootNode: cheerio.Root, path: string) {
const tables = rootNode('table');
for (let i = 0; i < tables.length; i += 1) {
const table = rootNode(tables[i]);
if (table.find('tbody').length === 0) {
logger.error(`Invalid HTML in ${path}.\n`
+ 'Table must have a tbody tag. Please correct this to avoid Vue hydration issues.\n');
}
}
}
export function checkForVueHydrationViolation(content: string, path: string) {
const $ = cheerio.load(content);
logWarningForMissingTbody($, path);
}
|