Skip to content

Commit 4dcef73

Browse files
committed
Refactor code-style
1 parent b3ed33e commit 4dcef73

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

index.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
2-
* @typedef Options Configuration.
3-
* @property {Test} [ignore] `unist-util-is` test used to assert parents
2+
* @typedef Options
3+
* Configuration (optional).
4+
* @property {Test} [ignore]
5+
* `unist-util-is` test used to assert parents
46
*
57
* @typedef {import('mdast').Root} Root
68
* @typedef {import('mdast').Content} Content
@@ -20,17 +22,17 @@
2022
* @typedef {string|ReplaceFunction} Replace
2123
*
2224
* @typedef {[Find, Replace]} FindAndReplaceTuple
23-
* @typedef {Object.<string, Replace>} FindAndReplaceSchema
24-
* @typedef {Array.<FindAndReplaceTuple>} FindAndReplaceList
25+
* @typedef {Record<string, Replace>} FindAndReplaceSchema
26+
* @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList
2527
*
2628
* @typedef {[RegExp, ReplaceFunction]} Pair
27-
* @typedef {Array.<Pair>} Pairs
29+
* @typedef {Array<Pair>} Pairs
2830
*/
2931

3032
/**
3133
* @callback ReplaceFunction
3234
* @param {...any} parameters
33-
* @returns {Array.<PhrasingContent>|PhrasingContent|string|false|undefined|null}
35+
* @returns {Array<PhrasingContent>|PhrasingContent|string|false|undefined|null}
3436
*/
3537

3638
import escape from 'escape-string-regexp'
@@ -132,7 +134,7 @@ export const findAndReplace =
132134
let start = 0
133135
// @ts-expect-error: TS is wrong, some of these children can be text.
134136
let index = parent.children.indexOf(node)
135-
/** @type {Array.<PhrasingContent>} */
137+
/** @type {Array<PhrasingContent>} */
136138
let nodes = []
137139
/** @type {number|undefined} */
138140
let position

package.json

+2-2
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": {

0 commit comments

Comments
 (0)