style: minimium codemod

This commit is contained in:
AkaraChen
2024-10-21 16:21:16 +08:00
parent 024028bc52
commit cdd2a40086
44 changed files with 81 additions and 73 deletions

View File

@ -1,6 +1,6 @@
import AudioPlayer from '@/app/components/base/audio-btn/audio'
declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
// eslint-disable-next-line ts/consistent-type-definitions
interface AudioPlayerManager {
instance: AudioPlayerManager
}
@ -12,6 +12,7 @@ export class AudioPlayerManager {
private audioPlayers: AudioPlayer | null = null
private msgId: string | undefined
// eslint-disable-next-line
private constructor() {
}

View File

@ -2,7 +2,7 @@ import Toast from '@/app/components/base/toast'
import { textToAudioStream } from '@/service/share'
declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
// eslint-disable-next-line ts/consistent-type-definitions
interface Window {
ManagedMediaSource: any
}

View File

@ -55,7 +55,7 @@ const AudioPlayer: React.FC<AudioPlayerProps> = ({ src }) => {
audio.load()
// Delayed generation of waveform data
// eslint-disable-next-line @typescript-eslint/no-use-before-define
// eslint-disable-next-line ts/no-use-before-define
const timer = setTimeout(() => generateWaveformData(src), 1000)
return () => {

View File

@ -49,4 +49,6 @@ const AutoHeightTextarea = forwardRef<HTMLTextAreaElement, AutoHeightTextareaPro
},
)
AutoHeightTextarea.displayName = 'AutoHeightTextarea'
export default AutoHeightTextarea

View File

@ -12,8 +12,9 @@ import Divider from '@/app/components/base/divider'
import { searchEmoji } from '@/utils/emoji'
declare global {
// eslint-disable-next-line ts/no-namespace
namespace JSX {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
// eslint-disable-next-line ts/consistent-type-definitions
interface IntrinsicElements {
'em-emoji': React.DetailedHTMLProps< React.HTMLAttributes<HTMLElement>, HTMLElement >
}

View File

@ -28,4 +28,6 @@ const IconBase = forwardRef<React.MutableRefObject<HTMLOrSVGElement>, IconBasePr
})
})
IconBase.displayName = 'IconBase'
export default IconBase

View File

@ -75,7 +75,6 @@ export function PreCode(props: { children: any }) {
)
}
// eslint-disable-next-line unused-imports/no-unused-vars
const useLazyLoad = (ref: RefObject<Element>): boolean => {
const [isIntersecting, setIntersecting] = useState<boolean>(false)
@ -297,11 +296,11 @@ export default class ErrorBoundary extends Component {
}
render() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// eslint-disable-next-line ts/ban-ts-comment
// @ts-expect-error
if (this.state.hasError)
return <div>Oops! An error occurred. This could be due to an ECharts runtime error or invalid SVG content. <br />(see the browser console for more information)</div>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// eslint-disable-next-line ts/ban-ts-comment
// @ts-expect-error
return this.props.children
}

View File

@ -44,7 +44,7 @@ const Flowchart = React.forwardRef((props: {
const chartId = useRef(`flowchart_${CryptoJS.MD5(props.PrimitiveCode).toString()}`)
const prevPrimitiveCode = usePrevious(props.PrimitiveCode)
const [isLoading, setIsLoading] = useState(true)
const timeRef = useRef<NodeJS.Timeout>()
const timeRef = useRef<number>()
const [errMsg, setErrMsg] = useState('')
const renderFlowchart = async (PrimitiveCode: string) => {
@ -74,15 +74,15 @@ const Flowchart = React.forwardRef((props: {
return
}
if (timeRef.current)
clearTimeout(timeRef.current)
window.clearTimeout(timeRef.current)
timeRef.current = setTimeout(() => {
timeRef.current = window.setTimeout(() => {
renderFlowchart(props.PrimitiveCode)
}, 300)
}, [props.PrimitiveCode])
return (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// eslint-disable-next-line ts/ban-ts-comment
// @ts-expect-error
<div ref={ref}>
{
@ -108,4 +108,6 @@ const Flowchart = React.forwardRef((props: {
)
})
Flowchart.displayName = 'Flowchart'
export default Flowchart

View File

@ -34,15 +34,15 @@ export default function CustomPopover({
disabled = false,
}: IPopover) {
const buttonRef = useRef<HTMLButtonElement>(null)
const timeOutRef = useRef<NodeJS.Timeout | null>(null)
const timeOutRef = useRef<number | null>(null)
const onMouseEnter = (isOpen: boolean) => {
timeOutRef.current && clearTimeout(timeOutRef.current)
timeOutRef.current && window.clearTimeout(timeOutRef.current)
!isOpen && buttonRef.current?.click()
}
const onMouseLeave = (isOpen: boolean) => {
timeOutRef.current = setTimeout(() => {
timeOutRef.current = window.setTimeout(() => {
isOpen && buttonRef.current?.click()
}, timeoutDuration)
}

View File

@ -1,4 +1,4 @@
import type { EditorConfig, NodeKey, SerializedTextNode } from 'lexical'
import type { EditorConfig, SerializedTextNode } from 'lexical'
import { $createTextNode, TextNode } from 'lexical'
export class CustomTextNode extends TextNode {
@ -10,9 +10,9 @@ export class CustomTextNode extends TextNode {
return new CustomTextNode(node.__text, node.__key)
}
constructor(text: string, key?: NodeKey) {
super(text, key)
}
// constructor(text: string, key?: NodeKey) {
// super(text, key)
// }
createDOM(config: EditorConfig) {
const dom = super.createDOM(config)

View File

@ -1,7 +1,6 @@
import type {
EditorConfig,
LexicalNode,
NodeKey,
SerializedTextNode,
} from 'lexical'
import {
@ -18,9 +17,9 @@ export class VariableValueBlockNode extends TextNode {
return new VariableValueBlockNode(node.__text, node.__key)
}
constructor(text: string, key?: NodeKey) {
super(text, key)
}
// constructor(text: string, key?: NodeKey) {
// super(text, key)
// }
createDOM(config: EditorConfig): HTMLElement {
const element = super.createDOM(config)

View File

@ -30,7 +30,7 @@ const TagManagementModal = ({ show, type }: TagManagementModalProps) => {
setTagList(res)
}
const [pending, setPending] = useState<Boolean>(false)
const [pending, setPending] = useState<boolean>(false)
const [name, setName] = useState<string>('')
const createNewTag = async () => {
if (!name)

View File

@ -54,7 +54,7 @@ const Panel = (props: PanelProps) => {
return tagList.filter(tag => tag.type === type && !value.includes(tag.id) && tag.name.includes(keywords))
}, [type, tagList, value, keywords])
const [creating, setCreating] = useState<Boolean>(false)
const [creating, setCreating] = useState<boolean>(false)
const createNewTag = async () => {
if (!keywords)
return

View File

@ -78,7 +78,7 @@ const TagItemEditor: FC<TagItemEditorProps> = ({
}
}
const [showRemoveModal, setShowRemoveModal] = useState(false)
const [pending, setPending] = useState<Boolean>(false)
const [pending, setPending] = useState<boolean>(false)
const removeTag = async (tagID: string) => {
if (pending)
return