Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Dec 24, 2024
1 parent 3b8b162 commit e6b768d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"files": {
"ignoreUnknown": true,
"ignore": [
".dumi/*",
"dist/*",
"es/**/*",
"lib/**/*",
"node_modules",
"server",
"package.json",
".dumirc.ts"
]
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "dumi build",
"compile": "father build",
"coverage": "rc-test --coverage",
"lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
"lint": "biome lint",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"start": "dumi dev",
"test": "rc-test"
Expand All @@ -35,6 +35,7 @@
"@babel/runtime": "^7.18.3"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@rc-component/father-plugin": "^1.0.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^16.1.0",
Expand All @@ -45,7 +46,6 @@
"antd": "^5.22.6",
"cross-env": "^7.0.1",
"dumi": "^2.1.0",
"eslint": "^7.0.0",
"father": "^4.0.0",
"np": "^6.2.0",
"rc-test": "^7.0.13",
Expand Down
11 changes: 8 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { unstableSetRender } from 'antd';
import { createRoot } from 'react-dom/client';

unstableSetRender((node, container) => {
(container as any)._reactRoot ||= createRoot(container);
const root: ReturnType<typeof createRoot> = (container as any)._reactRoot;
type RenderType = Parameters<typeof unstableSetRender>[0];
type ContainerType = Parameters<RenderType>[1] & {
_reactRoot?: ReturnType<typeof createRoot>;
};

unstableSetRender((node, container: ContainerType) => {
container._reactRoot ||= createRoot(container);
const root: ReturnType<typeof createRoot> = container._reactRoot;
root.render(node);
return async () => {
// Wait for timeout to avoid React render race.
Expand Down

0 comments on commit e6b768d

Please sign in to comment.