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

Remove flow type annotations, set up ESLint #623

Merged
merged 8 commits into from
Jun 10, 2024
Merged

Remove flow type annotations, set up ESLint #623

merged 8 commits into from
Jun 10, 2024

Conversation

lencioni
Copy link
Collaborator

@lencioni lencioni commented Jun 7, 2024

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.

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.
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.
Copy link
Collaborator

@mikabytes mikabytes left a 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.

@mikabytes mikabytes mentioned this pull request Jun 8, 2024
This will make it easier for folks to catch errors as they work.
Copy link
Collaborator

@trotzig trotzig left a 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!

@lencioni lencioni merged commit ece0e66 into main Jun 10, 2024
3 checks passed
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.

3 participants