Skip to content

Commit 8991e31

Browse files
committed
Refactor code-style
1 parent 73bccbb commit 8991e31

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
* @returns {Style|null}
1010
*/
1111
export function headingStyle(node, relative) {
12-
var last = node.children[node.children.length - 1]
13-
var depth = node.depth
14-
var pos = node && node.position && node.position.end
15-
var final = last && last.position && last.position.end
12+
const last = node.children[node.children.length - 1]
13+
const depth = node.depth
14+
const pos = node && node.position && node.position.end
15+
const final = last && last.position && last.position.end
1616

1717
if (!pos) {
1818
return null

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@
6565
"trailingComma": "none"
6666
},
6767
"xo": {
68-
"prettier": true,
69-
"rules": {
70-
"no-var": "off",
71-
"prefer-arrow-callback": "off"
72-
}
68+
"prettier": true
7369
},
7470
"remarkConfig": {
7571
"plugins": [

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ npm install mdast-util-heading-style
2424
## Use
2525

2626
```js
27-
import unified from 'unified'
28-
import remarkParse from 'remark-parse'
27+
import {unified} from 'unified'
2928
import {headingStyle} from 'mdast-util-heading-style'
29+
import remarkParse from 'remark-parse'
3030

31-
var processor = unified().use(remarkParse)
31+
const processor = unified().use(remarkParse)
3232

3333
headingStyle(processor.parse('# ATX').children[0]) // => 'atx'
3434
headingStyle(processor.parse('# ATX #\n').children[0]) // => 'atx-closed'

test.js

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

10-
test('headingStyle', function (t) {
11-
t.throws(function () {
10+
test('headingStyle', (t) => {
11+
t.throws(() => {
1212
// @ts-ignore runtime.
1313
headingStyle()
1414
}, 'should fail without node')

0 commit comments

Comments
 (0)