Showing 889 of 1,485 total issues
Function $reconcileNodeChildren
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
nextElement: ElementNode,
prevChildren: Array<NodeKey>,
nextChildren: Array<NodeKey>,
prevChildrenLength: number,
nextChildrenLength: number,
Avoid deeply nested control flow statements. Open
if (isCopy(key, shiftKey, metaKey, ctrlKey)) {
event.preventDefault();
dispatchCommand(editor, COPY_COMMAND, event);
} else if (isCut(key, shiftKey, metaKey, ctrlKey)) {
event.preventDefault();
Avoid deeply nested control flow statements. Open
} else if (node === lastNode) {
text = isBefore
? text.slice(0, focusOffset)
: text.slice(0, anchorOffset);
}
Avoid deeply nested control flow statements. Open
if (
anchorNode.is(focusNode) ||
(isBackward && offset !== 0) ||
(!isBackward && offset !== textContentSize)
) {
Avoid deeply nested control flow statements. Open
if (removedDOMsLength !== unremovedBRs) {
if (targetDOM === rootElement) {
targetNode = internalGetRoot(currentEditorState);
}
Avoid deeply nested control flow statements. Open
if (
// eslint-disable-next-line no-prototype-builtins
!proto.hasOwnProperty('exportJSON')
) {
console.warn(
Function $garbageCollectDetachedDeepChildNodes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
node: ElementNode,
parentKey: NodeKey,
prevNodeMap: NodeMap,
nodeMap: NodeMap,
nodeMapDelete: Array<NodeKey>,
Function drawReceive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function drawReceive(event: MessageEvent) {
if (!event.data || event.data.length < 1) return;
if (event.origin !== lastApprovedOrigin) return;
const message = JSON.parse(event.data);
- 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
Avoid deeply nested control flow statements. Open
if (!klass.hasOwnProperty(method)) {
console.warn(`${name} must implement static "${method}" method`);
}
Avoid deeply nested control flow statements. Open
if (proto instanceof DecoratorNode) {
// eslint-disable-next-line no-prototype-builtins
if (!proto.hasOwnProperty('decorate')) {
console.warn(
`${proto.constructor.name} must implement "decorate" method`,
Avoid deeply nested control flow statements. Open
for (let j = 0; j < listenersLength; j++) {
if (listeners[j](payload, editor) === true) {
return true;
}
}
Function createTextInnerDOM
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
innerDOM: HTMLElement,
node: TextNode,
innerTag: string,
format: number,
text: string,
Avoid deeply nested control flow statements. Open
if (node.isAttached()) {
node.remove();
}
Avoid deeply nested control flow statements. Open
if (prevFormat & flag) {
domClassList.remove(...classNames);
}
Function parseRefs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function parseRefs(name: string, element: HTMLElement):
{refs: Record<string, HTMLElement>, manyRefs: Record<string, HTMLElement[]>} {
const refs: Record<string, HTMLElement> = {};
const manyRefs: Record<string, 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
Avoid deeply nested control flow statements. Open
if (siblingDOM != null) {
dom.insertBefore(childDOM, siblingDOM);
} else {
dom.appendChild(childDOM);
}
Function mergeWithSibling
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
mergeWithSibling(target: TextNode): TextNode {
const isBefore = target === this.getPreviousSibling();
if (!isBefore && target !== this.getNextSibling()) {
invariant(
false,
- 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
Avoid deeply nested control flow statements. Open
if (canUseFastPath) {
// Fast path for removing DOM nodes
dom.textContent = '';
}
Avoid deeply nested control flow statements. Open
if (
// eslint-disable-next-line no-prototype-builtins
!klass.hasOwnProperty('importDOM') &&
// eslint-disable-next-line no-prototype-builtins
klass.hasOwnProperty('exportDOM')
Avoid deeply nested control flow statements. Open
if (
// eslint-disable-next-line no-prototype-builtins
!klass.hasOwnProperty('importJSON')
) {
console.warn(