Showing 163 of 163 total issues
Function set
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function set(arg: ModifierArg<SnapState>) {
const { interaction, coords, state } = arg
const { options, offsets } = state
const origin = getOriginXY(interaction.interactable!, interaction.element!, interaction.prepared.name)
Function install
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function install(scope: Scope) {
const listeners = {} as any
for (const method of methodNames) {
listeners[method] = doOnInteractions(method, scope)
Function indexOfDeepestElement
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function indexOfDeepestElement(elements: Element[] | NodeListOf<globalThis.Element>) {
let deepestNodeParents: Node[] = []
let deepestNodeIndex: number
for (let i = 0; i < elements.length; i++) {
Interaction
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export class Interaction<T extends ActionName | null = ActionName> {
/** current interactable being interacted with */
interactable: Interactable | null = null
/** the target element of the interactable */
Function doOnInteractions
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function doOnInteractions(method: string, scope: Scope) {
return function (event: Event) {
const interactions = scope.interactions.list
const pointerType = pointerUtils.getPointerType(event)
Function install
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function install(scope: Scope) {
const listeners = {} as any
for (const method of methodNames) {
listeners[method] = doOnInteractions(method, scope)
- 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
Interactable
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export class Interactable implements Partial<Eventable> {
/** @internal */ get _defaults(): Defaults {
return {
base: {},
perAction: {},
File events.ts
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as arr from '@interactjs/utils/arr'
import * as domUtils from '@interactjs/utils/domUtils'
import is from '@interactjs/utils/is'
import pExtend from '@interactjs/utils/pointerExtend'
import * as pointerUtils from '@interactjs/utils/pointerUtils'
Function init
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function init(window: any) {
const Element = domObjects.Element
const navigator: Partial<Navigator> = window.navigator || {}
// Does the browser support touch input?
- 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 withinInteractionLimit
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function withinInteractionLimit<T extends ActionName>(
interactable: Interactable,
element: Element,
action: ActionProps<T>,
scope: Scope,
- 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 dropzoneMethod
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function dropzoneMethod(interactable: Interactable, options?: DropzoneOptions | boolean) {
if (is.object(options)) {
interactable.options.drop.enabled = options.enabled !== false
if (options.listeners) {
Function mouseOrPen
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
mouseOrPen({ pointerId, pointerType, eventType, scope }: SearchDetails) {
if (pointerType !== 'mouse' && pointerType !== 'pen') {
return 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 constructor
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
interaction: Interaction<T>,
event: PointerEventType,
actionName: T,
phase: P,
Function resizeChecker
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resizeChecker(arg) {
const { interaction, interactable, element, rect, buttons } = arg
if (!rect) {
return undefined
Function fire
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fire<T extends string>(
arg: {
pointer: PointerType | PointerEvent<any>
event: PointerEventType | PointerEvent<any>
eventTarget: Node
Function dropCheckMethod
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function dropCheckMethod(
interactable: Interactable,
dragEvent: InteractEvent,
event: PointerEventType,
draggable: Interactable,
Function unset
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
unset() {
if (is.string(this.target)) {
// remove delegated events
for (const type in this._scopeEvents.delegatedEvents) {
const delegated = this._scopeEvents.delegatedEvents[type]
- 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 normalize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function normalize(
type: EventTypes,
listeners?: ListenersArg | ListenersArg[] | null,
filter = (_typeOrPrefix: string) => true,
result?: NormalizedListeners,
- 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 doReflow
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function doReflow<T extends ActionName>(
interactable: Interactable,
action: ActionProps<T>,
scope: Scope,
): Promise<Interactable> {
- 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 collectDropzones
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function collectDropzones({ interactables }: Scope, draggableElement: Element) {
const drops: ActiveDrop[] = []
// collect all dropzones and their elements which qualify for a drop
for (const dropzone of interactables.list) {
- 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"