Skip to content

Commit 1850c7a

Browse files
committed
Refactor code-style
1 parent b746991 commit 1850c7a

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
* @typedef {string|ReplaceFunction} Replace
2121
*
2222
* @typedef {[Find, Replace]} FindAndReplaceTuple
23-
* @typedef {Object.<string, Replace>} FindAndReplaceSchema
24-
* @typedef {Array.<FindAndReplaceTuple>} FindAndReplaceList
23+
* @typedef {Record<string, Replace>} FindAndReplaceSchema
24+
* @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList
2525
*
2626
* @typedef {[RegExp, ReplaceFunction]} Pair
27-
* @typedef {Array.<Pair>} Pairs
27+
* @typedef {Array<Pair>} Pairs
2828
*/
2929

3030
/**
3131
* @callback ReplaceFunction
3232
* @param {...any} parameters
33-
* @returns {Array.<Content>|Content|string|false|undefined|null}
33+
* @returns {Array<Content>|Content|string|false|undefined|null}
3434
*/
3535

3636
import {visitParents} from 'unist-util-visit-parents'
@@ -115,7 +115,7 @@ export function findAndReplace(tree, find, replace, options) {
115115
const replace = pairs[pairIndex][1]
116116
let start = 0
117117
let index = parent.children.indexOf(node)
118-
/** @type {Array.<Content>} */
118+
/** @type {Array<Content>} */
119119
let nodes = []
120120
/** @type {number|undefined} */
121121
let position

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"prepack": "npm run build && npm run format",
5454
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
5555
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
56-
"test-api": "node test.js",
57-
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
56+
"test-api": "node --conditions development test.js",
57+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
5858
"test": "npm run build && npm run format && npm run test-coverage"
5959
},
6060
"prettier": {
@@ -76,10 +76,7 @@
7676
"typeCoverage": {
7777
"atLeast": 100,
7878
"detail": true,
79-
"strict": true,
80-
"#": "needed `any`s",
81-
"ignoreFiles": [
82-
"index.d.ts"
83-
]
79+
"detail": true,
80+
"ignoreNested": true
8481
}
8582
}

0 commit comments

Comments
 (0)