Convert remaining of reducers to ES modules #2739
Convert remaining of reducers to ES modules #2739
Conversation
@@ -28,7 +28,7 @@ | |||
"lint-fix": "yarn lint-js -- --fix", | |||
"test": "jest", | |||
"test-coverage": "yarn test -- --coverage", | |||
"test-all": "yarn test; yarn lint", | |||
"test-all": "yarn test; yarn lint; yarn flow", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see note at the bottom of PR description addressing this.
Codecov Report
@@ Coverage Diff @@
## master #2739 +/- ##
=========================================
- Coverage 60.58% 60.1% -0.49%
=========================================
Files 55 54 -1
Lines 2144 2118 -26
Branches 434 434
=========================================
- Hits 1299 1273 -26
Misses 845 845
Continue to review full report at Codecov.
|
re test-all. Agreed! We've wanted to do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
return `${location.sourceId}:${location.line}`; | ||
} | ||
|
||
function allBreakpointsDisabled(state) { | ||
return state.breakpoints.every(x => x.disabled); | ||
} | ||
|
||
function update(state = State(), action: Action) { | ||
function update(state: Record<BreakpointsState> = State(), action: Action) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe export default here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered about this and in the end I followed the pattern that seems to be present in majority of the components - component is defined in one place, but exported by default at the end of the file. Do you think it would be better to place export immediately before the reducer?
coverage: coverage.update | ||
pause, | ||
ui, | ||
coverage | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
stop by our slack room :) |
We'd love to switch to webpack 2, but got stuck last time. We should have the branch lying around though |
Don't worry about coverage. That always happens with import. I don't know why. I'll drop the limits if I need to |
Re slack room: definitely! Re webpack: I might take a look at this in some not-so-distant future then, but I can't promise anything. 😄 Re coverage: Great! 👌 (Of course it's great that I don't need to worry, not that it happens 😄 ) |
Merging as this is too good to pass up. |
* Convert async-request reducer to ES modules * Convert breakpoints reducer to es modules * Convert coverage reducer to es modules * Convert pause reducer to es modules * Convert main reducer to es modules * Convert ui reducer to es modules * Export update function of reducers by default * Set proper types for reducers' state argument * Add flow type-checking to `test-all` command
Associated Issue: #1884
Summary of Changes
Converted following reducers to ES modules:
All reducers has been updated to export
update
reducer by default. This allowed to somewhat simplify main reducer (reducers/index
).Also, type definitions for
update
functions'state
argument have been added.Another small change is addition of
yarn flow
command to theyarn test-all
one. Lack of the former in the latter proved to be somewhat inconvenient when I wanted to manually check if everything is fine - the shortest way wasyarn test-all && yarn flow
. I completely agree this change is unrelated to the topic of this PR and won't mind to revert it if it's a problem.