Skip to content

Commit c20b853

Browse files
committed
Refactor code-style
1 parent d4a5c20 commit c20b853

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

index.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,26 @@
1313
* @typedef {MdastRoot|MdastContent} MdastNode
1414
* @typedef {Extract<MdastNode, import('unist').Parent>} MdastParent
1515
*
16-
*
1716
* @typedef {import('vfile').VFile} VFile
1817
* @typedef {ReturnType<import('vfile-location').location>} Location
1918
* @typedef {{
20-
* parse(nodes: NlcstContent[]): NlcstRoot
19+
* parse(nodes: Array<NlcstContent>): NlcstRoot
2120
* tokenizeSource(value: string): NlcstSource
2221
* tokenizeWhiteSpace(value: string): NlcstWhiteSpace
23-
* tokenize(value: string): NlcstSentenceContent[]
22+
* tokenize(value: string): Array<NlcstSentenceContent>
2423
* }} ParserInstance
2524
* @typedef {new () => ParserInstance} ParserConstructor
2625
*
2726
* @typedef Options
28-
* @property {string[]} [ignore]
29-
* @property {string[]} [source]
27+
* @property {Array<string>} [ignore]
28+
* @property {Array<string>} [source]
3029
*
3130
* @typedef Context
3231
* @property {string} doc
3332
* @property {Location} place
3433
* @property {ParserInstance} parser
35-
* @property {string[]} ignore
36-
* @property {string[]} source
34+
* @property {Array<string>} ignore
35+
* @property {Array<string>} source
3736
*/
3837

3938
import {toString} from 'nlcst-to-string'
@@ -101,7 +100,7 @@ export function toNlcst(tree, file, Parser, options = {}) {
101100
* Transform a single node.
102101
* @param {Context} config
103102
* @param {MdastNode} node
104-
* @returns {NlcstContent[]|undefined}
103+
* @returns {Array<NlcstContent>|undefined}
105104
*/
106105
function one(config, node) {
107106
const start = node.position ? node.position.start.offset : undefined
@@ -145,11 +144,11 @@ function one(config, node) {
145144
* Transform all nodes in `parent`.
146145
* @param {Context} config
147146
* @param {MdastParent} parent
148-
* @returns {NlcstContent[]}
147+
* @returns {Array<NlcstContent>}
149148
*/
150149
function all(config, parent) {
151150
let index = -1
152-
/** @type {NlcstContent[]} */
151+
/** @type {Array<NlcstContent>} */
153152
const results = []
154153
/** @type {Point|undefined} */
155154
let end
@@ -188,7 +187,7 @@ function all(config, parent) {
188187
* Patch a position on each node in `nodes`.
189188
* `offset` is the offset in `file` this run of content starts at.
190189
*
191-
* @template {NlcstContent[]} T
190+
* @template {Array<NlcstContent>} T
192191
* @param {Context} config
193192
* @param {T} nodes
194193
* @param {number|undefined} offset

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ For example, [`parse-english`][english], [`parse-dutch`][dutch], or
8282

8383
###### `options.ignore`
8484

85-
List of [types][type] to ignore (`Array.<string>`).
85+
List of [types][type] to ignore (`Array<string>`).
8686

8787
`'table'`, `'tableRow'`, and `'tableCell'` are always ignored.
8888

8989
###### `options.source`
9090

91-
List of [types][type] to mark as [source][] (`Array.<string>`).
91+
List of [types][type] to mark as [source][] (`Array<string>`).
9292

9393
`'inlineCode'` is always marked as source.
9494

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ test('Fixtures', (t) => {
229229

230230
while (++index < files.length) {
231231
const name = files[index]
232-
/** @type {Object.<string, unknown>|undefined} */
232+
/** @type {Record<string, unknown>|undefined} */
233233
let options
234234

235235
if (isHidden(name)) continue

0 commit comments

Comments
 (0)