Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init #1

Merged
merged 17 commits into from
Jul 26, 2020
Merged

Init #1

merged 17 commits into from
Jul 26, 2020

Conversation

delvedor
Copy link
Member

Initial code.

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows Code of conduct

@delvedor delvedor requested a review from mcollina June 27, 2020 09:32
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@delvedor delvedor requested a review from mcollina July 11, 2020 13:15
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm


```
warning.create(name, code, message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some time now I have been really enamored with named parameters. What do you think of this signature instead?:

Suggested change
warning.create(name, code, message)
warning.create({ name, code, message })

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to use options objects as parameters when some of those parameters are optional, given that here all of them are mandatory, I think we could keep them as is. Also, this "style" follows the same as the fastify-error package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they give clarity to the reader. For example, random bit of code:

const warning = fastifyWarning.create('foo', 'fst_foo', 'a warning')

vs

const warning = fastifyWarning.create({ name: 'foo', code: 'fst_foo', message: 'a warning' })

In my opinion, the second is easier to read by anyone, not just those who are already familiar with the API.

@@ -0,0 +1,143 @@
'use strict'

const test = require('ava')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not tap?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the requirement of using their CLI, I like the design of ava, just wanted to try it a bit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That runner requirement is because it always transpiles the code being tested. It makes it unnecessarily difficult to debug things if needed.

Personally, I'd rather see consistency across all "official" modules. 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ava does not transpile the code anymore.

delvedor and others added 5 commits July 13, 2020 14:38
Co-authored-by: James Sumners <james@sumners.email>
Co-authored-by: James Sumners <james@sumners.email>
Co-authored-by: James Sumners <james@sumners.email>
Co-authored-by: James Sumners <james@sumners.email>
Co-authored-by: James Sumners <james@sumners.email>
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@delvedor delvedor merged commit eb4f783 into master Jul 26, 2020
@delvedor delvedor deleted the init branch July 26, 2020 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants