Skip to content

No dynamic keys rule #106

@kristian240

Description

@kristian240

Hey! I want to contribute to this package with a new rule - no-dynamic-keys.

The rule aims to prevent developers to use dynamic keys for i18next.

Example of incorrect code:

<>
  <div>{i18next.t("hello" + "." + "world")}</div>
  <div>{i18next.t(`enum.${dynamicValue}`)}</div>
</>

Example of correct code:

<>
  <div>{i18next.t("hello.world"}</div>
  <div>{i18next.t('enum', { returnObjects: true })[dynamicValue]}</div>
</>

Do you think something like this could be useful?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions