overleaf/services/web/frontend/js/features/ide-react/hooks/use-has-linting-error.ts

13 lines
455 B
TypeScript
Raw Normal View History

import useEventListener from '@/shared/hooks/use-event-listener'
import { useLocalCompileContext } from '@/shared/context/local-compile-context'
export function useHasLintingError() {
const { setHasLintingError } = useLocalCompileContext()
// Listen for editor:lint event from CM6 linter and keep compile context
// up to date
useEventListener('editor:lint', (event: CustomEvent) => {
setHasLintingError(event.detail.hasLintingError)
})
}