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

New Rule: no-empty-string-values #54

Closed
1 task done
dananaprey opened this issue Nov 10, 2024 · 4 comments
Closed
1 task done

New Rule: no-empty-string-values #54

dananaprey opened this issue Nov 10, 2024 · 4 comments
Labels

Comments

@dananaprey
Copy link

dananaprey commented Nov 10, 2024

Rule details

Detect empty string values in JSON

What type of rule is this?

Suggests an alternate way of doing something

Example code

Real life example:

I have a JSON file for application localization

{
  "localizationKey1": "Some translation 1",
  "localizationKey2": "",
  "localizationKey3": "Some translation 3",
  ...
}

I want to prevent empty translations values ​​to avoid missing text in the application

This rule should help

Participation

  • I am willing to submit a pull request to implement this rule.

Additional comments

Similar rules, if necessary, can be made for values {}, [], null

I am also willing to submit a pull requests to implement this rules

@fasttime fasttime added this to Triage Nov 12, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Nov 12, 2024
@fasttime fasttime removed the status in Triage Nov 12, 2024
@fasttime fasttime moved this to Needs Triage in Triage Nov 12, 2024
@nzakas
Copy link
Member

nzakas commented Nov 12, 2024

Similar to #55, I'm not sure if this is generic enough to be included in the plugin. Empty string values are completely valid and I'm not sure represent an error in most cases.

@eslint/eslint-team what do you think?

@nzakas nzakas moved this from Needs Triage to Feedback Needed in Triage Nov 12, 2024
@JoshuaKGoldberg
Copy link

Agreed. From the broad perspective of JSON & common JSON uses, there's nothing inherently wrong with an empty string. Same with any arbitrary nullish/empty value. That's a library-specific thing. I'm -1 on building any into @eslint/json so early into project, if ever.

@mdjermanovic
Copy link
Member

I agree that empty string values are generally valid so this doesn't seem generic enough to be included in the plugin.

@mdjermanovic mdjermanovic closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2024
@github-project-automation github-project-automation bot moved this from Feedback Needed to Complete in Triage Nov 12, 2024
@dananaprey
Copy link
Author

Thanks for answers!

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

No branches or pull requests

4 participants