Skip to content

Commit

Permalink
Use @types/nlcst
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 27, 2021
1 parent 44d7118 commit 9c79e5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/**
* @typedef {import('nlcst').Root} Root
* @typedef {import('nlcst').Word} Word
*
* @typedef Options
* Configuration.
* @property {string[]} [ignore]
Expand All @@ -18,7 +21,7 @@ const verbs = new Set(['am', 'are', 'were', 'being', 'is', 'been', 'was', 'be'])
/**
* Plugin to check for passive voice.
*
* @type {import('unified').Plugin<[Options?]>}
* @type {import('unified').Plugin<[Options?], Root>}
*/
export default function retextPassive(options = {}) {
const ignore = options.ignore || []
Expand All @@ -27,7 +30,7 @@ export default function retextPassive(options = {}) {

return (tree, file) => {
search(tree, phrases, (match, index, parent, phrase) => {
const before = findBefore(parent, index, 'WordNode')
const before = /** @type {Word} */ (findBefore(parent, index, 'WordNode'))

if (!before || !verbs.has(toString(before).toLowerCase())) {
return
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"list.js"
],
"dependencies": {
"@types/nlcst": "^1.0.0",
"nlcst-search": "^3.0.0",
"nlcst-to-string": "^3.0.0",
"unified": "^10.0.0",
Expand Down

0 comments on commit 9c79e5e

Please sign in to comment.