Skip to content

lint rule: "a message should only be used once" #4032

@samuelstroschein

Description

@samuelstroschein

Problem

Referencing the same message in multiple places leads to a broken message.

No guarantee exists that a message with the content like "learn more" won't be changed by someone to "learn more about unlimited inboxes". If the message is rendering all "learn more" references, the example website below will break at 2 and 3.

CleanShot 2024-02-18 at 14 08 36@2x

CleanShot 2024-02-18 at 14 08 36@2x

Proposal

A lint rule that detects if a message id is used multiple times in source code.

// unlimited inboxes
<p>{m.elephant_big_tree()}</p>

// manage team members
// 💥 error m.elephant is used multiple times
<p>{m.elephant_big_tree()}</p>

// spam report
// 💥 error m.elephant is used multiple times
<p>{m.blue_box({ title: m.elephant_big_tree() })}</p>

(Creating new messages is cheaper nowadays with AI translations than trying to manage shared messages.)

Additional information

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