Skip to content

Commit 082e8c6

Browse files
committed
Refactor code-style
1 parent b0c7aab commit 082e8c6

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function shiftHeading(tree, shift) {
2929

3030
/** @type {VisitElement} */
3131
function visitor(node) {
32-
var rank = headingRank(node)
32+
let rank = headingRank(node)
3333

3434
if (rank) {
3535
rank += shift

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,7 @@
7171
"trailingComma": "none"
7272
},
7373
"xo": {
74-
"prettier": true,
75-
"rules": {
76-
"no-var": "off",
77-
"prefer-arrow-callback": "off"
78-
}
74+
"prettier": true
7975
},
8076
"remarkConfig": {
8177
"plugins": [

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ npm install hast-util-shift-heading
2727
import {h} from 'hastscript'
2828
import {shiftHeading} from 'hast-util-shift-heading'
2929

30-
var tree = h('main', [
30+
const tree = h('main', [
3131
h('h1', 'Alpha'),
3232
h('p', 'Bravo'),
3333
h('h2', 'Charlie'),

test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import test from 'tape'
22
import {h} from 'hastscript'
33
import {shiftHeading} from './index.js'
44

5-
test('shiftHeading', function (t) {
5+
test('shiftHeading', (t) => {
66
t.throws(
7-
function () {
7+
() => {
88
// @ts-ignore runtime.
99
shiftHeading(h(''))
1010
},
@@ -13,31 +13,31 @@ test('shiftHeading', function (t) {
1313
)
1414

1515
t.throws(
16-
function () {
16+
() => {
1717
shiftHeading(h(''), Number.NaN)
1818
},
1919
/^Error: Expected a non-null finite integer, not `NaN`$/,
2020
'should throw when given not a number'
2121
)
2222

2323
t.throws(
24-
function () {
24+
() => {
2525
shiftHeading(h(''), 0.1)
2626
},
2727
/^Error: Expected a non-null finite integer, not `0.1`$/,
2828
'should throw when not given an integer'
2929
)
3030

3131
t.throws(
32-
function () {
32+
() => {
3333
shiftHeading(h(''), Number.POSITIVE_INFINITY)
3434
},
3535
/^Error: Expected a non-null finite integer, not `Infinity`$/,
3636
'should throw when not given a finite number'
3737
)
3838

3939
t.throws(
40-
function () {
40+
() => {
4141
shiftHeading(h(''), 0)
4242
},
4343
/^Error: Expected a non-null finite integer, not `0`$/,

0 commit comments

Comments
 (0)