currently throwing error
Announcement opened this issue · 2 comments
Announcement commented
is this meant to only work with eslint/lint and not the rest of the unified ecosystem?
node english.js document.txt
output
C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\vfile-to-eslint\1.0.0\node_modules\vfile-to-eslint\index.js:2
module.exports = vfiles => vfiles.map(vfile => {
^
TypeError: vfiles.map is not a function
at module.exports.vfiles (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\vfile-to-eslint\1.0.0\node_modules\vfile-to-eslint\index.js:2:35)
at module.exports.vfiles (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\vfile-reporter-pretty\1.0.1\node_modules\vfile-reporter-pretty\index.js:5:50)
at C:\Users\Francis\Documents\Projects\app\source\shell\english.js:55:26
at done (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\unified\6.1.5\node_modules\unified\index.js:379:11)
at next (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\trough\1.0.1\node_modules\trough\index.js:58:14)
at done (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\trough\1.0.1\node_modules\trough\index.js:124:12)
at then (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\trough\1.0.1\node_modules\trough\index.js:131:5)
at wrapped (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\trough\1.0.1\node_modules\trough\index.js:114:9)
at next (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\trough\1.0.1\node_modules\trough\index.js:56:24)
at done (C:\Users\Francis\Documents\Projects\app\node_modules\.registry.npmjs.org\trough\1.0.1\node_modules\trough\index.js:124:12)
english.js
var english = require('retext-english')
var equality = require('retext-equality')
var readability = require('retext-readability')
var sentiment = require('retext-sentiment')
var simplify = require('retext-simplify')
var retextStringify = require('retext-stringify')
var overuse = require('retext-overuse')
var spell = require('retext-spell')
var retext = require('retext')
var report = require('vfile-reporter')
var fs = require('fs')
var globby = require('globby')
var dictionary = require('dictionary-en-us')
var pretty = require('vfile-reporter-pretty')
console.log(process.argv)
globby(process.argv.slice(2)).then(paths => {
paths.forEach(filename => {
console.log(`testing ${filename}`)
fs.readFile(filename, { encoding: 'utf8' }, function (error, contents) {
if (!error) {
test(contents)
}
})
})
})
function test (it) {
retext()
.use(english)
.use(equality)
.use(readability)
.use(sentiment)
.use(simplify)
.use(overuse)
.use(spell, dictionary)
.process(it, function (err, file) {
console.log(err || pretty(file))
})
}
wooorm commented
It was originally, yes.
vfile-reporter
supports some extra options that are not required for reporters, like that you can pass a single file. This project doesn’t.
Would you be interested in creating a PR to add support for passing a single file?
wooorm commented
Feel free to create a PR if you’d like to work on this!