bradwestfall / house-rules

Highly re-usable field/input validators
MIT License
10 stars 1 forks source link

Reduce bundle size #3

Open iamvanja opened 6 years ago

iamvanja commented 6 years ago

With the introduction of date validation, house-rules gained weight dramatically (due to Moment.js). screen shot 2018-03-01 at 9 28 02 am

Can we do something about this?

bradwestfall commented 6 years ago

@iamvanja Thanks for bringing this up. It's been on a list of things to take care of. I like the idea of using Luxon and maybe as a peer dependency. That would make date validation opt-in in a sense, if you didn't install Luxon then house-rules date validation would be unavailable.

I don't think I want to rely on validator though, the needs I'm going have with date validation will eventually surpass validator's abilities

Thoughts?

iamvanja commented 6 years ago

@bradwestfall After thinking about this a bit further, I think if house-rules must keep the dates, the best solution IMHO would be to keep Moment, but make it a peer dependency. Reasoning is that projects that do a lot of date manipulations already include Moment anyway since it became defacto standard.

I know you disagree, but I do think that date validations outside of the validator scope should not be part of house-rule. It is simple to create custom rules for anything outside the validator scope so whatever the date dependency in the project, it would not be dictated by house-rules.