-
Notifications
You must be signed in to change notification settings - Fork 55
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
Remove flow type annotations, set up ESLint #623
Conversation
I did this by running: ``` npm init @eslint/config@latest ```
We know that we do not want to use flow anymore. We may want to adopt TypeScript, but it is unclear if we will in the near term. #593 I want to re-introduce ESLint, and instead of setting up ESLint to be able to parse flow syntax, I decided that we should just remove it. #608 I removed these annotations by running the following command: ``` npx flow-remove-types lib/ -d lib/ ``` Then I formatted the files by running prettier on everything: ``` node_modules/.bin/prettier -w lib/ ``` I think if we wanted to introduce TypeScript that it might be easier to do it from scratch anyway instead of attempting to convert the flow types over to a different type system.
TypeScript pretty much won, and we've removed Flow annotations from this repo.
For convenience.
This is a node project, not a browser project, so we need to use the node globals. And we also need to tell ESLint about our tests, and how to ignore the stuff that used to be in the .eslintignore file. This resolves most of the errors.
Now that we have ESLint set up, we need to fix the things it complained about. This handles all of that in one commit.
This will help us avoid committing errors.
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.
Good to see some progress on this. Thank you!
All looks good to me.
One idea; maybe we could include eslint in npm test
. That way we cover tests, prettier, and eslint all in one command. Less likely to miss bugs before setting up a pull request.
This will make it easier for folks to catch errors as they work.
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 good to me! Thanks @lencioni!
Related issues:
I decided to remove flow type annotations with this change because I didn't want to bother with setting up the new ESLint to understand the flow syntax. I also think that it might be easier to adopt TypeScript from this state than it would be to attempt to port over the flow types.
For now, I am just rolling with the default recommended ESLint configuration that they include with the base package, to get a decent baseline of ESLint rules enabled.
This is probably best reviewed commit-by-commit instead of all at once.