-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Maintainers Guide
Chris O'Hara edited this page Sep 24, 2018
·
12 revisions
Some guiding principles I've tried to stick to (by @chriso):
- Keep things simple
- Make sure the README is kept up to date with validators, options and locales
- Prefer small, composable validators, e.g.
isAlpha(str)
&&isLength(str, 0, 10)
vs. something likeisAlphaOfLength(str, 0, 10)
- Avoid adding validators that check for specific character combinations (e.g. alpha + space). There are too many combinations of character sets, so just provide a regular expression they can use instead and close the issue/PR
- Avoid adding validators that would bloat the library, e.g. validating phone numbers or even something like semver, particularly if there's an existing library that does it well. People still bundle
validator.min.js
so try to keep the size down - Try to avoid adding locale-specific validators (e.g. tax codes or national identity number validators) unless they're trivial, they can be generalized, or they're widely requested
- Try to grab a reference (RFC, wikipedia page, whatever) for new validators
- I mostly ignore the feature request issues. If someone wants it badly enough, they'll submit a PR. Keeping them open for a while is also useful in gauging how many other people want the feature.
- If in doubt, open the PR/issue up for discussion and tag me
- Keep the
CHANGELOG.md
up to date after each merge