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

chore: Replace Flowtype with Typescript #3

Merged
merged 5 commits into from
Feb 21, 2018

Conversation

benmvp
Copy link
Contributor

@benmvp benmvp commented Feb 21, 2018

Setting up the repo to run with Typescript instead of Flowtype. This required changing the initial code, updating Jest & updating ESLint.

Also:

  • Set up .travis.yml
  • Move eslint configuration into its own .eslintrc.json
  • Removing Babel as its replaced by Typescript (except babel-eslint which is needed by eslint-config-eventbrite)

(Filed #4 to upgrade to Babel 7 and use Babel + TypeScript)

Setting up the repo to run with Typescript instead of Flowtype. This required changing the initial code, updating Jest & updating ESLint.

Also:
- Move eslint configuration into its own `.eslintrc.json`
- Removing Babel as its replaced by Typescript (except `babel-eslint` which is needed by `eslint-config-eventbrite`)

# Target files
lib/
dist/

Choose a reason for hiding this comment

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

should we add **/.DS_Store ? Those files always show up for me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really? I've never seen those. I guess the first person to run into can add it. I don't have any to verify that it's working


module.exports = {
process(src, path) {
if (path.endsWith(".ts")) {

Choose a reason for hiding this comment

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

i might use, path.extname but i think it will be the same

https://nodejs.org/dist/latest-v8.x/docs/api/path.html#path_path_extname_path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I like that! The official Jest-Typescript example did this. 🤦‍♂️

"format": "prettier-eslint --write",
"lint": "eslint src",
"lint": "eslint --cache --max-warnings 0 --ext .ts,.js src",

Choose a reason for hiding this comment

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

that cache is key! thanks!

Copy link
Contributor

@kaylie-alexa kaylie-alexa left a comment

Choose a reason for hiding this comment

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

thanks for the change!

.npmignore Outdated
npm-debug.log*
yarn-debug.log*
yarn-error.log*

Copy link
Contributor

Choose a reason for hiding this comment

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

*.log should capture all three below, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that sounds about right...

Copy link

@rwholey-eb rwholey-eb left a comment

Choose a reason for hiding this comment

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

awesome! sounds good

@BenAtEventbrite BenAtEventbrite merged commit 98d06d7 into eventbrite:master Feb 21, 2018
@benmvp benmvp deleted the typescript branch February 21, 2018 22:18
BenAtEventbrite pushed a commit that referenced this pull request Feb 22, 2018
#3 Replaced Flow w/ Typescript and as a result removed Babel because TypeScript both transpiles and type checks. However this makes us miss out on a lot of the plugins that are a part of the Babel community. Babel 7 adds support for Typescript.

Use babel 7 to build assets instead of tsc. The tsc command is still used for static type checking. Note that the babel typescript plugin will transpile code regardless of its typecheck correctyness. 

tsc is also still used to generate the declaration files, since it looks as though the babel-typescript-plugin does not support creating those at this time. However there's a "create declaration only" flag that is convenient for this. 

I've excluded the .spec files from the babel build, so now they won't appear in lib. I didn't move the ignore declaration into the .babelrc because I can imagine a situation where we might want to use a cool feature in our test suite that babel can transpile for is (even though node 8 gets us there at the moment). However there's never a need to have the transpiled versions in our lib. 

Lastly, we can now support async await etc with the additions of lib -- es2015 and dom which I think will be especially useful in our tests because most of our exports will likely be functions that return promises.

PS: i'm not tied to the tests, i just want to prove that they work! I'm happy to remove them, as we definitely should in the future, thought it might be nice while we're building the foundation though.

Fixes #4
@BenAtEventbrite BenAtEventbrite added this to the Alpha milestone Apr 5, 2018
@ebtravis
Copy link
Collaborator

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

5 participants