-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Update: Add support for flow type import/export declarations #7708
Update: Add support for flow type import/export declarations #7708
Conversation
@zackargyle, thanks for your PR! By analyzing the history of the files in this pull request, we identified @SimenB, @vitorbal and @gyandeeps to be potential reviewers. |
Thanks for the pull request, @zackargyle! I took a look to make sure it's ready for merging and found some changes are needed:
Can you please update the pull request to address these? (More information can be found in our pull request guide.) |
Thanks for the pull request, @zackargyle! I took a look to make sure it's ready for merging and found some changes are needed:
Can you please update the pull request to address these? (More information can be found in our pull request guide.) |
Thanks for the pull request. However, we generally don't accept changes to ESLint's core rules that pertain to non-standard syntax extensions. To get around the issue with flow type imports/exports, I would recommend using the |
Hey @not-an-aardvark. I wasn't aware of no-duplicates! Looks like it's doing the same thing I'm doing here except it doesn't include exports. Any reason we'd allow the non-standard extension for that rule and not this one? That said, I totally get the idea and I can work with AirBnB to update their config to only use no-duplicates if you're really against this PR. |
Thanks for understanding. To clarify, I wasn't aware that the
I assume you mentioned AirBnB because you're using their ESLint config. If you don't end up getting the rules:
no-duplicate-imports: off # disable the no-duplicate-imports rule
import/no-duplicates: error # enable the no-duplicates rule from eslint-plugin-import
extends: airbnb |
Appreciate the swift response. You guys are doing fantastic work and we really appreciate it. Thanks for all you do! |
What is the purpose of this pull request? (put an "X" next to item)
[X] Other, please explain:
What changes did you make? (Give an overview)
A lot of large companies are using FlowType now, which allows you to import/export type definitions via a
type
keyword in the declaration.The issue is that these type imports cannot be consolidated into a single import declaration, which means that if you want some function in a file, and a type in a file, it is required that you have an import declaration for each. This breaks the
no-duplicate-imports
rule. We want the following example to not error.The changes shouldn't be noticeable to people not using Flow, but for those who are they will now be able to use this rule without issue.
Is there anything you'd like reviewers to focus on?
As far as I could tell there was no good way to add a plugin to a test suite, so I couldn't actually add any new tests for the Flow syntax since it requires the flow parser. The current tests still pass, and I verified the code works in our large Pinterest webapp codebase.