mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-28 19:48:49 +01:00
Refactor to remove micromark helper getTokenTextByType, update getDescendantsByType to allow sub-arrays.
This commit is contained in:
parent
0f210d5c1a
commit
8cbbed8e79
7 changed files with 44 additions and 94 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorDetailIf } = require("../helpers");
|
||||
const { getDescendantsByType, getTokenTextByType } = require("../helpers/micromark.cjs");
|
||||
const { getDescendantsByType } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
const listStyleExamples = {
|
||||
|
|
@ -19,7 +19,7 @@ const listStyleExamples = {
|
|||
* @returns {number} List item value.
|
||||
*/
|
||||
function getOrderedListItemValue(listItemPrefix) {
|
||||
return Number(getTokenTextByType(listItemPrefix.children, "listItemValue"));
|
||||
return Number(getDescendantsByType(listItemPrefix, [ "listItemValue" ])[0].text);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue