Validations being deprecated

In the validations documentation it is mentioned that the validations are to be deprecated in favour of can-validate.

I have tried incorporating can-validate into my current prototype but I cannot get it working and the docs… well… the docs. Nothing much to speak of. I have tried including can-validate.js and get this error:

import can from 'can'; // Uncaught SyntaxError: Unexpected token import

That looks like ES6. I am no JavaScript genius but these things should be easier.

There seems to be quite a liking of npm and node in the JavaScript sphere which is all good and well but not everyone works in that space. I need to pull in a JavaScript file and use the library. I attempted to host a demo from can-validate but it seems to be pulling in steal like so:

<script src="../../../node_modules/steal/steal.js" main="can/view/autorender/"></script>

This is making it hard to pick up any momentum.

Hey @eben_roux, you’re right that can-validate needs some further work. The validations plugin is older and more stable. It probably won’t have any new development put into it (unless someone from the community wants to own it), but that doesn’t mean it’s unsafe to use.

Thanks Matthew,

So are you recommending that I stick with the older/current validations framework until can-validate is more mature?

Regards,
Eben

Hey @eben_roux, that really depends on your needs. can-validate is a bit better in that it works with popular validation libraries, but it’s still alpha quality. If you’re willing to put up with those, or even better contribute to the project, then that’s the way to go.

Thanks Matthew,

Wouldn’t mind contributing but I have a stack of my own open-source projects that need attention (and documentation).

I’ll stick with the current implementation for now. Not doing anything too big so refactoring later on would be Ok.

Regards,
Eben

1 Like