Skip to content

Commit 08df4bc

Browse files
committed
Refactor code-style
1 parent d99e101 commit 08df4bc

File tree

115 files changed

+9673
-7572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+9673
-7572
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@
123123
"test/**/*.js"
124124
],
125125
"rules": {
126-
"import/no-unassigned-import": "off"
126+
"import/no-unassigned-import": "off",
127+
"no-await-in-loop": "off"
127128
}
128129
}
129130
],

packages/micromark-build/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import path from 'node:path'
88
import process from 'node:process'
99
import {fileURLToPath, pathToFileURL} from 'node:url'
1010
import {transformAsync as babel} from '@babel/core'
11-
import {resolve} from 'import-meta-resolve'
1211
import {glob} from 'glob'
13-
// @ts-expect-error: intyped.
12+
import {resolve} from 'import-meta-resolve'
13+
// @ts-expect-error: untyped.
1414
import RelativizeUrl from 'relativize-url'
1515

1616
const root = pathToFileURL(process.cwd())
@@ -42,7 +42,7 @@ while (++index < files.length) {
4242
}
4343

4444
const modules = ['micromark-util-symbol']
45-
.map((d) => {
45+
.map(function (d) {
4646
try {
4747
return resolve(d, input.href)
4848
} catch {}

packages/micromark-build/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ versions of Node.js.
118118

119119
When we cut a new major release, we drop support for unmaintained versions of
120120
Node.
121-
This means we try to keep the current release line, `micromark-build@^2`,
121+
This means we try to keep the current release line, `micromark-build@2`,
122122
compatible with Node.js 16.
123123

124124
## Security

packages/micromark-core-commonmark/dev/lib/attention.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
* Resolver,
88
* State,
99
* TokenizeContext,
10-
* Token,
11-
* Tokenizer
10+
* Tokenizer,
11+
* Token
1212
* } from 'micromark-util-types'
1313
*/
1414

15+
import {ok as assert} from 'devlop'
1516
import {push, splice} from 'micromark-util-chunked'
1617
import {classifyCharacter} from 'micromark-util-classify-character'
1718
import {resolveAll} from 'micromark-util-resolve-all'
1819
import {codes, constants, types} from 'micromark-util-symbol'
19-
import {ok as assert} from 'devlop'
2020

2121
/** @type {Construct} */
2222
export const attention = {
2323
name: 'attention',
24-
tokenize: tokenizeAttention,
25-
resolveAll: resolveAllAttention
24+
resolveAll: resolveAllAttention,
25+
tokenize: tokenizeAttention
2626
}
2727

2828
/**
@@ -99,34 +99,34 @@ function resolveAllAttention(events, context) {
9999
? 2
100100
: 1
101101

102-
const start = Object.assign({}, events[open][1].end)
103-
const end = Object.assign({}, events[index][1].start)
102+
const start = {...events[open][1].end}
103+
const end = {...events[index][1].start}
104104
movePoint(start, -use)
105105
movePoint(end, use)
106106

107107
openingSequence = {
108108
type: use > 1 ? types.strongSequence : types.emphasisSequence,
109109
start,
110-
end: Object.assign({}, events[open][1].end)
110+
end: {...events[open][1].end}
111111
}
112112
closingSequence = {
113113
type: use > 1 ? types.strongSequence : types.emphasisSequence,
114-
start: Object.assign({}, events[index][1].start),
114+
start: {...events[index][1].start},
115115
end
116116
}
117117
text = {
118118
type: use > 1 ? types.strongText : types.emphasisText,
119-
start: Object.assign({}, events[open][1].end),
120-
end: Object.assign({}, events[index][1].start)
119+
start: {...events[open][1].end},
120+
end: {...events[index][1].start}
121121
}
122122
group = {
123123
type: use > 1 ? types.strong : types.emphasis,
124-
start: Object.assign({}, openingSequence.start),
125-
end: Object.assign({}, closingSequence.end)
124+
start: {...openingSequence.start},
125+
end: {...closingSequence.end}
126126
}
127127

128-
events[open][1].end = Object.assign({}, openingSequence.start)
129-
events[index][1].start = Object.assign({}, closingSequence.end)
128+
events[open][1].end = {...openingSequence.start}
129+
events[index][1].start = {...closingSequence.end}
130130

131131
nextEvents = []
132132

@@ -204,6 +204,7 @@ function resolveAllAttention(events, context) {
204204

205205
/**
206206
* @this {TokenizeContext}
207+
* Context.
207208
* @type {Tokenizer}
208209
*/
209210
function tokenizeAttention(effects, ok) {
@@ -286,8 +287,11 @@ function tokenizeAttention(effects, ok) {
286287
* chunks (replacement characters, tabs, or line endings).
287288
*
288289
* @param {Point} point
290+
* Point.
289291
* @param {number} offset
292+
* Amount to move.
290293
* @returns {undefined}
294+
* Nothing.
291295
*/
292296
function movePoint(point, offset) {
293297
point.column += offset

packages/micromark-core-commonmark/dev/lib/autolink.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77
* } from 'micromark-util-types'
88
*/
99

10+
import {ok as assert} from 'devlop'
1011
import {
11-
asciiAlpha,
1212
asciiAlphanumeric,
13+
asciiAlpha,
1314
asciiAtext,
1415
asciiControl
1516
} from 'micromark-util-character'
1617
import {codes, constants, types} from 'micromark-util-symbol'
17-
import {ok as assert} from 'devlop'
1818

1919
/** @type {Construct} */
2020
export const autolink = {name: 'autolink', tokenize: tokenizeAutolink}
2121

2222
/**
2323
* @this {TokenizeContext}
24+
* Context.
2425
* @type {Tokenizer}
2526
*/
2627
function tokenizeAutolink(effects, ok, nok) {

packages/micromark-core-commonmark/dev/lib/blank-line.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
1212
import {codes, types} from 'micromark-util-symbol'
1313

1414
/** @type {Construct} */
15-
export const blankLine = {tokenize: tokenizeBlankLine, partial: true}
15+
export const blankLine = {partial: true, tokenize: tokenizeBlankLine}
1616

1717
/**
1818
* @this {TokenizeContext}
19+
* Context.
1920
* @type {Tokenizer}
2021
*/
2122
function tokenizeBlankLine(effects, ok, nok) {

packages/micromark-core-commonmark/dev/lib/block-quote.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88
* } from 'micromark-util-types'
99
*/
1010

11+
import {ok as assert} from 'devlop'
1112
import {factorySpace} from 'micromark-factory-space'
1213
import {markdownSpace} from 'micromark-util-character'
1314
import {codes, constants, types} from 'micromark-util-symbol'
14-
import {ok as assert} from 'devlop'
1515

1616
/** @type {Construct} */
1717
export const blockQuote = {
18-
name: 'blockQuote',
19-
tokenize: tokenizeBlockQuoteStart,
2018
continuation: {tokenize: tokenizeBlockQuoteContinuation},
21-
exit
19+
exit,
20+
name: 'blockQuote',
21+
tokenize: tokenizeBlockQuoteStart
2222
}
2323

2424
/**
2525
* @this {TokenizeContext}
26+
* Context.
2627
* @type {Tokenizer}
2728
*/
2829
function tokenizeBlockQuoteStart(effects, ok, nok) {
@@ -95,6 +96,7 @@ function tokenizeBlockQuoteStart(effects, ok, nok) {
9596
* ```
9697
*
9798
* @this {TokenizeContext}
99+
* Context.
98100
* @type {Tokenizer}
99101
*/
100102
function tokenizeBlockQuoteContinuation(effects, ok, nok) {

packages/micromark-core-commonmark/dev/lib/character-escape.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
* } from 'micromark-util-types'
88
*/
99

10+
import {ok as assert} from 'devlop'
1011
import {asciiPunctuation} from 'micromark-util-character'
1112
import {codes, types} from 'micromark-util-symbol'
12-
import {ok as assert} from 'devlop'
1313

1414
/** @type {Construct} */
1515
export const characterEscape = {
@@ -19,6 +19,7 @@ export const characterEscape = {
1919

2020
/**
2121
* @this {TokenizeContext}
22+
* Context.
2223
* @type {Tokenizer}
2324
*/
2425
function tokenizeCharacterEscape(effects, ok, nok) {

packages/micromark-core-commonmark/dev/lib/character-reference.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
* } from 'micromark-util-types'
99
*/
1010

11+
import {ok as assert} from 'devlop'
1112
import {decodeNamedCharacterReference} from 'decode-named-character-reference'
1213
import {
1314
asciiAlphanumeric,
1415
asciiDigit,
1516
asciiHexDigit
1617
} from 'micromark-util-character'
1718
import {codes, constants, types} from 'micromark-util-symbol'
18-
import {ok as assert} from 'devlop'
1919

2020
/** @type {Construct} */
2121
export const characterReference = {
@@ -25,6 +25,7 @@ export const characterReference = {
2525

2626
/**
2727
* @this {TokenizeContext}
28+
* Context.
2829
* @type {Tokenizer}
2930
*/
3031
function tokenizeCharacterReference(effects, ok, nok) {

packages/micromark-core-commonmark/dev/lib/code-fenced.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@
88
* } from 'micromark-util-types'
99
*/
1010

11+
import {ok as assert} from 'devlop'
1112
import {factorySpace} from 'micromark-factory-space'
1213
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
1314
import {codes, constants, types} from 'micromark-util-symbol'
14-
import {ok as assert} from 'devlop'
1515

1616
/** @type {Construct} */
1717
const nonLazyContinuation = {
18-
tokenize: tokenizeNonLazyContinuation,
19-
partial: true
18+
partial: true,
19+
tokenize: tokenizeNonLazyContinuation
2020
}
2121

2222
/** @type {Construct} */
2323
export const codeFenced = {
24+
concrete: true,
2425
name: 'codeFenced',
25-
tokenize: tokenizeCodeFenced,
26-
concrete: true
26+
tokenize: tokenizeCodeFenced
2727
}
2828

2929
/**
3030
* @this {TokenizeContext}
31+
* Context.
3132
* @type {Tokenizer}
3233
*/
3334
function tokenizeCodeFenced(effects, ok, nok) {
3435
const self = this
3536
/** @type {Construct} */
36-
const closeStart = {tokenize: tokenizeCloseStart, partial: true}
37+
const closeStart = {partial: true, tokenize: tokenizeCloseStart}
3738
let initialPrefix = 0
3839
let sizeOpen = 0
3940
/** @type {NonNullable<Code>} */
@@ -348,6 +349,7 @@ function tokenizeCodeFenced(effects, ok, nok) {
348349

349350
/**
350351
* @this {TokenizeContext}
352+
* Context.
351353
* @type {Tokenizer}
352354
*/
353355
function tokenizeCloseStart(effects, ok, nok) {
@@ -476,6 +478,7 @@ function tokenizeCodeFenced(effects, ok, nok) {
476478

477479
/**
478480
* @this {TokenizeContext}
481+
* Context.
479482
* @type {Tokenizer}
480483
*/
481484
function tokenizeNonLazyContinuation(effects, ok, nok) {

0 commit comments

Comments
 (0)