-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Added flowUsesCommas option for object types #3547
Conversation
Current coverage is 88.62% (diff: 100%)
|
I assume that was from babel/eslint-plugin-babel#57? @sampepose Wouldn't the linting rule run before compilation (on the src files rather than dist files) especially if it is for eslint and the flow types stripped out anyway? |
Yep, that's the same rule. The issue is I'm generating Flow types programmatically from an AST. It would be nice for these to match our lint expectations for consistent readability, even if we don't lint generated files.
|
Makes sense and totally doable, just was wondering the feasibility of providing options for anything that can (quotes, whitespace, tabs, etc) and how we decide what to add (or support everything) |
It probably just makes sense to add them on a case by case basis. Especially since it doesn't look like too many people need this flexibility.
|
@@ -36,6 +36,7 @@ minified | boolean | `false` | Should the output be minif | |||
concise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`) | |||
quotes | `'single'` or `'double'` | autodetect based on `ast.tokens` | The type of quote to use in the output | |||
filename | string | | Used in warning messages | |||
flowUsesCommas | boolean | `false` | Should Flow object types be comma delimited |
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.
How would you feel about flowCommaSeparator
and
Set to
true
to use commas instead of semicolons as flow property separators
This has some conflicts with my refactoring changes, but it should be easy to add back in. |
@sampepose can you fix conflicts, or I'l do it manually |
da8be57
to
191b974
Compare
Good to go! |
Ok thanks - maybe it should just be the default (even though a breaking change - few are using the output itself) |
Currently there are 2 supported syntaxes (, and ;) in Flow Object Types. The use of commas is in line with the more popular style and matches how objects are defined in JS, making it a bit more natural to write. Recently FB added a lint rule that enforces the use of commas, so it would great to have this option in Babel as well. Thanks!