Repository Analysis

facebook/lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.

0.9 Likely human-written View on GitHub
0.9
Adjusted Score
0.9
Raw Score
100%
Time Factor
2026-05-30
Last Push
23,464
Stars
TypeScript
Language
280,939
Lines of Code
1240
Files
230
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 0MEDIUM 2LOW 228

Pattern Findings

230 matches across 6 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers165 hits · 168 pts
SeverityFileLineSnippet
LOWlibdefs/yjs.js725 declare export function createRelativePositionFromTypeIndex(
LOWlibdefs/yjs.js730 declare export function createRelativePositionFromJSON(
LOWlibdefs/yjs.js734 declare export function createAbsolutePositionFromRelativePosition(
LOW…mples/node-state-style/src/plugins/StyleViewPlugin.tsx460function LexicalTextSelectionPaneContents({node}: {node: LexicalNode}) {
LOW…mples/node-state-style/src/plugins/StyleViewPlugin.tsx562function initTextSelectionPaneReducer(action: SelectedNodeStateAction) {
LOW…mples/node-state-style/src/plugins/StyleViewPlugin.tsx624function useSuggestedStylesCombobox(props: CSSPropertyComboBoxProps) {
LOW…mples/node-state-style/src/plugins/StyleViewPlugin.tsx460function LexicalTextSelectionPaneContents({node}: {node: LexicalNode}) {
LOW…mples/node-state-style/src/plugins/StyleViewPlugin.tsx562function initTextSelectionPaneReducer(action: SelectedNodeStateAction) {
LOW…mples/node-state-style/src/plugins/StyleViewPlugin.tsx624function useSuggestedStylesCombobox(props: CSSPropertyComboBoxProps) {
LOW…n-host/src/stackblitz-workaround/TreeViewExtension.tsx17export function TreeViewExtensionComponent(
LOWexamples/agent-example/src/ai/AIExtension.ts266 function extractEntitiesFromWorker(
LOWpackages/lexical-code-core/src/CodeImportExtension.ts138function splitMonospaceWrapperLines(el: HTMLElement): string[] | null {
LOWpackages/lexical-hashtag/src/LexicalHashtagExtension.ts15function getHashtagRegexStringChars(): Readonly<{
LOWpackages/lexical-react/src/TreeViewExtension.tsx17export function TreeViewExtensionComponent(
LOW…exical-react/src/LexicalBlockWithAlignableContents.tsx41export function BlockWithAlignableContents({
LOWpackages/lexical-react/src/LexicalComposerContext.ts29export function createLexicalComposerContext(
LOWpackages/lexical-react/src/LexicalComposerContext.ts52export function useLexicalComposerContext(): LexicalComposerContextWithEditor {
LOWpackages/lexical-react/src/ReactExtension.tsx42export function DefaultEditorChildrenComponent({
LOW…kages/lexical-react/src/LexicalTypeaheadMenuPlugin.tsx91function isSelectionOnEntityBoundary(
LOW…kages/lexical-react/src/LexicalTypeaheadMenuPlugin.tsx147export function useBasicTypeaheadTriggerMatch(
LOW…ages/lexical-react/src/useLexicalIsTextContentEmpty.ts16export function useLexicalIsTextContentEmpty(
LOW…s/lexical-react/src/LexicalExtensionEditorComposer.tsx37export function LexicalExtensionEditorComposer({
LOW…ages/lexical-react/src/shared/useCanShowPlaceholder.ts17function canShowPlaceholderFromCurrentEditorState(
LOWpackages/lexical-react/src/shared/LexicalMenu.tsx191function isTriggerVisibleInNearestScrollContainer(
LOWpackages/lexical-react/src/shared/LexicalMenu.tsx597function setContainerDivAttributes(
LOW…cal-react/src/shared/LexicalContentEditableElement.tsx36function ContentEditableElementImpl(
LOW…lexical-react/src/__tests__/unit/Collaboration.test.ts48 async function expectCorrectInitialContent(client1: Client, client2: Client) {
LOW…eact/src/__tests__/unit/LexicalNodeMenuPlugin.test.tsx40function NodeMenuPluginWithMenuRenderFn({
LOW…eact/src/__tests__/unit/LexicalNodeMenuPlugin.test.tsx89function NodeMenuPluginWithoutMenuRenderFn({
LOW…src/__tests__/unit/LexicalTypeaheadMenuPlugin.test.tsx48function TypeaheadPluginWithMenuRenderFn({
LOW…src/__tests__/unit/LexicalTypeaheadMenuPlugin.test.tsx107function TypeaheadPluginWithoutMenuRenderFn({
LOWpackages/lexical/src/LexicalMutations.ts99function shouldUpdateTextNodeFromMutation(
LOWpackages/lexical/src/LexicalEditor.ts685function initializeConversionCache(
LOWpackages/lexical/src/LexicalNodeState.ts927function parseAndPruneNextUnknownState(
LOWpackages/lexical/src/LexicalReconciler.ts602function isLastChildLineBreakOrDecorator(
LOWpackages/lexical/src/LexicalReconciler.ts1781function getPrevElementByKeyOrThrow(key: NodeKey): HTMLElement {
LOWpackages/lexical/src/LexicalSelection.ts2186function shouldDeleteExactlyOneCodeUnit(text: string) {
LOWpackages/lexical/src/LexicalSelection.ts2485function resolveSelectionPointOnBoundary(
LOWpackages/lexical/src/LexicalSelection.ts2996export function moveSelectionPointToSibling(
LOWpackages/lexical/src/LexicalSelection.ts3037export function adjustPointOffsetForMergedSibling(
LOWpackages/lexical/src/LexicalSelection.ts3051function setDOMSelectionBaseAndExtent(
LOWpackages/lexical/src/LexicalEvents.ts285function shouldSkipSelectionChange(
LOWpackages/lexical/src/LexicalEvents.ts655function isPossiblyAndroidKeyPress(timeStamp: number): boolean {
LOWpackages/lexical/src/LexicalEvents.ts662function clearHandledSelectionCommandInsertText(): void {
LOWpackages/lexical/src/LexicalEvents.ts670function markHandledSelectionCommandInsertText(): void {
LOWpackages/lexical/src/LexicalEvents.ts679export function registerDefaultCommandHandlers(editor: LexicalEditor) {
LOWpackages/lexical/src/LexicalEvents.ts1441function getRootElementRemoveHandles(
LOWpackages/lexical/src/LexicalEvents.ts1460function onDocumentSelectionChange(event: Event): void {
LOWpackages/lexical/src/LexicalEvents.ts1522function hasStoppedLexicalPropagation(event: Event): boolean {
LOWpackages/lexical/src/LexicalEvents.ts1687function cleanActiveNestedEditorsMap(editor: LexicalEditor) {
LOWpackages/lexical/src/LexicalEvents.ts1703export function markSelectionChangeFromDOMUpdate(): void {
LOWpackages/lexical/src/LexicalEvents.ts1707export function markCollapsedSelectionFormat(
LOWpackages/lexical/src/LexicalUpdates.ts94export function errorOnInfiniteTransforms(): void {
LOWpackages/lexical/src/LexicalUpdates.ts195export function internalGetActiveEditorState(): EditorState | null {
LOWpackages/lexical/src/LexicalUpdates.ts513function handleDEVOnlyPendingUpdateGuarantees(
LOWpackages/lexical/src/LexicalUpdates.ts746function triggerTextContentListeners(
LOWpackages/lexical/src/LexicalUpdates.ts899function triggerDeferredUpdateCallbacks(
LOWpackages/lexical/src/LexicalEditorState.ts29export function editorStateHasDirtySelection(
LOWpackages/lexical/src/LexicalUtils.ts162export function isSelectionCapturedInDecoratorInput(anchorDOM: Node): boolean {
LOWpackages/lexical/src/LexicalUtils.ts208export function getNearestEditorFromDOMNode(
105 more matches not shown…
Over-Commented Block50 hits · 50 pts
SeverityFileLineSnippet
LOW…arkdown-editor/src/extensions/ToolbarStateExtension.ts101 // The HistoryState object the signal holds is mutated in
LOW…a-react-plugin-host/src/stackblitz-workaround/index.ts41 // boolean: 'PlaygroundEditorTheme__tokenProperty',
LOW…a-react-plugin-host/src/stackblitz-workaround/index.ts61 // punctuation: 'PlaygroundEditorTheme__tokenPunctuation',
LOW…a-react-plugin-host/src/stackblitz-workaround/index.ts141 // 'PlaygroundEditorTheme__tableCellActionButtonContainer',
LOW…tension-sveltekit-ssr-hydration/vitest-setup-client.ts1/// <reference types="@vitest/browser/matchers" />
LOW…on-vanilla-tailwind/src/stackblitz-workaround/index.ts41 // boolean: 'PlaygroundEditorTheme__tokenProperty',
LOW…on-vanilla-tailwind/src/stackblitz-workaround/index.ts61 // punctuation: 'PlaygroundEditorTheme__tokenPunctuation',
LOW…on-vanilla-tailwind/src/stackblitz-workaround/index.ts141 // 'PlaygroundEditorTheme__tableCellActionButtonContainer',
LOWpackages/lexical-devtools/wxt.config.ts61 ],
LOWpackages/lexical-tailwind/src/index.ts41 // boolean: 'PlaygroundEditorTheme__tokenProperty',
LOWpackages/lexical-tailwind/src/index.ts61 // punctuation: 'PlaygroundEditorTheme__tokenPunctuation',
LOWpackages/lexical-tailwind/src/index.ts141 // 'PlaygroundEditorTheme__tableCellActionButtonContainer',
LOW…de-core/src/__tests__/unit/CodeImportExtension.test.ts141 });
LOW…t/src/__tests__/unit/LexicalExtensionComposer.test.tsx61 );
LOWpackages/lexical/src/LexicalReconciler.ts101// `startKey` (in next-map order, which equals prev order across the size-0 and
LOWpackages/lexical/src/LexicalReconciler.ts741 if (i !== k) {
LOWpackages/lexical/src/LexicalReconciler.ts1041 // the paragraphs it came from) the walk reaches a next-only key and
LOWpackages/lexical/src/LexicalReconciler.ts1521 // in the map carries `null` (RootNode constructor's default).
LOWpackages/lexical/src/LexicalReconciler.ts1741 // so instead we make it seem that these values are always set.
LOWpackages/lexical/src/LexicalSelection.ts781 // const anchorNode = this.anchor.getNode();
LOWpackages/lexical/src/LexicalSelection.ts801 // before.insertAfter(textNode);
LOWpackages/lexical/src/LexicalSelection.ts2301 // caret back instead of leaving the user's cursor "stuck" inside
LOWpackages/lexical/src/LexicalSelection.ts2321 resolvedOffset = childNodesLength - 1;
LOWpackages/lexical/src/LexicalSelection.ts2701): null | RangeSelection {
LOWpackages/lexical/src/LexicalEvents.ts241 // If we're working with a non-text node.
LOWpackages/lexical/src/LexicalEvents.ts781 $updateSelectionFormatStyleFromTextNode(selection, anchorNode);
LOW…xical/src/nodes/__tests__/unit/LexicalTabNode.test.tsx81 // test('can paste HTML with tabs and new lines #4429', async () => {
LOW…rc/__tests__/unit/FastPathCrossParentTextCache.test.ts61
LOW…s/lexical/src/__tests__/unit/LexicalReconciler.test.ts761 // Verifies the cached-text-size invariant under sustained typing on the
LOW…s/lexical/src/__tests__/unit/LexicalReconciler.test.ts1321 // child's recursive reconcile resets the module state at entry and
LOW…s/lexical/src/__tests__/unit/LexicalReconciler.test.ts1381 editor.read(() => {
LOW…s/lexical/src/__tests__/unit/LexicalReconciler.test.ts1461 // textA, format 0). `__lexicalFirstTextKey` should reflect that.
LOW…s/lexical/src/__tests__/unit/LexicalReconciler.test.ts1921 // AUDIT-7: the suffix size-delta helper hardcodes expectedK = 2 for
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx861 // moveNativeSelection([0, 0, 0], 0, [0, 0, 0], 0),
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx881 // insertText('lexical'),
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx901 // '<strong class="editor-text-bold" data-lexical-text="true">draft</strong><span data-lexical-text="true">!</sp
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx921 // anchorOffset: 0,
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx941 // focusOffset: 5,
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx961 // {
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx981 // insertText('Hello draft!'),
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx1001 // insertText('This works!'),
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx1021 // expectedHTML:
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx1041 // },
LOW…selection/src/__tests__/unit/LexicalSelection.test.tsx1061 // ],
LOWpackages/lexical-list/src/checkList.ts61
LOW…al-list/src/__tests__/unit/ListImportExtension.test.ts161// nested <span style='mso-list:Ignore'>...</span>. There are no <ol>/<ul>
LOW…-utils/src/__tests__/unit/LexicalEventHelpers.test.tsx541 b
LOW…/lexical-extension/src/ClickAfterLastBlockExtension.ts141 effect(() => {
LOWpackages/lexical-html/src/DOMRenderRuntime.ts201 overrides: next as AnyDOMRenderMatch[],
LOW…al-markdown/src/__tests__/unit/LexicalMarkdown.test.ts321 // Multiline paragraphs
Verbosity Indicators9 hits · 16 pts
SeverityFileLineSnippet
LOWpackages/lexical-table/src/LexicalTablePluginHelpers.ts564 // Step 1: Unmerge all merged cells within the affected area
LOWpackages/lexical-table/src/LexicalTablePluginHelpers.ts592 // Step 2: Expand current table (if needed)
LOWpackages/lexical-table/src/LexicalTablePluginHelpers.ts610 // Step 3: Merge cells and set cell content, to match template grid
LOW…rc/__tests__/unit/LexicalTableMobileSelection.test.tsx291 // Step 1: Start a mouse drag selection (pointerdown with buttons: 1)
LOW…rc/__tests__/unit/LexicalTableMobileSelection.test.tsx297 // Step 2: Move to another cell (normal drag, buttons: 1)
LOW…rc/__tests__/unit/LexicalTableMobileSelection.test.tsx303 // Step 3: Simulate mouse re-entering window after leaving
LOW…-playground/__tests__/unit/LayoutContainerNode.test.ts106 // Step 1: Create a layout container and export to HTML
LOW…-playground/__tests__/unit/LayoutContainerNode.test.ts118 // Step 2: Clear the editor and re-import the exported HTML
LOW…-playground/__tests__/unit/LayoutContainerNode.test.ts127 // Step 3: Verify the imported node has the correct templateColumns
AI Slop Vocabulary2 hits · 6 pts
SeverityFileLineSnippet
MEDIUMpackages/lexical/src/LexicalUpdates.ts301 // We leverage editor._dirtyLeaves to track the new dirty leaves after the transforms
MEDIUM…ages/lexical/src/__tests__/unit/LexicalEditor.test.tsx786 // Add transform makes everything dirty the first time (let's not leverage this here)
Fake / Example Data3 hits · 3 pts
SeverityFileLineSnippet
LOW…ct/src/__tests__/unit/useExtensionSignalValue.test.tsx334 name: 'John Doe',
LOW…exical-link/src/__tests__/unit/LexicalLinkNode.test.ts262 {input: 'user@example.com', output: 'mailto:user@example.com'},
LOW…exical-link/src/__tests__/unit/LexicalLinkNode.test.ts875 expect(formatUrl('user@example.com')).toBe('mailto:user@example.com');
Slop Phrases1 hit · 1 pts
SeverityFileLineSnippet
LOW…exical/src/__tests__/unit/LexicalSerialization.test.ts114 const expectedStringifiedEditorState = `{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","