mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-28 03:38:11 +08:00
Fix: Lint error. (#16172)
### What problem does this PR solve? Fix: Lint error. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { MarkdownRemarkPlugins } from '@/constants/markdown-remark-plugins';
|
||||
import classNames from 'classnames';
|
||||
import Markdown from 'react-markdown';
|
||||
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
||||
@@ -7,18 +8,17 @@ import {
|
||||
} from 'react-syntax-highlighter/dist/esm/styles/prism';
|
||||
import rehypeKatex from 'rehype-katex';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import { MarkdownRemarkPlugins } from '@/constants/markdown-remark-plugins';
|
||||
|
||||
import 'katex/dist/katex.min.css'; // `rehype-katex` does not import the CSS for you
|
||||
|
||||
import { preprocessLaTeX } from '@/utils/chat';
|
||||
import { citationMarkerReg } from '@/utils/citation-utils';
|
||||
import { getDirAttribute } from '@/utils/text-direction';
|
||||
import { omit } from 'lodash';
|
||||
import { useIsDarkTheme } from '../theme-provider';
|
||||
import styles from './index.module.less';
|
||||
|
||||
const HighLightMarkdown = ({
|
||||
className,
|
||||
children,
|
||||
}: {
|
||||
className?: string;
|
||||
@@ -36,8 +36,8 @@ const HighLightMarkdown = ({
|
||||
rehypePlugins={[rehypeRaw, rehypeKatex]}
|
||||
components={
|
||||
{
|
||||
p: ({ children, node, ...props }: any) => (
|
||||
<p {...props}>{children}</p>
|
||||
p: ({ children, ...props }: any) => (
|
||||
<p {...omit(props, 'node')}>{children}</p>
|
||||
),
|
||||
code(props: any) {
|
||||
const { children, className, ...rest } = props;
|
||||
|
||||
@@ -103,6 +103,7 @@ const JsonEditor: React.FC<JsonEditorProps> = ({
|
||||
try {
|
||||
currentData = editorRef.current.get();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// If there's an error getting data, use the passed value or empty object
|
||||
currentData = value || {};
|
||||
}
|
||||
@@ -127,6 +128,7 @@ const JsonEditor: React.FC<JsonEditorProps> = ({
|
||||
const updatedJson = editorRef.current.get();
|
||||
onChange(updatedJson);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// Do not trigger onChange when parsing error occurs
|
||||
}
|
||||
}
|
||||
@@ -157,6 +159,7 @@ const JsonEditor: React.FC<JsonEditorProps> = ({
|
||||
editorRef.current.set(value);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// Skip update if there is a syntax error in the current editor
|
||||
editorRef.current.set(value);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ const JsonSchemaVisualizer: FC<JsonSchemaVisualizerProps> = ({
|
||||
onChange(parsedJson);
|
||||
}
|
||||
} catch (_error) {
|
||||
console.error(_error);
|
||||
// Monaco will show the error inline, no need for additional error handling
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||
!!prefix && prefixWidth ? `${prefixWidth}px` : '',
|
||||
paddingInlineEnd: isPasswordInput
|
||||
? '40px'
|
||||
: !!suffix
|
||||
: suffix
|
||||
? `${suffixWidth}px`
|
||||
: '',
|
||||
}}
|
||||
@@ -155,9 +155,6 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||
|
||||
Input.displayName = 'Input';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ExpandedInputProps extends InputProps {}
|
||||
|
||||
const ExpandedInput = Input;
|
||||
|
||||
const SearchInput = (props: InputProps) => {
|
||||
|
||||
@@ -64,7 +64,7 @@ export interface SegmentedProps extends Omit<
|
||||
|
||||
const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
||||
supportsCssAnchor
|
||||
? (
|
||||
? function Segmented(
|
||||
{
|
||||
options,
|
||||
value,
|
||||
@@ -77,7 +77,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
||||
buttonSize = 'default',
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
) {
|
||||
const anchorNamePrefix = useId().replace(/:/g, '');
|
||||
const [selectedValue, setSelectedValue] = React.useState<
|
||||
SegmentedValue | undefined
|
||||
@@ -143,7 +143,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
||||
</div>
|
||||
);
|
||||
}
|
||||
: (
|
||||
: function Segmented(
|
||||
{
|
||||
options,
|
||||
value,
|
||||
@@ -156,7 +156,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
||||
buttonSize = 'default',
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
) {
|
||||
const [selectedValue, setSelectedValue] = React.useState<
|
||||
SegmentedValue | undefined
|
||||
>(value);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { LucideCircleQuestionMark } from 'lucide-react';
|
||||
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
|
||||
|
||||
export default function WhatIsThis({ children }: React.PropsWithChildren<{}>) {
|
||||
export default function WhatIsThis({ children }: React.PropsWithChildren) {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
|
||||
Reference in New Issue
Block a user