Showing 889 of 1,485 total issues
File index.ts
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function getNodes
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
getNodes(): Array<LexicalNode> {
const cachedNodes = this._cachedNodes;
if (cachedNodes !== null) {
return cachedNodes;
}
File clipboard.ts
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function positionNodeOnRange
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export default function positionNodeOnRange(
editor: LexicalEditor,
range: Range,
onReposition: (node: Array<HTMLElement>) => void,
): () => void {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getNodes
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
getNodes(): Array<LexicalNode> {
const cachedNodes = this._cachedNodes;
if (cachedNodes !== null) {
return cachedNodes;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function formatText
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
formatText(formatType: TextFormatType): void {
if (this.isCollapsed()) {
this.toggleFormat(formatType);
// When changing format, we should stop composition
$setCompositionKey(null);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function $updateTextNodeFromDOMContent
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export function $updateTextNodeFromDOMContent(
textNode: TextNode,
textContent: string,
anchorOffset: null | number,
focusOffset: null | number,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function $convertTextDOMNode
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
function $convertTextDOMNode(domNode: Node): DOMConversionOutput {
const domNode_ = domNode as Text;
const parentDom = domNode.parentElement;
invariant(
parentDom !== null,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function $reconcileNode
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
function $reconcileNode(
key: NodeKey,
parentDOM: HTMLElement | null,
): HTMLElement {
const prevNode = activePrevNodeMap.get(key);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File formatList.ts
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function createEditor
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createEditor(editorConfig?: CreateEditorArgs): LexicalEditor {
const config = editorConfig || {};
const activeEditor = internalGetActiveEditor();
const theme = config.theme || {};
const parentEditor =
Function $beginUpdate
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $beginUpdate(
editor: LexicalEditor,
updateFn: () => void,
options?: EditorUpdateOptions,
): void {
Function updateDOMSelection
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateDOMSelection(
prevSelection: BaseSelection | null,
nextSelection: BaseSelection | null,
editor: LexicalEditor,
domSelection: Selection,
Function selectTableNodeInDirection
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
const selectTableNodeInDirection = (
tableObserver: TableObserver,
tableNode: TableNode,
x: number,
y: number,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function $beginUpdate
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function $beginUpdate(
editor: LexicalEditor,
updateFn: () => void,
options?: EditorUpdateOptions,
): void {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setTextThemeClassNames
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function setTextThemeClassNames(
tag: string,
prevFormat: number,
nextFormat: number,
dom: HTMLElement,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File tables.ts
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {EditorBasicButtonDefinition, EditorButtonDefinition} from "../../framework/buttons";
import tableIcon from "@icons/editor/table.svg";
import deleteIcon from "@icons/editor/table-delete.svg";
import deleteColumnIcon from "@icons/editor/table-delete-column.svg";
import deleteRowIcon from "@icons/editor/table-delete-row.svg";
Function $sliceSelectedTextNodeContent
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export function $sliceSelectedTextNodeContent(
selection: BaseSelection,
textNode: TextNode,
): LexicalNode {
const anchorAndFocus = selection.getStartEndPoints();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function syncChildrenFromYjs
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
syncChildrenFromYjs(binding: Binding): void {
// Now diff the children of the collab node with that of our existing Lexical node.
const lexicalNode = this.getNode();
invariant(
lexicalNode !== null,
Function $insertDataTransferForRichText
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
export function $insertDataTransferForRichText(
dataTransfer: DataTransfer,
selection: BaseSelection,
editor: LexicalEditor,
): void {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"