Commit Graph

8 Commits

Author SHA1 Message Date
Lance Ball 09b0c76826
feat: add ValidationError type extending TypeError (#151)
This change adds a `ValidationError` type that extends `TypeError`. Any time a `CloudEvent` cannot be received and created with the given input, this error will be thrown. Tests have all
been updated to check for the error type.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-13 13:27:18 -04:00
Lance Ball e83db297ae chore: update eslint rules to disallow var usage
Enforce the use of `let` and `const` by using elsint rules.
When creating the eslint configuration, I had assumed that
`extends: eslint:recommended` would have covered this, but
apparently not!

Existing usage of `var` fixed with `npm run lint -- --fix`.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/97

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-30 12:36:04 -03:00
Lance Ball 5110ad4c67 src,fix: drop support for v0.2 and clean up contenttype
This commit removes support for the v0.2 specification. It also removes the
`contenttype` attribute from the `CloudEvent` object. While the HTTP protocol
binding specifies that in binary mode, the `datacontenttype` attribute should
map to the HTTP Content-Type header, that doesn't mean that the `CloudEvent`
object should have a `contenttype` property.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/61
Fixes: https://github.com/cloudevents/sdk-javascript/issues/66

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-28 17:37:49 -03:00
Lance Ball 3f238a0124
src: add eslint configuration and npm script
Automatically fixed > 2000 issues. The remaining 200+ issues need
to be fixed by hand. Additionally, all strings are double quotes
which is not typically standard and I wonder about fixing that too.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-22 10:15:05 -04:00
Fabio José f5e0ce6a84 Removing the cyclomatic complexity
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-17 11:27:54 -03:00
Fabio José 62e5404c0f Remove the responsability of spec checking
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-06-21 10:56:41 -03:00
Fabio José 8915048791 Spec as parser parameter
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-06-10 21:20:04 -03:00
Fabio José c1a2b29bae Folder for formats tests
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-06-09 20:56:22 -03:00