import { load } from 'cheerio' ; import type EsLintRule from '../EsLintRule' ; param html param trSelector param nameIndex param descriptionIndex returns export default function parseRulesTable ( html , trSelector = 'tbody > tr:contains(✔)' , nameIndex = 3 , descriptionIndex = 4 ) { const $ = load ( html ) ; const trs = $ ( trSelector ) ; return trs . map ( ( _ , tr ) => { const ruleNameTd$ = $ ( `td:nth-child(${ nameIndex })` , tr ) ; const ruleDescriptionTd$ = $ ( `td:nth-child(${ descriptionIndex })` , tr ) ; return { name : ruleNameTd$ . text ( ) . trim ( ) , link : $ ( 'a' , ruleNameTd$ ) . attr ( 'href' ) , description : ruleDescriptionTd$ . text ( ) . trim ( ) , } ; } ) . get ( ) ; }