Skip to content

Commit

Permalink
Update for React 18
Browse files Browse the repository at this point in the history
Closes GH-39.
  • Loading branch information
wooorm committed Apr 13, 2022
1 parent e12085e commit 8db0631
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function rehypeReact(options) {
/**
* @param {keyof JSX.IntrinsicElements} name
* @param {Record<string, unknown>} props
* @param {Array<unknown>} [children]
* @param {Array<ReactNode>} [children]
* @returns {ReactNode}
*/
function h(name, props, children) {
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@
"dependencies": {
"@mapbox/hast-util-table-cell-style": "^0.2.0",
"@types/hast": "^2.0.0",
"@types/react": "^17.0.0",
"@types/react": "^18.0.0",
"hast-to-hyperscript": "^10.0.0",
"hast-util-whitespace": "^2.0.0",
"unified": "^10.0.0"
},
"devDependencies": {
"@types/react-dom": "^17.0.0",
"@types/react-dom": "^18.0.0",
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
"hastscript": "^7.0.0",
"prettier": "^2.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"remark": "^14.0.0",
"remark-cli": "^10.0.0",
"remark-preset-wooorm": "^9.0.0",
Expand All @@ -86,7 +86,11 @@
"trailingComma": "none"
},
"xo": {
"prettier": true
"prettier": true,
"": "`xo` is wrong about file extensions",
"rules": {
"node/file-extension-in-import": "off"
}
},
"remarkConfig": {
"plugins": [
Expand Down
3 changes: 2 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'tape'
import React from 'react'
import server from 'react-dom/server.js'
import server from 'react-dom/server'
import {unified} from 'unified'
import {u} from 'unist-builder'
import {h} from 'hastscript'
Expand Down Expand Up @@ -199,6 +199,7 @@ test('React ' + React.version, (t) => {
})
.stringify(u('root', [headingNode, h('p')])),
React.createElement('div', {}, [
// @ts-expect-error: yeah it’s not okay per react types, but it works fine.
React.createElement(Heading1, {key: 'h-2', node: headingNode}, undefined),
React.createElement('p', {key: 'h-3'}, undefined)
]),
Expand Down

0 comments on commit 8db0631

Please sign in to comment.