type: enable type prompt for .dumirc.ts (#44886)

* type: fix .dumi missing types

* Update tsconfig.json

Signed-off-by: lijianan <574980606@qq.com>

* Update tsconfig.json

Signed-off-by: lijianan <574980606@qq.com>

* Update tsconfig.json

Signed-off-by: lijianan <574980606@qq.com>

* chore: clear tsconfig.json

* chore: update dumi version declaration

* type: correct unified plugin types

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: lijianan <574980606@qq.com>
Co-authored-by: PeachScript <scdzwyxst@gmail.com>
This commit is contained in:
afc163
2023-09-17 21:52:01 +08:00
committed by GitHub
parent b24cda1f97
commit 62e338c775
5 changed files with 13 additions and 17 deletions

View File

@@ -62,12 +62,12 @@ function rehypeAntd(): UnifiedTransformer<HastRoot> {
(node.properties.className as string[]).push('component-api-table');
} else if (node.type === 'element' && (node.tagName === 'Link' || node.tagName === 'a')) {
const { tagName } = node;
node.properties.sourceType = tagName;
node.properties!.sourceType = tagName;
node.tagName = 'LocaleLink';
} else if (node.type === 'element' && node.tagName === 'video') {
node.tagName = 'VideoPlayer';
} else if (node.tagName === 'SourceCode') {
const { lang } = node.properties;
const { lang } = node.properties!;
if (typeof lang === 'string' && lang.startsWith('sandpack')) {
const code = (node.children[0] as any).value as string;

View File

@@ -1,12 +1,14 @@
import { unistUtilVisit } from 'dumi';
import { unistUtilVisit, type UnifiedTransformer } from 'dumi';
export default function remarkMeta() {
function remarkMeta(): UnifiedTransformer<any> {
return (tree, vFile) => {
// read frontmatter
unistUtilVisit.visit(tree, 'yaml', (node) => {
if (!/(^|[\n\r])description:/.test(node.value)) {
vFile.data.frontmatter.__autoDescription = true;
(vFile.data.frontmatter as any).__autoDescription = true;
}
});
};
}
export default remarkMeta;

View File

@@ -1,15 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx",
"esModuleInterop": true,
"resolveJsonModule": true,
"baseUrl": "../",
"paths": {
"@@/*": [".dumi/tmp/*"],
"antd": ["components/index.tsx"],
"antd/es/*": ["components/*"],
"dumi/theme/*": [".dumi/theme/*"]
}
"resolveJsonModule": true
},
"include": ["./**/*", "../site/theme/template/Content"]
"include": ["**/*"]
}

View File

@@ -216,7 +216,7 @@
"cross-fetch": "^4.0.0",
"crypto": "^1.0.1",
"dekko": "^0.2.1",
"dumi": "^2.1.23",
"dumi": "^2.2.10",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"esbuild-loader": "^4.0.0",
"eslint": "^8.40.0",

View File

@@ -2,6 +2,7 @@
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@@/*": [".dumi/tmp/*"],
"antd": ["components/index.ts"],
"antd/es/*": ["components/*"],
"antd/lib/*": ["components/*"],
@@ -23,5 +24,6 @@
"skipLibCheck": true,
"stripInternal": true
},
"include": [".dumirc.ts", "**/*"],
"exclude": ["node_modules", "lib", "es"]
}