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

Document good-bad examples and suggestions #1012

Open
hyunbinseo opened this issue Jan 12, 2025 · 1 comment
Open

Document good-bad examples and suggestions #1012

hyunbinseo opened this issue Jan 12, 2025 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@hyunbinseo
Copy link

Continuing the discussion from this thread:

Problem

regex based rules are hard to grasp by their name only. For example,

  • digits is /^\d+$/ and does not allow -1.
  • decimal is /^[+-]?\d+(?:\.\d+)?$/ and does allow -1.

I was surprised to find this, because I thought the latter required decimal point(s).

Suggestion

What if the documentation showed:

  • good and bad examples like ESLint
  • suggestions to use another API

Example

digits

show regex /^\d+$/

✅ 3
❎ -3
❎ 3.0 // use decimal instead

@fabian-hiller
Copy link
Owner

Your idea is great. I will come back to this and other similar issues and PRs after V1 is available.

@fabian-hiller fabian-hiller self-assigned this Jan 13, 2025
@fabian-hiller fabian-hiller added the documentation Improvements or additions to documentation label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants