Skip to content

Commit ab8d80d

Browse files
committed
Refactor code-style
1 parent 8d411a6 commit ab8d80d

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import {convert} from 'unist-util-is'
1111

12-
export var findAfter =
12+
export const findAfter =
1313
/**
1414
* @type {(
1515
* (<T extends Node>(node: Parent, index: Node|number, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>) => T|null) &
@@ -24,7 +24,7 @@ export var findAfter =
2424
* @returns {Node|null}
2525
*/
2626
function (parent, index, test) {
27-
var is = convert(test)
27+
const is = convert(test)
2828

2929
if (!parent || !parent.type || !parent.children) {
3030
throw new Error('Expected parent node')

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,7 @@
6464
"trailingComma": "none"
6565
},
6666
"xo": {
67-
"prettier": true,
68-
"rules": {
69-
"import/no-mutable-exports": "off",
70-
"no-var": "off",
71-
"prefer-arrow-callback": "off"
72-
}
67+
"prettier": true
7368
},
7469
"remarkConfig": {
7570
"plugins": [

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ npm install unist-util-find-after
2727
import {u} from 'unist-builder'
2828
import {findAfter} from 'unist-util-find-after'
2929

30-
var tree = u('tree', [
30+
const tree = u('tree', [
3131
u('leaf', 'leaf 1'),
3232
u('node', [u('leaf', 'leaf 2'), u('leaf', 'leaf 3')]),
3333
u('leaf', 'leaf 4'),

test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import test from 'tape'
77
import remark from 'remark'
88
import {findAfter} from './index.js'
99

10-
var tree = remark().parse('Some _emphasis_, **importance**, and `code`.')
10+
const tree = remark().parse('Some _emphasis_, **importance**, and `code`.')
1111
/** @type {Parent} */
1212
// @ts-expect-error fine.
13-
var paragraph = tree.children[0]
14-
var children = paragraph.children
13+
const paragraph = tree.children[0]
14+
const children = paragraph.children
1515

16-
test('unist-util-find-after', function (t) {
16+
test('unist-util-find-after', (t) => {
1717
t.throws(
18-
function () {
18+
() => {
1919
// @ts-expect-error runtime.
2020
findAfter()
2121
},
@@ -24,7 +24,7 @@ test('unist-util-find-after', function (t) {
2424
)
2525

2626
t.throws(
27-
function () {
27+
() => {
2828
// @ts-expect-error runtime.
2929
findAfter({type: 'foo'})
3030
},
@@ -33,7 +33,7 @@ test('unist-util-find-after', function (t) {
3333
)
3434

3535
t.throws(
36-
function () {
36+
() => {
3737
// @ts-expect-error runtime.
3838
findAfter({type: 'foo', children: []})
3939
},
@@ -42,23 +42,23 @@ test('unist-util-find-after', function (t) {
4242
)
4343

4444
t.throws(
45-
function () {
45+
() => {
4646
findAfter({type: 'foo', children: []}, -1)
4747
},
4848
/Expected positive finite number as index/,
4949
'should fail without index (#2)'
5050
)
5151

5252
t.throws(
53-
function () {
53+
() => {
5454
findAfter({type: 'foo', children: []}, {type: 'bar'})
5555
},
5656
/Expected child node or index/,
5757
'should fail without index (#3)'
5858
)
5959

6060
t.throws(
61-
function () {
61+
() => {
6262
findAfter(
6363
{type: 'foo', children: [{type: 'bar'}, {type: 'baz'}]},
6464
0,
@@ -71,7 +71,7 @@ test('unist-util-find-after', function (t) {
7171
)
7272

7373
t.throws(
74-
function () {
74+
() => {
7575
findAfter(
7676
{type: 'foo', children: [{type: 'bar'}, {type: 'baz'}]},
7777
0,

0 commit comments

Comments
 (0)