Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 3bb1a7b

Browse files
committed
Refactor code-style
1 parent 85d6f60 commit 3bb1a7b

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

index.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function enterFootnoteDefinitionLabelString() {
4444
}
4545

4646
function exitFootnoteDefinitionLabelString(token) {
47-
var label = this.resume()
47+
const label = this.resume()
4848
this.stack[this.stack.length - 1].label = label
4949
this.stack[this.stack.length - 1].identifier = normalizeIdentifier(
5050
this.sliceSerialize(token)
@@ -64,7 +64,7 @@ function enterFootnoteCallString() {
6464
}
6565

6666
function exitFootnoteCallString(token) {
67-
var label = this.resume()
67+
const label = this.resume()
6868
this.stack[this.stack.length - 1].label = label
6969
this.stack[this.stack.length - 1].identifier = normalizeIdentifier(
7070
this.sliceSerialize(token)
@@ -84,9 +84,9 @@ function exitNote(token) {
8484
}
8585

8686
function footnoteReference(node, _, context) {
87-
var exit = context.enter('footnoteReference')
88-
var subexit = context.enter('reference')
89-
var reference = safe(context, association(node), {before: '^', after: ']'})
87+
const exit = context.enter('footnoteReference')
88+
const subexit = context.enter('reference')
89+
const reference = safe(context, association(node), {before: '^', after: ']'})
9090
subexit()
9191
exit()
9292
return '[^' + reference + ']'
@@ -97,9 +97,9 @@ function footnoteReferencePeek() {
9797
}
9898

9999
function footnote(node, _, context) {
100-
var exit = context.enter('footnote')
101-
var subexit = context.enter('label')
102-
var value = '^[' + phrasing(node, context, {before: '[', after: ']'}) + ']'
100+
const exit = context.enter('footnote')
101+
const subexit = context.enter('label')
102+
const value = '^[' + phrasing(node, context, {before: '[', after: ']'}) + ']'
103103
subexit()
104104
exit()
105105
return value
@@ -110,14 +110,12 @@ function footnotePeek() {
110110
}
111111

112112
function footnoteDefinition(node, _, context) {
113-
var exit = context.enter('footnoteDefinition')
114-
var subexit = context.enter('label')
115-
var label =
113+
const exit = context.enter('footnoteDefinition')
114+
const subexit = context.enter('label')
115+
const label =
116116
'[^' + safe(context, association(node), {before: '^', after: ']'}) + ']:'
117-
var value
118117
subexit()
119-
120-
value = indentLines(flow(node, context), map)
118+
const value = indentLines(flow(node, context), map)
121119
exit()
122120

123121
return value

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@
6060
"trailingComma": "none"
6161
},
6262
"xo": {
63-
"prettier": true,
64-
"rules": {
65-
"no-var": "off",
66-
"prefer-arrow-callback": "off"
67-
}
63+
"prettier": true
6864
},
6965
"remarkConfig": {
7066
"plugins": [

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import toMarkdown from 'mdast-util-to-markdown'
44
import footnote from 'micromark-extension-footnote'
55
import {footnoteFromMarkdown, footnoteToMarkdown} from './index.js'
66

7-
test('markdown -> mdast', function (t) {
7+
test('markdown -> mdast', (t) => {
88
t.deepEqual(
99
fromMarkdown('[^a]: b\nc\n\n d', {
1010
extensions: [footnote()],
@@ -163,7 +163,7 @@ test('markdown -> mdast', function (t) {
163163
t.end()
164164
})
165165

166-
test('mdast -> markdown', function (t) {
166+
test('mdast -> markdown', (t) => {
167167
t.deepEqual(
168168
toMarkdown(
169169
{type: 'footnoteReference', identifier: 'a'},

0 commit comments

Comments
 (0)