Skip to content

Commit 307d188

Browse files
committed
Update dev-dependencies
1 parent 9d78618 commit 307d188

File tree

5 files changed

+99
-97
lines changed

5 files changed

+99
-97
lines changed

.github/workflows/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ jobs:
77
name: ${{matrix.node}}
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
11-
- uses: actions/setup-node@v3
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
1212
with:
1313
node-version: ${{matrix.node}}
1414
- run: npm install
1515
- run: npm test
16-
- uses: codecov/codecov-action@v3
16+
- uses: codecov/codecov-action@v4
1717
strategy:
1818
matrix:
1919
node:

index.test-d.ts

+23-23
Original file line numberDiff line numberDiff line change
@@ -150,72 +150,72 @@ if (is(mdastNode, {type: 'heading', depth: 2})) {
150150
}
151151

152152
// TS makes this `type: string`.
153-
const checkParagraphProps = convert({type: 'paragraph'})
154-
const checkParagraphPropsConst = convert({type: 'paragraph'} as const)
155-
const checkHeading2Props = convert({type: 'heading', depth: 2})
156-
const checkHeading2PropsConst = convert({
153+
const checkParagraphProperties = convert({type: 'paragraph'})
154+
const checkParagraphPropertiesConst = convert({type: 'paragraph'} as const)
155+
const checkHeading2Properties = convert({type: 'heading', depth: 2})
156+
const checkHeading2PropertiesConst = convert({
157157
type: 'heading',
158158
depth: 2
159159
} as const)
160160

161-
if (checkParagraphProps(mdastNode)) {
161+
if (checkParagraphProperties(mdastNode)) {
162162
expectNotType<Paragraph>(mdastNode)
163163
}
164164

165-
if (checkParagraphPropsConst(mdastNode)) {
165+
if (checkParagraphPropertiesConst(mdastNode)) {
166166
expectType<Paragraph>(mdastNode)
167167
}
168168

169-
if (checkHeading2Props(mdastNode)) {
169+
if (checkHeading2Properties(mdastNode)) {
170170
expectType<Heading>(mdastNode)
171171
expectNotType<2>(mdastNode.depth) // TS can’t narrow this normally.
172172
}
173173

174-
if (checkHeading2PropsConst(mdastNode)) {
174+
if (checkHeading2PropertiesConst(mdastNode)) {
175175
expectAssignable<Heading>(mdastNode)
176176
expectType<2>(mdastNode.depth)
177177
}
178178

179179
// Function test (with explicit assertion).
180-
const checkHeadingFn = convert(isHeading)
181-
const checkParagraphFn = convert(isParagraph)
182-
const checkHeading2Fn = convert(isHeading2)
180+
const checkHeadingFunction = convert(isHeading)
181+
const checkParagraphFunction = convert(isParagraph)
182+
const checkHeading2Function = convert(isHeading2)
183183

184-
expectType<boolean>(checkHeadingFn(mdastNode))
184+
expectType<boolean>(checkHeadingFunction(mdastNode))
185185

186-
if (checkHeadingFn(mdastNode)) {
186+
if (checkHeadingFunction(mdastNode)) {
187187
expectType<Heading>(mdastNode)
188188
}
189189

190-
if (checkParagraphFn(mdastNode)) {
190+
if (checkParagraphFunction(mdastNode)) {
191191
expectType<Paragraph>(mdastNode)
192192
}
193193

194-
if (checkParagraphFn(mdastNode)) {
194+
if (checkParagraphFunction(mdastNode)) {
195195
expectNotType<Heading>(mdastNode)
196196
}
197197

198-
if (checkHeading2Fn(mdastNode)) {
198+
if (checkHeading2Function(mdastNode)) {
199199
expectAssignable<Heading>(mdastNode)
200200
expectType<2>(mdastNode.depth)
201201
}
202202

203203
// Function test (implicit assertion).
204-
const checkHeadingLooseFn = convert(isHeadingLoose)
205-
const checkParagraphLooseFn = convert(isParagraphLoose)
206-
const checkHeadFn = convert(isHead)
204+
const checkHeadingLooseFunction = convert(isHeadingLoose)
205+
const checkParagraphLooseFunction = convert(isParagraphLoose)
206+
const checkHeadFunction = convert(isHead)
207207

208-
expectType<boolean>(checkHeadingLooseFn(mdastNode))
208+
expectType<boolean>(checkHeadingLooseFunction(mdastNode))
209209

210-
if (checkHeadingLooseFn(mdastNode)) {
210+
if (checkHeadingLooseFunction(mdastNode)) {
211211
expectNotType<Heading>(mdastNode)
212212
}
213213

214-
if (checkParagraphLooseFn(mdastNode)) {
214+
if (checkParagraphLooseFunction(mdastNode)) {
215215
expectNotType<Heading>(mdastNode)
216216
}
217217

218-
if (checkHeadFn(mdastNode)) {
218+
if (checkHeadFunction(mdastNode)) {
219219
expectNotType<Heading>(mdastNode)
220220
}
221221

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const convert =
163163
}
164164

165165
if (typeof test === 'object') {
166-
return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
166+
return Array.isArray(test) ? anyFactory(test) : propertiesFactory(test)
167167
}
168168

169169
if (typeof test === 'string') {
@@ -210,7 +210,7 @@ function anyFactory(tests) {
210210
* @param {Props} check
211211
* @returns {Check}
212212
*/
213-
function propsFactory(check) {
213+
function propertiesFactory(check) {
214214
const checkAsRecord = /** @type {Record<string, unknown>} */ (check)
215215

216216
return castFactory(all)

package.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
"devDependencies": {
4343
"@types/mdast": "^4.0.0",
4444
"@types/node": "^20.0.0",
45-
"c8": "^8.0.0",
46-
"prettier": "^2.0.0",
47-
"remark-cli": "^11.0.0",
48-
"remark-preset-wooorm": "^9.0.0",
49-
"tsd": "^0.28.0",
45+
"c8": "^9.0.0",
46+
"prettier": "^3.0.0",
47+
"remark-cli": "^12.0.0",
48+
"remark-preset-wooorm": "^10.0.0",
49+
"tsd": "^0.31.0",
5050
"type-coverage": "^2.0.0",
5151
"typescript": "^5.0.0",
52-
"xo": "^0.54.0"
52+
"xo": "^0.58.0"
5353
},
5454
"scripts": {
5555
"prepack": "npm run build && npm run format",
5656
"build": "tsc --build --clean && tsc --build && tsd && type-coverage",
57-
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
57+
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
5858
"test-api": "node --conditions development test/index.js",
5959
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
6060
"test": "npm run build && npm run format && npm run test-coverage"
@@ -91,6 +91,8 @@
9191
"rules": {
9292
"@typescript-eslint/consistent-type-definitions": "off",
9393
"@typescript-eslint/no-unnecessary-type-arguments": "off",
94+
"@typescript-eslint/no-unsafe-argument": "off",
95+
"@typescript-eslint/no-unsafe-assignment": "off",
9496
"import/no-extraneous-dependencies": "off"
9597
}
9698
}

readme.md

+62-62
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212

1313
## Contents
1414

15-
* [What is this?](#what-is-this)
16-
* [When should I use this?](#when-should-i-use-this)
17-
* [Install](#install)
18-
* [Use](#use)
19-
* [API](#api)
20-
* [`is(node[, test[, index, parent[, context]]])`](#isnode-test-index-parent-context)
21-
* [`convert(test)`](#converttest)
22-
* [`Check`](#check)
23-
* [`Test`](#test)
24-
* [`TestFunction`](#testfunction)
25-
* [Examples](#examples)
26-
* [Example of `convert`](#example-of-convert)
27-
* [Types](#types)
28-
* [Compatibility](#compatibility)
29-
* [Related](#related)
30-
* [Contribute](#contribute)
31-
* [License](#license)
15+
* [What is this?](#what-is-this)
16+
* [When should I use this?](#when-should-i-use-this)
17+
* [Install](#install)
18+
* [Use](#use)
19+
* [API](#api)
20+
* [`is(node[, test[, index, parent[, context]]])`](#isnode-test-index-parent-context)
21+
* [`convert(test)`](#converttest)
22+
* [`Check`](#check)
23+
* [`Test`](#test)
24+
* [`TestFunction`](#testfunction)
25+
* [Examples](#examples)
26+
* [Example of `convert`](#example-of-convert)
27+
* [Types](#types)
28+
* [Compatibility](#compatibility)
29+
* [Related](#related)
30+
* [Contribute](#contribute)
31+
* [License](#license)
3232

3333
## What is this?
3434

@@ -107,16 +107,16 @@ Check if `node` is a `Node` and whether it passes the given test.
107107

108108
###### Parameters
109109

110-
* `node` (`unknown`, optional)
111-
— thing to check, typically [`Node`][node]
112-
* `test` ([`Test`][api-test], optional)
113-
— a test for a specific element
114-
* `index` (`number`, optional)
115-
— the node’s position in its parent
116-
* `parent` ([`Node`][node], optional)
117-
— the node’s parent
118-
* `context` (`unknown`, optional)
119-
— context object (`this`) to call `test` with
110+
* `node` (`unknown`, optional)
111+
— thing to check, typically [`Node`][node]
112+
* `test` ([`Test`][api-test], optional)
113+
— a test for a specific element
114+
* `index` (`number`, optional)
115+
— the node’s position in its parent
116+
* `parent` ([`Node`][node], optional)
117+
— the node’s parent
118+
* `context` (`unknown`, optional)
119+
— context object (`this`) to call `test` with
120120

121121
###### Returns
122122

@@ -139,8 +139,8 @@ a `node`, `index`, and `parent`.
139139

140140
###### Parameters
141141

142-
* `test` ([`Test`][api-test], optional)
143-
— a test for a specific node
142+
* `test` ([`Test`][api-test], optional)
143+
— a test for a specific node
144144

145145
###### Returns
146146

@@ -152,14 +152,14 @@ Check that an arbitrary value is a node (TypeScript type).
152152

153153
###### Parameters
154154

155-
* `this` (`unknown`, optional)
156-
— context object (`this`) to call `test` with
157-
* `node` (`unknown`)
158-
— anything (typically a node)
159-
* `index` (`number`, optional)
160-
— the node’s position in its parent
161-
* `parent` ([`Node`][node], optional)
162-
— the node’s parent
155+
* `this` (`unknown`, optional)
156+
— context object (`this`) to call `test` with
157+
* `node` (`unknown`)
158+
— anything (typically a node)
159+
* `index` (`number`, optional)
160+
— the node’s position in its parent
161+
* `parent` ([`Node`][node], optional)
162+
— the node’s parent
163163

164164
###### Returns
165165

@@ -183,24 +183,24 @@ type Test =
183183
184184
Checks that the given thing is a node, and then:
185185
186-
* when `string`, checks that the node has that tag name
187-
* when `function`, see [`TestFunction`][api-test-function]
188-
* when `object`, checks that all keys in test are in node, and that they have
189-
(strictly) equal values
190-
* when `Array`, checks if one of the subtests pass
186+
* when `string`, checks that the node has that tag name
187+
* when `function`, see [`TestFunction`][api-test-function]
188+
* when `object`, checks that all keys in test are in node, and that they have
189+
(strictly) equal values
190+
* when `Array`, checks if one of the subtests pass
191191
192192
### `TestFunction`
193193
194194
Check if a node passes a test (TypeScript type).
195195
196196
###### Parameters
197197
198-
* `node` ([`Node`][node])
199-
— a node
200-
* `index` (`number` or `undefined`)
201-
— the node’s position in its parent
202-
* `parent` ([`Node`][node] or `undefined`)
203-
— the node’s parent
198+
* `node` ([`Node`][node])
199+
— a node
200+
* `index` (`number` or `undefined`)
201+
— the node’s position in its parent
202+
* `parent` ([`Node`][node] or `undefined`)
203+
— the node’s parent
204204
205205
###### Returns
206206
@@ -255,20 +255,20 @@ compatible with Node.js 16.
255255

256256
## Related
257257

258-
* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after)
259-
— find a node after another node
260-
* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before)
261-
— find a node before another node
262-
* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after)
263-
— find all nodes after another node
264-
* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before)
265-
— find all nodes before another node
266-
* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between)
267-
— find all nodes between two nodes
268-
* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)
269-
— create a new tree with nodes that pass a check
270-
* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)
271-
— remove nodes from tree
258+
* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after)
259+
— find a node after another node
260+
* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before)
261+
— find a node before another node
262+
* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after)
263+
— find all nodes after another node
264+
* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before)
265+
— find all nodes before another node
266+
* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between)
267+
— find all nodes between two nodes
268+
* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)
269+
— create a new tree with nodes that pass a check
270+
* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)
271+
— remove nodes from tree
272272

273273
## Contribute
274274

0 commit comments

Comments
 (0)