acstll / jquery-validity

2 stars 1 forks source link

Make friendly to jQuery-compatible alternatives #3

Open taoeffect opened 8 years ago

taoeffect commented 8 years ago

I've just stumbled across your excellent validation plugin. I looked at many, and what I like about yours is how small it is. There are many jQuery-compatible libraries out there that are much smaller than jQuery (e.g. Sprint, Minified, Zepto, etc.).

I'd like to use this library but with Sprint. However, I get this annoying message when doing npm install:

├── UNMET PEER DEPENDENCY jquery@^2.1.4
└── jquery-validity@1.1.0

Would be cool if jQuery could be removed from peerDependencies. :)

acstll commented 8 years ago

Hey there, thank you for your comment. I thought no-one was using this thing. :-)

Apart from the peerDependencies warning (which is ok IMO), I think actually trying to require jQuery would be more annoying… don't you think? https://github.com/acstll/jquery-validity/blob/master/index.js#L5

I'd love to make this library friendly to jQuery alternatives, as you suggest.

Do you know any examples of other libraries that do this well?

I was also planning to extract the main logic into a framework-agnostic library (just vanilla JS), and then offer a jQuery plugin on top of it. (Something like this https://www.npmjs.com/package/validate-form, there's also some library extracted from redux-form but I can't find it.)

taoeffect commented 8 years ago

Apart from the peerDependencies warning (which is ok IMO), I think actually trying to require jQuery would be more annoying… don't you think? https://github.com/acstll/jquery-validity/blob/master/index.js#L5

This is true, but I was also able to get around this using @jmm's pathmodify browserify plugin:

pathmodify.mod.re(/^jquery$/i, 'sprint-js')

I was also planning to extract the main logic into a framework-agnostic library (just vanilla JS), and then offer a jQuery plugin on top of it. (Something like this https://www.npmjs.com/package/validate-form, there's also some library extracted from redux-form but I can't find it.)

I think that's a great idea! One reason why I chose to work with your plugin (out of the millions of validation thingys out there) is that I wanted a simple, tiny validation module that got the job done while:

Vanilla JS would be perfect! People add lots of modules to their projects and when each of those is huge and imports a bunch of other modules it just gets ridiculous, so thank you very much for the great job you've done!

acstll commented 8 years ago

@taoeffect thanks a lot!