mirror of
https://github.com/outline/outline.git
synced 2026-12-04 10:24:43 +03:00
* chore: promote no-explicit-any from warn to error and resolve violations Upgrades the oxlint rule severity and removes all 40 existing `no-explicit-any` warnings across the codebase. Most call sites gained proper types (SharedEditor refs, JSONNode/JSONMark for ProseMirror JSON walking, DocumentsStore, dd-trace `Span` parameter inference, prosemirror Fragment public API in place of internal `(fragment as any).content`). A few load-bearing `any` uses were preserved with scoped disable comments where changing the type would cascade widely (Sequelize JSONB columns on `Event`, the `withTracing` higher-order function generic, `Extension.options` consumed by many subclasses, dd-trace's `req` patching). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import data from "@emoji-mart/data";
|
|
import type { EmojiMartData } from "@emoji-mart/data";
|
|
import { Schema } from "prosemirror-model";
|
|
import type { Editor } from "~/editor";
|
|
import ExtensionManager from "@shared/editor/lib/ExtensionManager";
|
|
import { populateEmojiData } from "@shared/editor/lib/emoji";
|
|
import {
|
|
basicExtensions,
|
|
richExtensions,
|
|
withComments,
|
|
} from "@shared/editor/nodes";
|
|
import Mention from "@shared/editor/nodes/Mention";
|
|
|
|
populateEmojiData(data as EmojiMartData);
|
|
|
|
// Server-side parsing/serializing only requires schema and a few static props,
|
|
// but the Extension API expects a full Editor. This stub satisfies bindEditor
|
|
// without instantiating the React component.
|
|
const stubEditor = (s: Schema): Editor =>
|
|
({ schema: s, props: { theme: { isDark: false } } }) as unknown as Editor;
|
|
|
|
const extensions = withComments(richExtensions);
|
|
export const extensionManager = new ExtensionManager(extensions);
|
|
|
|
export const schema = new Schema({
|
|
nodes: extensionManager.nodes,
|
|
marks: extensionManager.marks,
|
|
});
|
|
|
|
for (const extension of extensionManager.extensions) {
|
|
extension.bindEditor(stubEditor(schema));
|
|
}
|
|
|
|
export const parser = extensionManager.parser({
|
|
schema,
|
|
plugins: extensionManager.rulePlugins,
|
|
});
|
|
|
|
export const serializer = extensionManager.serializer();
|
|
|
|
export const plugins = extensionManager.plugins;
|
|
|
|
export const basicExtensionManager = new ExtensionManager(basicExtensions);
|
|
|
|
export const basicSchema = new Schema({
|
|
nodes: basicExtensionManager.nodes,
|
|
marks: basicExtensionManager.marks,
|
|
});
|
|
|
|
for (const extension of basicExtensionManager.extensions) {
|
|
extension.bindEditor(stubEditor(basicSchema));
|
|
}
|
|
|
|
export const basicParser = basicExtensionManager.parser({
|
|
schema: basicSchema,
|
|
plugins: basicExtensionManager.rulePlugins,
|
|
});
|
|
|
|
const commentExtensions = [...basicExtensions, Mention];
|
|
export const commentExtensionManager = new ExtensionManager(commentExtensions);
|
|
|
|
export const commentSchema = new Schema({
|
|
nodes: commentExtensionManager.nodes,
|
|
marks: commentExtensionManager.marks,
|
|
});
|
|
|
|
for (const extension of commentExtensionManager.extensions) {
|
|
extension.bindEditor(stubEditor(commentSchema));
|
|
}
|
|
|
|
export const commentParser = commentExtensionManager.parser({
|
|
schema: commentSchema,
|
|
plugins: commentExtensionManager.rulePlugins,
|
|
});
|