Skip to content

Return non-zero exit code on failure to extract strings #256

@djbb7

Description

@djbb7

🚀 Feature Proposal

Motivation

The scanner sometimes fails to extract strings due to the selected keys. However, the command exit code is always 0.
We run the local extraction on a pre-commit hook, and this type of human errors are common. It would be very useful if the i18next-scanner could return non-zero exit code in this case.

Example

// The first case creates a string in the locale json file 
{t('key1, 'Foo')}

// The second case tries to create an object in the `nested1` key,
// but it fails since there is already a literal in that key
{t('key1.title', 'Bar')}

The exit code of the i18next-scanner in this case is 0 and the output is:

i18next-scanner: failed to process file Example.tsx
i18next-scanner: count=1, file="Example.tsx"
✨  Done in 6.30s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions