Showing 889 of 1,485 total issues
Function syncCursorPositions
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
export function syncCursorPositions(
binding: Binding,
provider: Provider,
): void {
const awarenessStates = Array.from(provider.awareness.getStates());
- 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 onSelectionChange
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onSelectionChange(
domSelection: Selection,
editor: LexicalEditor,
isActive: boolean,
): void {
Function modify
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
Selection.prototype.modify = function (alter, direction, granularity) {
// This is not a thorough implementation, it was more to get tests working
// given the refactor to use this selection method.
const symbol = Object.getOwnPropertySymbols(this)[0];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Function $convertTableCellNodeElement
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export function $convertTableCellNodeElement(
domNode: Node,
): DOMConversionOutput {
const domNode_ = domNode as HTMLTableCellElement;
const nodeName = domNode.nodeName.toLowerCase();
- 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 $convertTableCellNodeElement
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export function $convertTableCellNodeElement(
domNode: Node,
): DOMConversionOutput {
const domNode_ = domNode as HTMLTableCellElement;
const nodeName = domNode.nodeName.toLowerCase();
- 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 modify
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
modify(
alter: 'move' | 'extend',
isBackward: boolean,
granularity: 'character' | 'word' | 'lineboundary',
): void {
Function splice
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
splice(
start: number,
deleteCount: number,
nodesToInsert: Array<LexicalNode>,
): this {
Function registerNestedElementResolver
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export function registerNestedElementResolver<N extends ElementNode>(
editor: LexicalEditor,
targetNode: Klass<N>,
cloneNode: (from: N) => N,
handleOverlap: (from: N, to: N) => 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 $unmergeCell
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export function $unmergeCell(): void {
const selection = $getSelection();
invariant(
$isRangeSelection(selection) || $isTableSelection(selection),
'Expected a RangeSelection or TableSelection',
- 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 $createNode
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function $createNode(
key: NodeKey,
parentDOM: null | HTMLElement,
insertDOM: null | Node,
): 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
Function $patchStyleText
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function $patchStyleText(
selection: BaseSelection,
patch: Record<
string,
| string
Function getMainEditorFullToolbar
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getMainEditorFullToolbar(context: EditorUiContext): EditorContainerUiElement {
const inRtlMode = context.manager.getDefaultDirection() === 'rtl';
return new EditorSimpleClassContainer('editor-toolbar-main', [
Function positionNodeOnRange
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function positionNodeOnRange(
editor: LexicalEditor,
range: Range,
onReposition: (node: Array<HTMLElement>) => void,
): () => void {
LexicalEditor
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
export class LexicalEditor {
['constructor']!: KlassConstructor<typeof LexicalEditor>;
/** The version with build identifiers for this editor (since 0.17.1) */
static version: string | undefined;
Function splitText
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
splitText(...splitOffsets: Array<number>): Array<TextNode> {
errorOnReadOnly();
const self = this.getLatest();
const textContent = self.getTextContent();
const key = self.__key;
Function extract
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
extract(): Array<LexicalNode> {
const selectedNodes = this.getNodes();
const selectedNodesLength = selectedNodes.length;
const lastIndex = selectedNodesLength - 1;
const anchor = this.anchor;
- 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 onKeyDown
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onKeyDown(event: KeyboardEvent, editor: LexicalEditor): void {
lastKeyDownTimeStamp = event.timeStamp;
lastKeyCode = event.key;
if (editor.isComposing()) {
return;
File lexical-node.ts
has 336 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 $trimTextContentFromAnchor
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function $trimTextContentFromAnchor(
editor: LexicalEditor,
anchor: Point,
delCount: number,
): void {
Consider simplifying this complex logical expression. Open
if (
node.isToken() ||
(compositionKey !== null &&
nodeKey === compositionKey &&
!isComposing) ||