Skip to content

Commit 201bb32

Browse files
committed
Refactor code-style
1 parent 0e5b58d commit 201bb32

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @typedef {import('estree').Comment} EstreeComment
44
*
55
* @typedef State
6-
* @property {EstreeComment[]} comments
6+
* @property {Array<EstreeComment>} comments
77
* @property {number} index
88
*
99
* @typedef Fields
@@ -17,7 +17,7 @@ const own = {}.hasOwnProperty
1717
* Attach semistandard estree comment nodes to the tree.
1818
*
1919
* @param {EstreeNode} tree
20-
* @param {EstreeComment[]} [comments]
20+
* @param {Array<EstreeComment>} [comments]
2121
*/
2222
export function attachComments(tree, comments) {
2323
const list = (comments || []).concat().sort(compare)
@@ -37,17 +37,17 @@ function walk(node, state) {
3737
return
3838
}
3939

40-
/** @type {EstreeNode[]} */
40+
/** @type {Array<EstreeNode>} */
4141
const children = []
42-
/** @type {EstreeComment[]} */
42+
/** @type {Array<EstreeComment>} */
4343
const comments = []
4444
/** @type {string} */
4545
let key
4646

4747
// Find all children of `node`
4848
for (key in node) {
4949
if (own.call(node, key)) {
50-
/** @type {EstreeNode|EstreeNode[]} */
50+
/** @type {EstreeNode|Array<EstreeNode>} */
5151
// @ts-expect-error: indexable.
5252
const value = node[key]
5353

@@ -101,7 +101,7 @@ function walk(node, state) {
101101
* @param {Fields} fields
102102
*/
103103
function slice(state, node, compareEnd, fields) {
104-
/** @type {EstreeComment[]} */
104+
/** @type {Array<EstreeComment>} */
105105
const result = []
106106

107107
while (

test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ test('estree-attach-comments (recast)', (t) => {
7878
'should support a bunch of line comments'
7979
)
8080

81-
/** @type {EstreeComment[]} */
81+
/** @type {Array<EstreeComment>} */
8282
let comments = []
8383
/** @type {EstreeProgram} */
8484
// @ts-expect-error
@@ -166,10 +166,10 @@ test('estree-attach-comments (recast)', (t) => {
166166

167167
/**
168168
* @param {string} doc
169-
* @returns {[EstreeProgram, EstreeComment[]]}
169+
* @returns {[EstreeProgram, Array<EstreeComment>]}
170170
*/
171171
function parse(doc) {
172-
/** @type {EstreeComment[]} */
172+
/** @type {Array<EstreeComment>} */
173173
const comments = []
174174
/** @type {EstreeProgram} */
175175
// @ts-expect-error
@@ -178,7 +178,7 @@ function parse(doc) {
178178
}
179179

180180
/**
181-
* @param {EstreeNode|EstreeNode[]} value
181+
* @param {EstreeNode|Array<EstreeNode>} value
182182
* @returns {void}
183183
*/
184184
function removePositions(value) {

0 commit comments

Comments
 (0)