Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 18, 2021
1 parent 5a36882 commit baa2325
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 244 deletions.
22 changes: 9 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
'use strict'

var difference = require('lodash.difference')
var search = require('nlcst-search')
var toString = require('nlcst-to-string')
var position = require('unist-util-position')
var findBefore = require('unist-util-find-before')
var patterns = require('./list')

module.exports = passive
import difference from 'lodash.difference'
import search from 'nlcst-search'
import toString from 'nlcst-to-string'
import position from 'unist-util-position'
import findBefore from 'unist-util-find-before'
import {list} from './list.js'

var source = 'retext-passive'

var verbs = ['am', 'are', 'were', 'being', 'is', 'been', 'was', 'be']

function passive(options) {
export default function retextPassive(options) {
var ignore = (options || {}).ignore || []
var list = difference(patterns, ignore)
var phrases = difference(list, ignore)

return transformer

// Search `tree` for violations.
function transformer(tree, file) {
search(tree, list, searcher)
search(tree, phrases, searcher)

function searcher(match, index, parent, phrase) {
var before = findBefore(parent, index, 'WordNode')
Expand Down
217 changes: 217 additions & 0 deletions list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
export const list = [
'awoken',
'awoke',
'beaten',
'beat',
'begun',
'began',
'bent',
'bitten',
'bit',
'bled',
'blown',
'blew',
'broken',
'broke',
'brought',
'built',
'bought',
'caught',
'chosen',
'chose',
'dealt',
'done',
'did',
'drawn',
'drew',
'driven',
'drove',
'eaten',
'ate',
'fed',
'felt',
'fought',
'found',
'forbidden',
'forbade',
'forgotten',
'forgot',
'forgiven',
'forgave',
'frozen',
'froze',
'gotten',
'got',
'given',
'gave',
'ground',
'grinded',
'hung',
'heard',
'hidden',
'hid',
'hit',
'held',
'hurt',
'kept',
'known',
'knew',
'laid',
'led',
'let',
'lost',
'made',
'meant',
'met',
'paid',
'proven',
'proved',
'put',
'read',
'ridden',
'rode',
'rung',
'rang',
'run',
'ran',
'said',
'seen',
'saw',
'sold',
'sent',
'shaken',
'shook',
'shaved',
'shot',
'shown',
'shut',
'sung',
'sunk',
'slain',
'slew',
'slid',
'spoken',
'spoke',
'spent',
'spun',
'split',
'spread',
'stolen',
'stole',
'struck',
'swept',
'swung',
'taken',
'took',
'taught',
'torn',
'tore',
'told',
'thought',
'thrown',
'threw',
'undergone',
'underwent',
'understood',
'upset',
'woken',
'woke',
'worn',
'wore',
'won',
'withdrawn',
'withdrew',
'written',
'wrote',
'been',
'born',
'become',
'beset',
'bet',
'bid',
'bidden',
'bound',
'bred',
'broadcast',
'burnt',
'burst',
'cast',
'clung',
'come',
'cost',
'crept',
'cut',
'dug',
'dived',
'dreamt',
'drunk',
'fallen',
'fit',
'fled',
'flung',
'flown',
'foregone',
'forsaken',
'gone',
'grown',
'knelt',
'knit',
'leapt',
'learnt',
'left',
'lent',
'lain',
'lighted',
'misspelt',
'mistaken',
'mown',
'overcome',
'overdone',
'overtaken',
'overthrown',
'pled',
'quit',
'rid',
'risen',
'sawn',
'sought',
'set',
'sewn',
'shaven',
'shorn',
'shed',
'shone',
'shod',
'shrunk',
'sat',
'slept',
'slung',
'slit',
'smitten',
'sown',
'sped',
'spilt',
'spit',
'sprung',
'stood',
'stuck',
'stung',
'stunk',
'stridden',
'strung',
'striven',
'sworn',
'swollen',
'swum',
'thrived',
'thrust',
'trodden',
'upheld',
'woven',
'wed',
'wept',
'wound',
'withheld',
'withstood',
'wrung'
]
Loading

0 comments on commit baa2325

Please sign in to comment.