Skip to content

Commit e02e8ae

Browse files
committed
Update dev-dependencies
1 parent 942ebf8 commit e02e8ae

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

index.js

+8-14
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ function diff() {
5454
findUp.one('.git', file.dirname, ongit)
5555
}
5656

57-
function ongit(err, git) {
57+
function ongit(error, git) {
5858
/* istanbul ignore if - Never happens */
59-
if (err) {
60-
return next(err)
59+
if (error) {
60+
return next(error)
6161
}
6262

6363
/* istanbul ignore if - Not testable in a Git repo… */
@@ -108,19 +108,13 @@ function diff() {
108108
return next()
109109
}
110110

111-
file.messages = file.messages.filter(filter)
111+
file.messages = file.messages.filter((message) =>
112+
ranges.some(
113+
(range) => message.line >= range[0] && message.line <= range[1]
114+
)
115+
)
112116

113117
next()
114-
115-
function filter(message) {
116-
var line = message.line
117-
118-
return ranges.some(some)
119-
120-
function some(range) {
121-
return line >= range[0] && line <= range[1]
122-
}
123-
}
124118
}
125119
}
126120
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"tape": "^5.0.0",
4444
"to-vfile": "^6.0.0",
4545
"unist-util-visit": "^2.0.0",
46-
"xo": "^0.36.0"
46+
"xo": "^0.38.0"
4747
},
4848
"scripts": {
4949
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",

test/index.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var promisify = require('util').promisify
66
var test = require('tape')
77
var rimraf = promisify(require('rimraf'))
88
var vfile = require('to-vfile')
9-
var processor = require('./processor')()
9+
var processor = require('./processor.js')()
1010

1111
var exec = promisify(cp.exec)
1212

@@ -49,7 +49,7 @@ test('diff() (travis)', function (t) {
4949
)
5050
.then((file) => {
5151
t.deepEqual(
52-
file.messages.map(String),
52+
file.messages.map((m) => String(m)),
5353
['example.txt:1:1-1:6: No lorem!', 'example.txt:3:1-3:6: No lorem!'],
5454
'should set messages'
5555
)
@@ -74,7 +74,7 @@ test('diff() (travis)', function (t) {
7474
})
7575
.then((file) => {
7676
t.deepEqual(
77-
file.messages.map(String),
77+
file.messages.map((m) => String(m)),
7878
['example.txt:5:1-5:6: No lorem!'],
7979
'should show only messages for changed lines'
8080
)
@@ -85,7 +85,7 @@ test('diff() (travis)', function (t) {
8585
)
8686
.then((file) => {
8787
t.deepEqual(
88-
file.messages.map(String),
88+
file.messages.map((m) => String(m)),
8989
['example.txt:5:1-5:6: No lorem!'],
9090
'should not recheck (coverage for optimisations)'
9191
)
@@ -95,7 +95,11 @@ test('diff() (travis)', function (t) {
9595
processor.process(vfile({path: 'missing.txt', contents: other}))
9696
)
9797
.then((file) => {
98-
t.deepEqual(file.messages.map(String), [], 'should ignore unstaged files')
98+
t.deepEqual(
99+
file.messages.map((m) => String(m)),
100+
[],
101+
'should ignore unstaged files'
102+
)
99103
})
100104
// New file.
101105
.then(() => vfile.write({path: 'example.txt', contents: stepThree}))
@@ -114,7 +118,7 @@ test('diff() (travis)', function (t) {
114118
})
115119
.then((file) => {
116120
t.deepEqual(
117-
file.messages.map(String),
121+
file.messages.map((m) => String(m)),
118122
['example.txt:1:1-1:6: No lorem!', 'example.txt:6:1-6:6: No lorem!'],
119123
'should deal with multiple patches'
120124
)
@@ -123,7 +127,7 @@ test('diff() (travis)', function (t) {
123127
})
124128
.then((file) => {
125129
t.deepEqual(
126-
file.messages.map(String),
130+
file.messages.map((m) => String(m)),
127131
['new.txt:1:1-1:6: No lorem!'],
128132
'should deal with new files'
129133
)
@@ -175,7 +179,7 @@ test('diff() (GitHub Actions)', function (t) {
175179
})
176180
.then((file) => {
177181
t.deepEqual(
178-
file.messages.map(String),
182+
file.messages.map((m) => String(m)),
179183
['example.txt:5:1-5:6: No lorem!'],
180184
'should show only messages for this commit'
181185
)
@@ -202,7 +206,7 @@ test('diff() (GitHub Actions)', function (t) {
202206
})
203207
.then((file) => {
204208
t.deepEqual(
205-
file.messages.map(String),
209+
file.messages.map((m) => String(m)),
206210
['example.txt:1:1-1:6: No lorem!', 'example.txt:9:7-9:12: No lorem!'],
207211
'should deal with PRs'
208212
)

0 commit comments

Comments
 (0)