Skip to content

Conversation

@emmenko
Copy link
Member

@emmenko emmenko commented Aug 18, 2020

Some maintenance work:

}

async _resolveVariantReferences(variant: Variant) {
async _resolveVariantReferences(variant: Variant): Promise<Variant> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Flow requires exported functions/interfaces to have an explicit return type declaration

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Missing type annotation at function return:Flow(signature-verification-failure)

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes somehow sense to be explicit about the return type.

/* Client */
export type CustomClientResult = ClientResult & {
id?: string,
id: string,
Copy link
Member Author

Choose a reason for hiding this comment

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

This should have been required, as far as I can see in the code

// Set flowtype annotations
config: AuthOptions
fetcher: ConfigFetch
fetcher: typeof fetch
Copy link
Member Author

Choose a reason for hiding this comment

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

We should be able to use the built-in type declarations for the fetch object.

Because of that, we can remove all our custom type declarations.

Comment on lines -209 to +242
expect.objectContaining({
headers: {
'Content-Type': ['application/json'],
'Content-Type': 'application/json',
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 couldn't recall why we were using an array of values for some headers...I think it makes sense to keep it simple and declare it as a single value

Copy link
Contributor

Choose a reason for hiding this comment

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

Your argument makes sense to me too 👍

@emmenko emmenko requested a review from a team August 18, 2020 10:04
@emmenko emmenko force-pushed the nm-upgrade-flow-yarn branch from 379e1e2 to 5b7e75a Compare August 18, 2020 11:34
@emmenko emmenko changed the title chore: upgrade flowtype to 0.131.0 and yarn to 1.22.4 chore: upgrade flowtype to 0.131.0 Aug 18, 2020
@codecov
Copy link

codecov bot commented Aug 18, 2020

Codecov Report

Merging #1603 into master will decrease coverage by 0.05%.
The diff coverage is 89.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1603      +/-   ##
==========================================
- Coverage   98.67%   98.62%   -0.06%     
==========================================
  Files         128      128              
  Lines        3326     3345      +19     
  Branches      766      773       +7     
==========================================
+ Hits         3282     3299      +17     
- Misses         40       42       +2     
  Partials        4        4              
Impacted Files Coverage Δ
packages/product-json-to-csv/src/main.js 93.43% <ø> (ø)
...ckages/product-json-to-csv/src/map-product-data.js 99.33% <ø> (ø)
packages/product-json-to-xlsx/src/writer.js 100.00% <ø> (ø)
packages/resource-deleter/src/main.js 100.00% <ø> (ø)
packages/sdk-middleware-http/src/http.js 97.46% <88.88%> (-1.07%) ⬇️
packages/sdk-auth/src/auth.js 98.98% <90.90%> (-1.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9999af1...1b965b2. Read the comment docs.

Copy link
Contributor

@katmatt katmatt left a comment

Choose a reason for hiding this comment

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

Looks very good to me 👍

}

async _resolveVariantReferences(variant: Variant) {
async _resolveVariantReferences(variant: Variant): Promise<Variant> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes somehow sense to be explicit about the return type.

Comment on lines -209 to +242
expect.objectContaining({
headers: {
'Content-Type': ['application/json'],
'Content-Type': 'application/json',
Copy link
Contributor

Choose a reason for hiding this comment

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

Your argument makes sense to me too 👍

@emmenko emmenko requested a review from daern91 August 19, 2020 08:58
Copy link
Contributor

@daern91 daern91 left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thx a lot for putting in the effort here

suppress_type=$FlowIssue
suppress_type=$FlowFixMe

# https://medium.com/flow-type/types-first-a-scalable-new-architecture-for-flow-3d8c7ba1d4eb
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for adding the links/context

Comment on lines 68 to 70
/* eslint-disable */
fetchFunction = fetch
/* eslint-enable */
Copy link
Contributor

Choose a reason for hiding this comment

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

do we disable here because of the reassignment? Doesn't flow allow casting, maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah sorry, this is not necessary anymore. 5dc6357

let retryCount = 0
// wrap in a fn so we can retry if error occur
function executeFetch() {
// $FlowFixMe
Copy link
Contributor

Choose a reason for hiding this comment

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

super nice to see this one removed

@emmenko emmenko force-pushed the nm-upgrade-flow-yarn branch from 5dc6357 to 1b965b2 Compare August 21, 2020 18:18
@emmenko emmenko merged commit 707007d into master Aug 21, 2020
@emmenko emmenko deleted the nm-upgrade-flow-yarn branch August 21, 2020 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants