i18next/react-i18next

View on GitHub

Showing 38 of 38 total issues

Function withTranslation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function withTranslation(ns, options = {}) {
  return function Extend(WrappedComponent) {
    function I18nextWithTranslation({ forwardedRef, ...rest }) {
      const [t, i18n, ready] = useTranslation(ns, rest);

Severity: Minor
Found in src/withTranslation.js - About 45 mins to fix

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 buildTransElement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function buildTransElement(
  extracted,
  finalAttributes,
  t,
  closeDefaults = false,
Severity: Minor
Found in icu.macro.js - About 45 mins to fix

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 renderNodes has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
Severity: Minor
Found in src/Trans.js - About 45 mins to fix

    Function pushTranslatedJSX has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function pushTranslatedJSX(child, inner, mem, i, isVoid) {
    Severity: Minor
    Found in src/Trans.js - About 35 mins to fix

      Function buildTransElement has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        extracted,
        finalAttributes,
        t,
        closeDefaults = false,
        wasElementWithChildren = false,
      Severity: Minor
      Found in icu.macro.js - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

          return false;
        Severity: Major
        Found in src/utils.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
          Severity: Major
          Found in src/utils.js - About 30 mins to fix

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import React from 'react';
            Severity: Minor
            Found in src/withTranslation.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import { useTranslation } from './useTranslation';
            Severity: Minor
            Found in src/Translation.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            const { createMacro } = require('babel-plugin-macros');
            Severity: Minor
            Found in icu.macro.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import { useState, useEffect, useContext, useRef } from 'react';
            Severity: Minor
            Found in src/useTranslation.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            export { Trans } from './Trans';
            Severity: Minor
            Found in src/index.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            export function warn(...args) {
            Severity: Minor
            Found in src/utils.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import { createElement, useMemo } from 'react';
            Severity: Minor
            Found in src/I18nextProvider.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import React from 'react';
            Severity: Minor
            Found in src/context.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import React from 'react';
            Severity: Minor
            Found in src/withSSR.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import React, { useContext } from 'react';
            Severity: Minor
            Found in src/Trans.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Definition for rule 'jsx-a11y/anchor-is-valid' was not found
            Open

            import { useContext } from 'react';
            Severity: Minor
            Found in src/useSSR.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            Severity
            Category
            Status
            Source
            Language