Revert "Upgrade linter and formatter to Ultracite" (#1226)

This commit is contained in:
josh 2025-09-21 12:03:29 +01:00 committed by GitHub
parent 0e320b391d
commit 1aff7d9868
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
177 changed files with 8334 additions and 6943 deletions

View file

@ -1,19 +1,19 @@
"use client";
'use client';
import { defaultMarkdownSerializer } from "prosemirror-markdown";
import { DOMParser, type Node } from "prosemirror-model";
import { Decoration, DecorationSet, type EditorView } from "prosemirror-view";
import { renderToString } from "react-dom/server";
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
import { DOMParser, type Node } from 'prosemirror-model';
import { Decoration, DecorationSet, type EditorView } from 'prosemirror-view';
import { renderToString } from 'react-dom/server';
import { Response } from "@/components/elements/response";
import { Response } from '@/components/elements/response';
import { documentSchema } from "./config";
import { createSuggestionWidget, type UISuggestion } from "./suggestions";
import { documentSchema } from './config';
import { createSuggestionWidget, type UISuggestion } from './suggestions';
export const buildDocumentFromContent = (content: string) => {
const parser = DOMParser.fromSchema(documentSchema);
const stringFromMarkdown = renderToString(<Response>{content}</Response>);
const tempContainer = document.createElement("div");
const tempContainer = document.createElement('div');
tempContainer.innerHTML = stringFromMarkdown;
return parser.parse(tempContainer);
};
@ -23,10 +23,10 @@ export const buildContentFromDocument = (document: Node) => {
};
export const createDecorations = (
suggestions: UISuggestion[],
view: EditorView
suggestions: Array<UISuggestion>,
view: EditorView,
) => {
const decorations: Decoration[] = [];
const decorations: Array<Decoration> = [];
for (const suggestion of suggestions) {
decorations.push(
@ -34,27 +34,27 @@ export const createDecorations = (
suggestion.selectionStart,
suggestion.selectionEnd,
{
class: "suggestion-highlight",
class: 'suggestion-highlight',
},
{
suggestionId: suggestion.id,
type: "highlight",
}
)
type: 'highlight',
},
),
);
decorations.push(
Decoration.widget(
suggestion.selectionStart,
(currentView) => {
const { dom } = createSuggestionWidget(suggestion, currentView);
(view) => {
const { dom } = createSuggestionWidget(suggestion, view);
return dom;
},
{
suggestionId: suggestion.id,
type: "widget",
}
)
type: 'widget',
},
),
);
}