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

Fix flow types #2573

Merged
merged 4 commits into from Feb 22, 2018
Merged

Fix flow types #2573

merged 4 commits into from Feb 22, 2018

Conversation

rgbkrk
Copy link
Member

@rgbkrk rgbkrk commented Feb 22, 2018

This addresses some of the shortcomings of our current flow setup with @nteract/core. Ended up noticing a type mismatch as well, which I fixed by making mapStateToProps take a little less for options.

@rgbkrk rgbkrk force-pushed the fix-flow-types branch 2 times, most recently from d448a55 to 61de032 Compare February 22, 2018 18:38
.flowconfig Outdated
@@ -4,7 +4,9 @@ types

[options]
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
module.name_mapper='^@nteract/core/(.+)$' -> '<PROJECT_ROOT>/packages/core/src/$1'
module.name_mapper='^@nteract/core$' -> '<PROJECT_ROOT>/packages/core/src/'
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for the trailing slash?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, lemme switch it to make it consistent

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, the rest of these down below have a trailing slash so I think I probably kept it consistent there.

.flowconfig Outdated
module.name_mapper='^@nteract/core/(.+)$' -> '<PROJECT_ROOT>/packages/core/src/$1'
module.name_mapper='^@nteract/core$' -> '<PROJECT_ROOT>/packages/core/src/'
module.name_mapper='^@nteract/core/(?!src)(.+)$' -> '<PROJECT_ROOT>/packages/core/src/$1'
module.name_mapper='^@nteract/core/src/(.+)$' -> '<PROJECT_ROOT>/packages/core/src/$1'
Copy link
Contributor

Choose a reason for hiding this comment

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

We're going to eventually not allow @nteract/core/* imports, right? Like we're going to change this to be a defacto import from @nteract/core, ya?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. Figured I might as well push this to stay consistent for now at least. Once we've switched them, let's take the rule out.

@@ -2,7 +2,7 @@ jest.mock("fs");
import { ActionsObservable } from "redux-observable";
import { dummyStore, dummyCommutable } from "@nteract/core/dummy";

import { save, saveAs } from "@nteract/core/actions";
import { actions } from "@nteract/core";
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 this is much nicer, imo.

KERNEL_RAW_STDOUT,
KERNEL_RAW_STDERR
} from "@nteract/core/actionTypes";

Copy link
Contributor

Choose a reason for hiding this comment

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

👋


import { setNotificationSystem } from "@nteract/core/actions";
import { actions, providers } from "@nteract/core";
const { NotebookApp, Styles } = providers;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. So, the only time I've seen this get hairy is when you have a sneaky cyclic import. I.e., it's possible to structure your code such that that providers is actually not yet defined here if there's some cyclic stuff going on, which will set NotebookApp and Styles to undefined for the life of this module. I don't think we're going to run into an issue here, but it's something that I've seen with this pattern before and you just get a runtime error, which can be confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise, this is totally fine for now with the hope that we'll actually provide these as a top-level export later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I could switch this to the export * from 'providers' setup in @nteract/core and just go from there.

Due to a naming conflict, I switched our editor wrapper component to
the name <Source>
@@ -196,7 +196,7 @@ export const Example = () => (
counter={cell.executionCount}
/>
)}
<Editor>
<Source>
Copy link
Contributor

Choose a reason for hiding this comment

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

woo!

@theengineear theengineear merged commit ac82c75 into nteract:master Feb 22, 2018
@rgbkrk rgbkrk deleted the fix-flow-types branch February 22, 2018 19:30
@rgbkrk rgbkrk added this to the Jupyter Extension M1 milestone Feb 28, 2018
@rgbkrk rgbkrk mentioned this pull request Mar 7, 2018
7 tasks
@lock
Copy link

lock bot commented May 1, 2018

Howdy! I'm 🔓🤖!

In order to keep information timely (based on the most recent release), we want all activity to be added to either new issues or open issues and PRs. In service to that goal, I, the lock bot close inactive closed issues when they haven't had activity in 120 days.

Feel free to open a new issue for related bugs and link to relevant comments from this thread.

@lock lock bot locked and limited conversation to collaborators May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants