Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
samuelstroschein opened this issue Mar 22, 2024 · 1 comment
Open

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

samuelstroschein opened this issue Mar 22, 2024 · 1 comment

Comments

@samuelstroschein
Copy link
Member

Discussed in opral/monorepo#2253

Originally posted by samuelstroschein February 18, 2024

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 than trying to manage shared messages.)

Additional information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant