Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Feb 14, 2021
1 parent 611a842 commit d3f13a5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 44 deletions.
26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function pipelineParse(p, ctx) {
function pipelineRun(p, ctx, next) {
p.run(ctx.tree, ctx.file, done)

function done(err, tree, file) {
if (err) {
next(err)
function done(error, tree, file) {
if (error) {
next(error)
} else {
ctx.tree = tree
ctx.file = file
Expand Down Expand Up @@ -287,10 +287,10 @@ function unified() {
function executor(resolve, reject) {
transformers.run(node, vfile(file), done)

function done(err, tree, file) {
function done(error, tree, file) {
tree = tree || node
if (err) {
reject(err)
if (error) {
reject(error)
} else if (resolve) {
resolve(tree)
} else {
Expand All @@ -312,10 +312,10 @@ function unified() {

return result

function done(err, tree) {
function done(error, tree) {
complete = true
result = tree
bail(err)
bail(error)
}
}

Expand Down Expand Up @@ -357,9 +357,9 @@ function unified() {

pipeline.run(processor, {file: file}, done)

function done(err) {
if (err) {
reject(err)
function done(error) {
if (error) {
reject(error)
} else if (resolve) {
resolve(file)
} else {
Expand All @@ -385,9 +385,9 @@ function unified() {

return file

function done(err) {
function done(error) {
complete = true
bail(err)
bail(error)
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"remark-preset-wooorm": "^8.0.0",
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"xo": "^0.36.0"
"xo": "^0.37.0"
},
"scripts": {
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
Expand Down Expand Up @@ -95,6 +95,7 @@
"rules": {
"guard-for-in": "off",
"no-unreachable-loop": "off",
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/prefer-reflect-apply": "off",
"unicorn/prefer-type-error": "off"
Expand Down
4 changes: 2 additions & 2 deletions test/async-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ test('async function transformer () {}', function (t) {

unified()
.use(plugin)
.run(givenNode, givenFile, function (err, tree, file) {
t.error(err, 'should’t fail')
.run(givenNode, givenFile, function (error, tree, file) {
t.error(error, 'should’t fail')
t.equal(tree, modifiedNode, 'passes given tree to `done`')
t.equal(file, givenFile, 'passes given file to `done`')
})
Expand Down
4 changes: 2 additions & 2 deletions test/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ test('process(file, done)', function (t) {
return 'charlie'
}
})
.process(givenFile, function (err, file) {
t.error(err, 'shouldn’t fail')
.process(givenFile, function (error, file) {
t.error(error, 'shouldn’t fail')

t.equal(
file.toString(),
Expand Down
52 changes: 26 additions & 26 deletions test/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ test('run(node[, file], done)', function (t) {

t.plan(21)

unified().run(givenNode, givenFile, function (err, tree, file) {
t.error(err, 'should’t fail')
unified().run(givenNode, givenFile, function (error, tree, file) {
t.error(error, 'should’t fail')
t.equal(tree, givenNode, 'passes given tree to `done`')
t.equal(file, givenFile, 'passes given file to `done`')
})

unified().run(givenNode, null, function (err, tree, file) {
t.error(err, 'should’t fail')
unified().run(givenNode, null, function (error, tree, file) {
t.error(error, 'should’t fail')
t.equal(file.toString(), '', 'passes file to `done` if not given')
})

unified().run(givenNode, function (err, tree, file) {
t.error(err, 'should’t fail')
unified().run(givenNode, function (error, tree, file) {
t.error(error, 'should’t fail')
t.equal(file.toString(), '', 'passes file to `done` if omitted')
})

Expand All @@ -34,9 +34,9 @@ test('run(node[, file], done)', function (t) {
return new Error('charlie')
}
})
.run(givenNode, function (err) {
.run(givenNode, function (error) {
t.equal(
String(err),
String(error),
'Error: charlie',
'should pass an error to `done` from a sync transformer'
)
Expand All @@ -49,8 +49,8 @@ test('run(node[, file], done)', function (t) {
return otherNode
}
})
.run(givenNode, function (err, tree) {
t.error(err, 'should’t fail')
.run(givenNode, function (error, tree) {
t.error(error, 'should’t fail')

t.equal(
tree,
Expand All @@ -66,9 +66,9 @@ test('run(node[, file], done)', function (t) {
next(new Error('delta'))
}
})
.run(givenNode, function (err) {
.run(givenNode, function (error) {
t.equal(
String(err),
String(error),
'Error: delta',
'should pass an error to `done`, if given to a sync transformer’s `next`'
)
Expand All @@ -82,9 +82,9 @@ test('run(node[, file], done)', function (t) {
next(new Error('delta'))
}
})
.run(givenNode, function (err) {
.run(givenNode, function (error) {
t.error(
err,
error,
'should ignore multiple invocations of `next`when invoked in a synchroneous transformer'
)
})
Expand All @@ -96,8 +96,8 @@ test('run(node[, file], done)', function (t) {
next(null, otherNode)
}
})
.run(givenNode, function (err, tree) {
t.error(err, 'should’t fail')
.run(givenNode, function (error, tree) {
t.error(error, 'should’t fail')

t.equal(
tree,
Expand All @@ -117,9 +117,9 @@ test('run(node[, file], done)', function (t) {
reject(new Error('delta'))
}
})
.run(givenNode, function (err) {
.run(givenNode, function (error) {
t.equal(
String(err),
String(error),
'Error: delta',
'should pass an error to `done` rejected from a sync transformer’s returned promise'
)
Expand All @@ -136,8 +136,8 @@ test('run(node[, file], done)', function (t) {
resolve(otherNode)
}
})
.run(givenNode, function (err, tree) {
t.error(err, 'should’t fail')
.run(givenNode, function (error, tree) {
t.error(error, 'should’t fail')

t.equal(
tree,
Expand All @@ -156,8 +156,8 @@ test('run(node[, file], done)', function (t) {
}
}
})
.run(givenNode, function (err, tree) {
t.error(err, 'should’t fail')
.run(givenNode, function (error, tree) {
t.error(error, 'should’t fail')

t.equal(
tree,
Expand All @@ -176,9 +176,9 @@ test('run(node[, file], done)', function (t) {
}
}
})
.run(givenNode, function (err) {
.run(givenNode, function (error) {
t.equal(
String(err),
String(error),
'Error: echo',
'should pass an error to `done` given to `next` from an asynchroneous transformer'
)
Expand All @@ -195,9 +195,9 @@ test('run(node[, file], done)', function (t) {
}
}
})
.run(givenNode, function (err) {
.run(givenNode, function (error) {
t.error(
err,
error,
'should ignore multiple invocations of `next`when invoked from an asynchroneous transformer'
)
})
Expand Down

0 comments on commit d3f13a5

Please sign in to comment.