Skip to content

Commit 9b23b90

Browse files
committed
Update xo
1 parent d9ddc7f commit 9b23b90

File tree

2 files changed

+49
-48
lines changed

2 files changed

+49
-48
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"tape": "^5.0.0",
4949
"type-coverage": "^2.0.0",
5050
"typescript": "^4.0.0",
51-
"xo": "^0.39.0"
51+
"xo": "^0.42.0"
5252
},
5353
"scripts": {
5454
"prepack": "npm run build && npm run format",

Diff for: test.js

+48-47
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ test('mdast-util-heading-range()', (t) => {
6969
t,
7070
['# Fo', '', '## Fooooo', '', 'Bar', '', '# Fo', ''].join('\n'),
7171
/** @type {Options} */
72-
(value) => {
73-
return value.toLowerCase().indexOf('foo') === 0
74-
}
72+
(value) => value.toLowerCase().indexOf('foo') === 0
7573
),
7674
['# Fo', '', '## Fooooo', '', '# Fo', ''].join('\n'),
7775
'should accept a heading as a function'
@@ -139,14 +137,13 @@ test('mdast-util-heading-range()', (t) => {
139137
)
140138

141139
remark()
142-
.use(() => {
143-
return function (node) {
144-
const root = /** @type {Root} */ (node)
145-
headingRange(root, 'foo', () => {
146-
return null
147-
})
148-
}
149-
})
140+
.use(
141+
() =>
142+
function (node) {
143+
const root = /** @type {Root} */ (node)
144+
headingRange(root, 'foo', () => null)
145+
}
146+
)
150147
.process(['Foo', '', '## Foo', '', 'Bar', ''].join('\n'), (error, file) => {
151148
t.ifError(error, 'should not fail (#1)')
152149

@@ -158,14 +155,13 @@ test('mdast-util-heading-range()', (t) => {
158155
})
159156

160157
remark()
161-
.use(() => {
162-
return function (node) {
163-
const root = /** @type {Root} */ (node)
164-
headingRange(root, 'foo', () => {
165-
return []
166-
})
167-
}
168-
})
158+
.use(
159+
() =>
160+
function (node) {
161+
const root = /** @type {Root} */ (node)
162+
headingRange(root, 'foo', () => [])
163+
}
164+
)
169165
.process(['Foo', '', '## Foo', '', 'Bar', ''].join('\n'), (error, file) => {
170166
t.ifError(error, 'should not fail (#2)')
171167

@@ -177,14 +173,17 @@ test('mdast-util-heading-range()', (t) => {
177173
})
178174

179175
remark()
180-
.use(() => {
181-
return function (node) {
182-
const root = /** @type {Root} */ (node)
183-
headingRange(root, 'foo', (start, _, end) => {
184-
return [start, {type: 'thematicBreak'}, end]
185-
})
186-
}
187-
})
176+
.use(
177+
() =>
178+
function (node) {
179+
const root = /** @type {Root} */ (node)
180+
headingRange(root, 'foo', (start, _, end) => [
181+
start,
182+
{type: 'thematicBreak'},
183+
end
184+
])
185+
}
186+
)
188187
.process(
189188
['Foo', '', '## Foo', '', 'Bar', '', '## Baz', ''].join('\n'),
190189
(error, file) => {
@@ -199,15 +198,16 @@ test('mdast-util-heading-range()', (t) => {
199198
)
200199

201200
remark()
202-
.use(() => {
203-
return function (node) {
204-
const root = /** @type {Root} */ (node)
205-
headingRange(root, 'foo', (start, nodes, end) => {
206-
t.equal(nodes.length, 3)
207-
return [start, ...nodes, end]
208-
})
209-
}
210-
})
201+
.use(
202+
() =>
203+
function (node) {
204+
const root = /** @type {Root} */ (node)
205+
headingRange(root, 'foo', (start, nodes, end) => {
206+
t.equal(nodes.length, 3)
207+
return [start, ...nodes, end]
208+
})
209+
}
210+
)
211211
.process(
212212
['# Alpha', '', '## Foo', '', 'one', '', 'two', '', 'three', ''].join(
213213
'\n'
@@ -329,17 +329,18 @@ test('mdast-util-heading-range()', (t) => {
329329
*/
330330
function process(t, value, options) {
331331
return remark()
332-
.use(() => {
333-
return function (node) {
334-
const root = /** @type {Root} */ (node)
335-
headingRange(root, options, (start, _, end, scope) => {
336-
t.equal(typeof scope.start, 'number')
337-
t.assert(typeof scope.end === 'number' || scope.end === null)
338-
t.equal(scope.parent && scope.parent.type, 'root')
339-
return [start, end]
340-
})
341-
}
342-
})
332+
.use(
333+
() =>
334+
function (node) {
335+
const root = /** @type {Root} */ (node)
336+
headingRange(root, options, (start, _, end, scope) => {
337+
t.equal(typeof scope.start, 'number')
338+
t.assert(typeof scope.end === 'number' || scope.end === null)
339+
t.equal(scope.parent && scope.parent.type, 'root')
340+
return [start, end]
341+
})
342+
}
343+
)
343344
.processSync(value)
344345
.toString()
345346
}

0 commit comments

Comments
 (0)