diff --git a/examples/rsbuild-minimal/rsbuild.config.ts b/examples/rsbuild-minimal/rsbuild.config.ts index 8bec4951..f0298b58 100644 --- a/examples/rsbuild-minimal/rsbuild.config.ts +++ b/examples/rsbuild-minimal/rsbuild.config.ts @@ -24,6 +24,12 @@ export default defineConfig({ limit: 1, }, ], + 'ecma-version-check': [ + 'Warn', + { + ecmaVersion: 3, + }, + ], }, }, port: 9988, diff --git a/packages/components/package.json b/packages/components/package.json index 54e20918..581944cb 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -50,6 +50,7 @@ "dist/" ], "devDependencies": { + "@rsbuild/plugin-check-syntax": "1.2.0-beta.1", "@ant-design/icons": "5.5.1", "@monaco-editor/react": "4.6.0", "@rsdoctor/graph": "workspace:*", diff --git a/packages/components/src/components/Alert/link.tsx b/packages/components/src/components/Alert/link.tsx index 4b2273a7..ae1a70ed 100644 --- a/packages/components/src/components/Alert/link.tsx +++ b/packages/components/src/components/Alert/link.tsx @@ -1,11 +1,13 @@ import React from 'react'; import { Alert, Button, Space, Typography } from 'antd'; import { InfoCircleOutlined } from '@ant-design/icons'; + import { useRuleIndexNavigate } from '../../utils'; + import { LinkAlertProps } from './types'; export const LinkRuleAlert: React.FC = ({ data }) => { - const { title, description = '', level, code } = data; + const { title, error, description, level, code } = data; const navigate = useRuleIndexNavigate(code, data.link); return ( @@ -13,13 +15,24 @@ export const LinkRuleAlert: React.FC = ({ data }) => { showIcon message={ - + {code} {title} } - description={
} + description={ +
+ {error?.source?.path ?
Source: {error.source.path}
: null} + {error?.output?.path ?
Output: {error.output.path}
: null} +
Message: {description}
+
+ } type={level === 'warn' ? 'info' : level} action={