/** * External dependencies */ import type { CompletionSource } from '@codemirror/autocomplete'; import type { TSESLint } from '@typescript-eslint/utils'; import type { EditorState, EditorView } from '@uiw/react-codemirror'; export type Props = { readonly className?: string; readonly value: string; readonly onCreateEditor?: ( view: EditorView, state: EditorState ) => void; readonly placeholder?: string; readonly before?: string; readonly after?: string; readonly onFocus?: () => void; readonly onBlur?: () => void; readonly config?: Partial< { readonly completions: ReadonlyArray< CompletionSource >; readonly globals: ReadonlyArray< string >; readonly rules: Record< string, ESLintRule >; } >; } & ( | { readonly readOnly?: false; readonly onChange: ( value: string ) => void; } | { readonly readOnly: true; readonly onChange?: never; } ); type ESLintRule = { readonly level: 'error' | 'warn'; /* eslint-disable @typescript-eslint/no-explicit-any */ readonly module: TSESLint.RuleModule< any, any, any >; };