diff --git a/index.js b/index.js index 14e01e7..a9a7f30 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,6 @@ /** + * @typedef {import('nlcst').Root} Root + * * @typedef {0|1|2|'newline'|'space'|'double-space'|null|undefined} Preferred * * @typedef Options @@ -21,13 +23,9 @@ const source = 'retext-sentence-spacing' * Plugin to check spacing between sentences. * Emit warnings when the spacing does not adhere to the preferred style. * - * @type {import('unified').Plugin<[Options?]>} + * @type {import('unified').Plugin<[Options?], Root>} */ export default function retextSentenceSpacing(options = {}) { - /** - * @typedef {import('unist').Parent} Parent - */ - let preferred = options.preferred if (preferred === 'newline') { @@ -55,7 +53,7 @@ export default function retextSentenceSpacing(options = {}) { } return (tree, file) => { - visit(tree, 'ParagraphNode', (/** @type {Parent} */ node) => { + visit(tree, 'ParagraphNode', (node) => { let index = -1 while (++index < node.children.length) { diff --git a/package.json b/package.json index 27bf21d..c47059a 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "index.js" ], "dependencies": { + "@types/nlcst": "^1.0.0", "@types/unist": "^2.0.0", "nlcst-to-string": "^3.0.0", "unified": "^10.0.0",