FezVrasta/popper.js

View on GitHub
packages/react/src/hooks/useTypeahead.ts

Summary

Maintainability
C
1 day
Test Coverage

Function useTypeahead has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useTypeahead<RT extends ReferenceType = ReferenceType>(
  context: FloatingContext<RT>,
  props: UseTypeaheadProps,
): ElementProps {
  const {open, dataRef} = context;
Severity: Major
Found in packages/react/src/hooks/useTypeahead.ts - About 5 hrs to fix

Function onKeyDown has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function onKeyDown(event: React.KeyboardEvent) {
      const listContent = listRef.current;

      if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {
        if (
Severity: Major
Found in packages/react/src/hooks/useTypeahead.ts - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

      if (
        listContent == null ||
        ignoreKeysRef.current.includes(event.key) ||
        // Character key.
        event.key.length !== 1 ||
Severity: Major
Found in packages/react/src/hooks/useTypeahead.ts - About 40 mins to fix

There are no issues that match your filters.

Category
Status