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

Rule Proposal: no-duplicate-keys-in-locale #104

Closed
ota-meshi opened this issue Aug 11, 2020 · 1 comment · Fixed by #112
Closed

Rule Proposal: no-duplicate-keys-in-locale #104

ota-meshi opened this issue Aug 11, 2020 · 1 comment · Fixed by #112
Labels
Type: Feature Includes new features

Comments

@ota-meshi
Copy link
Member

Please describe what the rule should do:

This rule reports duplicate keys within the same locale.

What category of rule is this? (place an "X" next to just one item)

[ ] Enforces code style (layout)
[X] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

  • en.for-module1.json
{
  "dupe-key1": "foo", // <- dupe-key1 are duplicates.
  "dupe-key1": "bar", // <- dupe-key1 are duplicates.
  "dupe-key2": "baz", // <- dupe-key2 duplicates the same locale key in another file.
}
  • en.for-module2.json
{
  "dupe-key2": "qux", // <- dupe-key2 duplicates the same locale key in another file.
}

Additional context

I found in #79 that some users have multiple resources for the same locale.

I thought that if you split into multiple files, you will not be able to check for duplicate keys or missing keys, but I realized that this plugin mechanism can implement rules to check for duplicate keys and missing keys.

If we add this rule, we need to change the no-missing-keys rule to not report if you have at least one hit in the same locale.

I also considered whether a rule was needed to report keys that were existing in one locale and missing in another.
In my opinion, this rule is not needed as the reporting of the no-missing-keys rule meets this.

@kazupon kazupon added the Type: Feature Includes new features label Aug 11, 2020
@kazupon
Copy link
Member

kazupon commented Aug 11, 2020

We also need rules to detect duplicate messages as similar issues.
#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Includes new features
Projects
None yet
2 participants